Binder\Binder.cs (7)
449return ((MethodSymbol)containingMember).IsScriptInitializer;
492internal virtual MethodSymbol? ParamsCollectionConstructorInProgress => null;
655symbol = ((MethodSymbol)symbol).ConstructedFrom;
754internal static bool IsDisallowedExtensionInOlderLangVer(MethodSymbol symbol)
759internal static void ReportDiagnosticsIfDisallowedExtension(BindingDiagnosticBag diagnostics, MethodSymbol method, SyntaxNode syntax)
767internal static void ReportDiagnosticsIfUnmanagedCallersOnly(BindingDiagnosticBag diagnostics, MethodSymbol symbol, SyntaxNodeOrToken syntax, bool isDelegateConversion)
911return new BoundBlock(statement.Syntax, locals, ImmutableArray<MethodSymbol>.CastUp(localFunctions), hasUnsafeModifier: false, instrumentation: null,
Binder\Binder.OperatorResolutionForReporting.cs (16)
28Debug.Assert(_nonExtensionResult is null or OverloadResolutionResult<MethodSymbol> or BinaryOperatorOverloadResolutionResult or UnaryOperatorOverloadResolutionResult);
29Debug.Assert(_extensionResult is null or OverloadResolutionResult<MethodSymbol> or BinaryOperatorOverloadResolutionResult or UnaryOperatorOverloadResolutionResult);
46public bool SaveResult(OverloadResolutionResult<MethodSymbol> result, bool isExtension)
89var results = ArrayBuilder<(MethodSymbol?, OperatorAnalysisResultKind)>.GetInstance();
100ArrayBuilder<(MethodSymbol? member, OperatorAnalysisResultKind resultKind)> results,
171case OverloadResolutionResult<MethodSymbol> r1:
221static bool hadAmbiguousBestMethods(ArrayBuilder<(MethodSymbol?, OperatorAnalysisResultKind)> results, SyntaxNode node, Binder binder, BindingDiagnosticBag diagnostics)
223if (!tryGetTwoBest(results, out var first, out var second))
245static void assertNone(ArrayBuilder<(MethodSymbol? member, OperatorAnalysisResultKind resultKind)> results, OperatorAnalysisResultKind kind)
250static bool tryGetTwoBest(ArrayBuilder<(MethodSymbol?, OperatorAnalysisResultKind)> results, [NotNullWhen(true)] out MethodSymbol? first, [NotNullWhen(true)] out MethodSymbol? second)
282static void populateResults(ArrayBuilder<(MethodSymbol?, OperatorAnalysisResultKind)> results, object? result)
286case OverloadResolutionResult<MethodSymbol> result1:
338case OverloadResolutionResult<MethodSymbol> result1:
Binder\Binder_Await.cs (18)
60out MethodSymbol? getResult,
111var containingMethod = this.ContainingMemberOrLambda as MethodSymbol;
174var method = (MethodSymbol)containingMemberOrLambda;
274out MethodSymbol? getResult,
360if (!isApplicableMethod(exprType, member, node, diagnostics, this, out MethodSymbol? method, out Conversion argumentConversion))
415[NotNullWhen(true)] out MethodSymbol? awaitMethod,
420if (member is not MethodSymbol method
447var substitutedMethod = method.Construct(exprType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics);
469static bool isValidConversion(TypeSymbol exprType, MethodSymbol method, SyntaxNode node, BindingDiagnosticBag diagnostics, Binder @this, out Conversion conversion)
497var awaitMethod = (MethodSymbol?)GetSpecialTypeMember(
513var runtimeAwaitAwaiterMethod = awaitMethod.Construct(awaiterType);
544static void reportObsoleteAndUnsafeDiagnostics(Binder @this, BindingDiagnosticBag diagnostics, MethodSymbol method, SyntaxNode syntax)
610var getAwaiterMethod = call.Method;
704private bool GetGetResultMethod(BoundExpression awaiterExpression, SyntaxNode node, TypeSymbol awaitedExpressionType, BindingDiagnosticBag diagnostics, out MethodSymbol? getResultMethod, [NotNullWhen(true)] out BoundExpression? getAwaiterGetResultCall)
748private static bool HasOptionalParameters(MethodSymbol method)
Binder\Binder_Conversions.cs (64)
433if (conversion.Method is MethodSymbol method && method.IsStatic)
550MethodSymbol? castUpMethod = TryFindCastUpMethod(sourceForCastUp, destination.OriginalDefinition);
577static void reportUseSiteOrMissing(MethodSymbol? method, object containingType, string methodName, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
595internal static MethodSymbol? TryFindImplicitOperatorFromArray(TypeSymbol type)
605internal static MethodSymbol? TryFindImplicitOperatorFromSpan(TypeSymbol spanType, TypeSymbol readonlySpanType)
615private static MethodSymbol? TryFindImplicitOperator<TArg>(TypeSymbol type, TArg arg,
616Func<TArg, MethodSymbol, bool> predicate)
645internal static MethodSymbol? TryFindCastUpMethod(TypeSymbol source, TypeSymbol destination)
673internal static MethodSymbol? TryFindAsSpanCharMethod(CSharpCompilation compilation, TypeSymbol readOnlySpanType)
679MethodSymbol? result = null;
707private static MethodSymbol? TryFindSingleMethod<TArg>(TypeSymbol type, string name, TArg arg, Func<TArg, MethodSymbol, bool> predicate)
710MethodSymbol? result = null;
713if (member is MethodSymbol method && predicate(arg, method))
860CollectionExpressionTypeKind collectionTypeKind, ImmutableArray<BoundNode> elements, BoundObjectOrCollectionValuePlaceholder? placeholder = null, BoundExpression? collectionCreation = null, MethodSymbol? collectionBuilderMethod = null, BoundCollectionBuilderElementsPlaceholder? collectionBuilderElementsPlaceholder = null)
882var collectionTypeKind = _conversion.GetCollectionExpressionTypeKind(out var elementType, out MethodSymbol? constructor, out bool isExpanded);
914MethodSymbol? constructor)
965private readonly BoundCollectionExpression? TryConvertCollectionExpressionImplementsIEnumerableType(MethodSymbol? constructor)
980_binder.HasParamsCollectionTypeInProgress(namedType, out NamedTypeSymbol? inProgress, out MethodSymbol? inProgressConstructor))
1033ref readonly CollectionExpressionConverter @this, SyntaxNode syntax, MethodSymbol? constructor)
1234var list_T__ctor = (MethodSymbol?)@this._binder.Compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__ctor);
1235var list_T__ctorInt32 = (MethodSymbol?)@this._binder.Compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__ctorInt32);
1237var candidateConstructorsBuilder = ArrayBuilder<MethodSymbol>.GetInstance();
1281static (BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundCollectionBuilderElementsPlaceholder? elementsPlaceholder) bindCollectionBuilderInfo(
1290var projectionMethods = ArrayBuilder<MethodSymbol>.GetInstance(collectionBuilderMethods.Length);
1291foreach (var builderMethod in collectionBuilderMethods)
1309var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
1352var collectionBuilderMethod = underlyingMethod;
1424internal ImmutableArray<MethodSymbol> GetCollectionBuilderMethods(
1450ImmutableArray<MethodSymbol> collectMethods(
1471var result = ArrayBuilder<MethodSymbol>.GetInstance();
1474if (candidate is not MethodSymbol { IsStatic: true } method)
1512MethodSymbol methodWithTargetTypeParameters; // builder method substituted with type parameters from target type
1559MethodSymbol collectionBuilderMethod,
1584out MethodSymbol? constructor,
1663out MemberResolutionResult<MethodSymbol> memberResolutionResult,
1697MemberResolutionResult<MethodSymbol> memberResolutionResult,
1704var method = memberResolutionResult.Member;
1739out MethodSymbol? constructor)
1760internal bool HasCollectionExpressionApplicableAddMethod(SyntaxNode syntax, TypeSymbol targetType, out ImmutableArray<MethodSymbol> addMethods, BindingDiagnosticBag diagnostics)
1805out ImmutableArray<MethodSymbol> addMethods)
1823out ImmutableArray<MethodSymbol> addMethods)
1864out ImmutableArray<MethodSymbol> addMethods)
1879out ImmutableArray<MethodSymbol> addMethods)
1969resolution.MethodGroup, diagnostics: diagnostics, out var addMethod);
1984static ImmutableArray<MethodSymbol> filterOutBadGenericMethods(
1986ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1989var resultBuilder = ArrayBuilder<MethodSymbol>.GetInstance(finalApplicableCandidates.Length);
1994var member = candidate.Member;
2020MethodSymbol? constructed = null;
2106OverloadResolutionResult<MethodSymbol> result,
2110out MethodSymbol? addMethod)
2751private static void CheckParameterModifierMismatchMethodConversion(SyntaxNode syntax, MethodSymbol lambdaOrMethod, TypeSymbol targetType, bool invokedAsExtensionMethod, BindingDiagnosticBag diagnostics)
2753MethodSymbol? delegateMethod;
2909ContainingMemberOrLambda is MethodSymbol { AreLocalsZeroed: false })
3090private bool MemberGroupFinalValidation(BoundExpression? receiverOpt, MethodSymbol methodSymbol, SyntaxNode node, BindingDiagnosticBag diagnostics, bool invokedAsExtensionMethod)
3169Debug.Assert(memberSymbol is not MethodSymbol { MethodKind: not MethodKind.Constructor } ||
3174if (receiverOpt != null || memberSymbol is not MethodSymbol { MethodKind: MethodKind.Constructor })
3321internal bool MethodIsCompatibleWithDelegateOrFunctionPointer(BoundExpression? receiverOpt, bool isExtensionMethod, MethodSymbol method, TypeSymbol delegateType, Location errorLocation, BindingDiagnosticBag diagnostics)
3327MethodSymbol delegateOrFuncPtrMethod = delegateType switch
3483internal static ParameterSymbol? GetReceiverParameter(MethodSymbol method)
3516MethodSymbol selectedMethod = conversion.Method;
Binder\Binder_Expressions.cs (113)
1351MethodSymbol method = this.ContainingMember() as MethodSymbol;
1492case MethodSymbol { AssociatedSymbol: SourcePropertySymbol property }:
1495case MethodSymbol { AssociatedSymbol.OriginalDefinition: PEPropertySymbol property } method when
1505if (contextualAttributeBinder is { AttributeTarget: MethodSymbol { AssociatedSymbol: SourcePropertySymbol property } })
1567ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: PropertySymbol { IsIndexer: false } })
2042var containingMethod = this.ContainingMemberOrLambda as MethodSymbol;
2087(this.ContainingMember() is MethodSymbol { MethodKind: MethodKind.Constructor } containingMember && (object)containingMember != primaryCtor)) && // We are in a non-primary instance constructor
2139bool capture = (this.ContainingMember() is MethodSymbol containingMethod && (object)primaryCtor != containingMethod);
2160this.ContainingMemberOrLambda is MethodSymbol { MethodKind: MethodKind.AnonymousFunction or MethodKind.LocalFunction } &&
2714MethodSymbol symbolOpt = GetWellKnownTypeMember(WellKnownMember.System_Index__ctor, diagnostics, syntax: node) as MethodSymbol;
2724MethodSymbol symbolOpt = null;
2749symbolOpt = (MethodSymbol)GetWellKnownTypeMember(
2758symbolOpt = (MethodSymbol)GetWellKnownTypeMember(
2879ImmutableArray<MethodSymbol> originalUserDefinedConversions = conversion.OriginalUserDefinedConversions;
3371&& ((MethodSymbol)containingSymbol).IsAsync
4864MethodSymbol constructor,
4888MethodSymbol constructor,
5024MemberResolutionResult<MethodSymbol> memberResolutionResult;
5025ImmutableArray<MethodSymbol> candidateConstructors;
5050MethodSymbol constructor,
5058MemberResolutionResult<MethodSymbol> memberResolutionResult,
5059ImmutableArray<MethodSymbol> candidateConstructors,
5069this.CheckAndCoerceArguments<MethodSymbol>(nonNullSyntax, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, out argsToParamsOpt);
5078MethodSymbol resultMember = memberResolutionResult.Member;
5198static void validateRecordCopyConstructor(MethodSymbol constructor, NamedTypeSymbol baseType, MethodSymbol resultMember, Location errorLocation, BindingDiagnosticBag diagnostics)
5249internal static bool IsUserDefinedRecordCopyConstructor(MethodSymbol constructor)
6304private static ImmutableSegmentedDictionary<string, Symbol> GetMembersRequiringInitialization(MethodSymbol constructor)
6316MethodSymbol constructor,
6651applicableMethods: ImmutableArray<MethodSymbol>.Empty,
6775internal ImmutableArray<MethodSymbol> FilterInaccessibleConstructors(ImmutableArray<MethodSymbol> constructors, bool allowProtectedConstructorsOfBaseType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
6777ArrayBuilder<MethodSymbol> builder = null;
6781MethodSymbol constructor = constructors[i];
6787builder = ArrayBuilder<MethodSymbol>.GetInstance();
6800private bool IsConstructorAccessible(MethodSymbol constructor, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool allowProtectedConstructorsOfBaseType = false)
6870OverloadResolutionResult<MethodSymbol> overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
6871ImmutableArray<MethodSymbol> accessibleConstructors = GetAccessibleConstructorsForOverloadResolution(type, ref useSiteInfo);
6920out MemberResolutionResult<MethodSymbol> memberResolutionResult,
6921out ImmutableArray<MethodSymbol> candidateConstructors,
6940MemberResolutionResult<MethodSymbol> memberResolutionResult,
6941ImmutableArray<MethodSymbol> candidateConstructors,
6960this.CheckAndCoerceArguments<MethodSymbol>(node, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, out argToParams);
6967var method = memberResolutionResult.Member;
7026MemberResolutionResult<MethodSymbol> memberResolutionResult,
7027ImmutableArray<MethodSymbol> candidateConstructors,
7043this.CheckAndCoerceArguments<MethodSymbol>(node, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, argsToParamsOpt: out _);
7326out MemberResolutionResult<MethodSymbol> memberResolutionResult,
7327out ImmutableArray<MethodSymbol> candidateConstructors,
7360ref ImmutableArray<MethodSymbol> candidateConstructors,
7361ImmutableArray<MethodSymbol> allInstanceConstructors,
7367out MemberResolutionResult<MethodSymbol> memberResolutionResult,
7371OverloadResolutionResult<MethodSymbol> result = OverloadResolutionResult<MethodSymbol>.GetInstance();
7392OverloadResolutionResult<MethodSymbol> inaccessibleResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
7410default(MemberResolutionResult<MethodSymbol>); // Invalid results are not interesting - we have enough info in candidateConstructors.
7481private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
7483ImmutableArray<MethodSymbol> allInstanceConstructors;
7487private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, bool allowProtectedConstructorsOfBaseType, out ImmutableArray<MethodSymbol> allInstanceConstructors, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
8214var method = resolution.MethodGroup.Methods[0];
8384lookupResult.Symbols.All(s => s.Kind == SymbolKind.Method) ? lookupResult.Symbols.SelectAsArray(s_toMethodSymbolFunc) : ImmutableArray<MethodSymbol>.Empty,
8527var builder = ArrayBuilder<MethodSymbol>.GetInstance();
8530var m = s as MethodSymbol;
8975MethodSymbol method = methodGroup.Methods[i];
9016var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
9093MethodSymbol representativeMethod = methodResult.OverloadResolutionResult is { } methodResolution
9900else if (convertedIndex is BoundObjectCreationExpression { Constructor: MethodSymbol constructor, Arguments: { Length: 2 } arguments, ArgsToParamsOpt: { IsDefaultOrEmpty: true }, InitializerExpressionOpt: null } &&
10713var substring = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_String__Substring, diagnostics, syntax);
10744candidate is MethodSymbol method &&
10761void makeCall(SyntaxNode syntax, BoundExpression receiver, MethodSymbol method,
10787internal static bool MethodHasValidSliceSignature(MethodSymbol method)
10854property.GetOwnOrInheritedGetMethod()?.OriginalDefinition is MethodSymbol getMethod &&
11042var method = node.LookupSymbolOpt as MethodSymbol;
11080var result = OverloadResolutionResult<MethodSymbol>.GetInstance();
11106var method = GetUniqueSignatureFromMethodGroup(node, out bool useParams);
11123private MethodSymbol? GetUniqueSignatureFromMethodGroup_CSharp10(BoundMethodGroup node, out bool useParams)
11125MethodSymbol? method = null;
11126var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: node.Methods.Length);
11127foreach (var m in node.Methods)
11152foreach (var m in methods)
11190if (extensionMember is MethodSymbol m)
11195var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true);
11235foreach (var reduced in methods)
11269static bool isCandidateUnique(ref MethodSymbol? method, MethodSymbol candidate)
11287bool memberCountsAsStatic = extensionMember is MethodSymbol { IsExtensionMethod: true } ? false : extensionMember.IsStatic;
11304private MethodSymbol? GetUniqueSignatureFromMethodGroup(BoundMethodGroup node, out bool useParams)
11312MethodSymbol? foundMethod = null;
11319var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: node.Methods.Length);
11320foreach (var memberMethod in node.Methods)
11344var substituted = typeArguments.IsDefaultOrEmpty ? memberMethod : memberMethod.Construct(typeArguments);
11359foreach (var substituted in methods)
11392var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: singleLookupResults.Count);
11404if (extensionMember is MethodSymbol)
11406var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true);
11421foreach (var method in methods)
11447static bool isCandidateUnique(ref MethodSymbol? foundMethod, MethodSymbol candidate)
11462bool satisfiesConstraintChecks(MethodSymbol method)
11489MethodSymbol methodSymbol,
11609MethodSymbol invoke = possibleDelegateType.DelegateInvokeMethod();
11743return symbol is MethodSymbol method &&
Binder\Binder_Invocation.cs (36)
42private static ImmutableArray<MethodSymbol> GetOriginalMethods(OverloadResolutionResult<MethodSymbol> overloadResolutionResult)
52return ImmutableArray<MethodSymbol>.Empty;
55var builder = ArrayBuilder<MethodSymbol>.GetInstance();
356result = BindDynamicInvocation(node, boundExpression, analyzedArguments, ImmutableArray<MethodSymbol>.Empty, diagnostics, queryClause);
403ImmutableArray<MethodSymbol> applicableMethods,
642var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
673private static bool HasApplicableConditionalMethod(ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates)
749ImmutableArray<MethodSymbol> originalMethods;
768Debug.Assert(methodGroup.LookupSymbolOpt is not MethodSymbol);
885private void ReportDynamicInvocationWarnings(SyntaxNode syntax, BoundMethodGroup methodGroup, BindingDiagnosticBag diagnostics, ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates)
925MemberResolutionResult<MethodSymbol> methodResolutionResult,
926MethodSymbol singleCandidate)
981MemberResolutionResult<MethodSymbol> methodResolutionResult)
983MethodSymbol singleCandidate = methodResolutionResult.LeastOverriddenMember;
990var resultWithSingleCandidate = OverloadResolutionResult<MethodSymbol>.GetInstance();
1038(typeArgumentsOpt.IsDefault || ((MethodSymbol)(object)result.Member).CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, syntax.Location, candidateDiagnostics))))
1142OverloadResolutionResult<MethodSymbol> result,
1211var method = methodResult.Member;
1388var method = property.GetMethod ?? property.SetMethod;
1399internal ThreeState ReceiverIsSubjectToCloning(BoundExpression? receiver, MethodSymbol method)
1458if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_UnknownWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1467if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_DispatchWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1907internal bool CheckImplicitThisCopyInReadOnlyMember(BoundExpression receiver, MethodSymbol method, BindingDiagnosticBag diagnostics)
1913ContainingMemberOrLambda is MethodSymbol containingMethod &&
2043ImmutableArray<MethodSymbol> methods,
2051MethodSymbol method;
2055var constructedMethods = ArrayBuilder<MethodSymbol>.GetInstance();
2056foreach (var m in methods)
2058MethodSymbol constructedMethod;
2098private static bool IsUnboundGeneric(MethodSymbol method)
2118private ImmutableArray<BoundExpression> BuildArgumentsForErrorRecovery(AnalyzedArguments analyzedArguments, ImmutableArray<MethodSymbol> methods, BindingDiagnosticBag diagnostics)
2121foreach (var m in methods)
2329MethodSymbol method = new ErrorMethodSymbol(methodContainer, returnType, string.Empty);
2334var originalMethods = (expr.Kind == BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty;
2570BuildArgumentsForErrorRecovery(analyzedArguments, StaticCast<MethodSymbol>.From(methods), BindingDiagnosticBag.Discarded),
Binder\Binder_Operators.cs (76)
156ImmutableArray<MethodSymbol> originalUserDefinedOperators;
172ImmutableArray<MethodSymbol> staticExtensionOriginalUserDefinedOperators;
327ImmutableArray<MethodSymbol> originalUserDefinedOperators,
393ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceOperators(
426ArrayBuilder<MethodSymbol> methods,
432var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
474var method = overloadResolutionResult.ValidResult.Member;
523originalUserDefinedOperatorsOpt: ImmutableArray<MethodSymbol>.Empty,
530ImmutableArray<MethodSymbol> methodsArray = methods.ToImmutableAndFree();
584out ImmutableArray<MethodSymbol> staticOriginalUserDefinedOperators)
664ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
716MethodSymbol method = isAddition ? eventSymbol.AddMethod : eventSymbol.RemoveMethod;
821MethodSymbol userDefinedOperator = null;
1009ImmutableArray<MethodSymbol> originalUserDefinedOperators;
1136out ImmutableArray<MethodSymbol> originalUserDefinedOperators, out BinaryOperatorSignature resultSignature, out BinaryOperatorAnalysisResult best)
1141originalUserDefinedOperators = default(ImmutableArray<MethodSymbol>);
1160ref ImmutableArray<MethodSymbol> originalUserDefinedOperators,
1221ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
1469ImmutableArray<MethodSymbol> originalUserDefinedOperators;
1475originalUserDefinedOperators = default(ImmutableArray<MethodSymbol>);
1588private bool IsValidDynamicCondition(BoundExpression left, bool isNegative, BindingDiagnosticBag diagnostics, out MethodSymbol userDefinedOperator)
1764MethodSymbol definition;
2037out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2055out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2069ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
2096out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2156out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2176private static BinaryOperatorAnalysisResult BinaryOperatorAnalyzeOverloadResolutionResult(BinaryOperatorOverloadResolutionResult result, out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2182var builder = ArrayBuilder<MethodSymbol>.GetInstance();
2185MethodSymbol method = analysisResult.Signature.Method;
2208originalUserDefinedOperators = ImmutableArray<MethodSymbol>.Empty;
2215private void ReportOperatorUseSiteDiagnostics(MethodSymbol operatorMethod, SyntaxNode node, BindingDiagnosticBag diagnostics)
2260out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2277ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
2302out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2330out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2336var builder = ArrayBuilder<MethodSymbol>.GetInstance();
2339MethodSymbol method = analysisResult.Signature.Method;
2378originalUserDefinedOperators = ImmutableArray<MethodSymbol>.Empty;
2408out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
3290originalUserDefinedOperatorsOpt: default(ImmutableArray<MethodSymbol>),
3316ImmutableArray<MethodSymbol> originalUserDefinedOperators;
3330ImmutableArray<MethodSymbol> staticExtensionOriginalUserDefinedOperators;
3480ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceOperators(
3512ArrayBuilder<MethodSymbol> methods,
3521var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
3559var method = overloadResolutionResult.ValidResult.Member;
3604ImmutableArray<MethodSymbol>.Empty,
3611ImmutableArray<MethodSymbol> methodsArray = methods.ToImmutableAndFree();
3668out ImmutableArray<MethodSymbol> staticOriginalUserDefinedOperators)
3754ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
3770private ArrayBuilder<MethodSymbol>? LookupUserDefinedInstanceOperators(TypeSymbol lookupInType, string? checkedName, string ordinaryName, int parameterCount, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3775ArrayBuilder<MethodSymbol>? methods = null;
3783methods = ArrayBuilder<MethodSymbol>.GetInstance(lookupResult.Symbols.Count);
3796methods = ArrayBuilder<MethodSymbol>.GetInstance(lookupResult.Symbols.Count);
3801var existing = new HashSet<MethodSymbol>(PairedOperatorComparer.Instance);
3803foreach (var method in methods)
3808foreach (MethodSymbol method in lookupResult.Symbols)
3822static void appendViableMethods(LookupResult lookupResult, int parameterCount, ArrayBuilder<MethodSymbol> methods)
3824foreach (MethodSymbol method in lookupResult.Symbols)
3834private static bool IsViableInstanceOperator(MethodSymbol method, int parameterCount)
3841private ArrayBuilder<MethodSymbol>? LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
3848ArrayBuilder<MethodSymbol>? checkedMethods = null;
3856ArrayBuilder<MethodSymbol>? ordinaryMethods = null;
3867var existing = new HashSet<MethodSymbol>(OverloadResolution.PairedExtensionOperatorSignatureComparer.Instance);
3870foreach (MethodSymbol method in ordinaryMethods)
3886ref ArrayBuilder<MethodSymbol>? methods)
3893var typeOperators = ArrayBuilder<MethodSymbol>.GetInstance();
3896foreach (MethodSymbol op in typeOperators)
3918methods ??= ArrayBuilder<MethodSymbol>.GetInstance();
3927private class PairedOperatorComparer : IEqualityComparer<MethodSymbol>
3933public bool Equals(MethodSymbol x, MethodSymbol y)
3946public int GetHashCode([DisallowNull] MethodSymbol method)
3967private bool CheckConstraintLanguageVersionAndRuntimeSupportForOperator(SyntaxNode node, MethodSymbol? methodOpt, bool isUnsignedRightShift, TypeSymbol? constrainedToTypeOpt, BindingDiagnosticBag diagnostics)
4366ImmutableArray<MethodSymbol> originalUserDefinedOperators;
Binder\Binder_Patterns.cs (16)
988MethodSymbol? deconstructMethod = null;
1017ShouldUseITupleForRecursivePattern(node, declType, diagnostics, out var iTupleType, out var iTupleGetLength, out var iTupleGetItem))
1060private MethodSymbol? BindDeconstructSubpatterns(
1069var deconstructMethod = deconstruct.ExpressionSymbol as MethodSymbol;
1212[NotNullWhen(true)] out MethodSymbol? iTupleGetLength,
1213[NotNullWhen(true)] out MethodSymbol? iTupleGetItem)
1250[NotNullWhen(true)] out MethodSymbol? iTupleGetLength,
1251[NotNullWhen(true)] out MethodSymbol? iTupleGetItem)
1281iTupleGetLength = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Length);
1282iTupleGetItem = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Item);
1392MethodSymbol? deconstructMethod = null;
1417ShouldUseITuple(node, strippedInputType, diagnostics, out var iTupleType, out var iTupleGetLength, out var iTupleGetItem))
1430deconstructMethod = deconstruct.ExpressionSymbol as MethodSymbol;
Binder\Binder_Statements.cs (39)
219var method = (MethodSymbol)this.ContainingMemberOrLambda;
482new SourceLabelSymbol((MethodSymbol)ContainingMemberOrLambda, node.Identifier);
639private bool ImplicitReturnIsOkay(MethodSymbol method)
755/// Checks for a Dispose method on <paramref name="expr"/> and returns its <see cref="MethodSymbol"/> if found.
760/// <returns>The <see cref="MethodSymbol"/> of the Dispose method if one is found, otherwise null.</returns>
761internal MethodSymbol TryFindDisposePatternMethod(BoundExpression expr, SyntaxNode syntaxNode, bool hasAwait, BindingDiagnosticBag diagnostics, out bool isExpanded)
771out var disposeMethod,
1248MethodSymbol fixedPatternMethod = null;
1325private MethodSymbol GetFixedPatternMethodOpt(BoundExpression initializer, BindingDiagnosticBag additionalDiagnostics)
1334var result = PerformPatternMethodLookup(initializer, methodName, initializer.Syntax, additionalDiagnostics, out var patternMethodSymbol, out bool isExpanded);
1362MethodSymbol patternMethodOpt,
1839return (member as MethodSymbol)?.MethodKind == (isStatic ?
1944ImmutableArray<MethodSymbol>.CastUp(GetDeclaredLocalFunctionsForScope(node)),
2316ImmutableArray<MethodSymbol> originalUserDefinedConversions = conversion.OriginalUserDefinedConversions;
2754var best = this.UnaryOperatorOverloadResolution(UnaryOperatorKind.True, expr, node, diagnostics, ref discardedOperatorResolutionForReporting, out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators);
2981protected static bool IsInAsyncMethod(MethodSymbol method)
2988return IsInAsyncMethod(this.ContainingMemberOrLambda as MethodSymbol);
2994return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningTask(this.Compilation);
3000return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningGenericTask(this.Compilation);
3008var method = (MethodSymbol)symbol;
3017var symbol = this.ContainingMemberOrLambda as MethodSymbol;
3590var inferringLambda = this.ContainingMemberOrLambda is MethodSymbol method && (object)method.ReturnType == LambdaSymbol.ReturnTypeIsBeingInferred;
3773BoundExpression initializerInvocation = GetBinder(initializer).BindConstructorInitializer(initializer.ArgumentList, (MethodSymbol)this.ContainingMember(), diagnostics);
3794if (isInstanceConstructor(out MethodSymbol constructorSymbol) &&
3825bool isInstanceConstructor(out MethodSymbol constructorSymbol)
3827if (this.ContainingMember() is MethodSymbol { IsStatic: false } method)
3839BoundExpression initializerInvocation = GetBinder(initializer).BindConstructorInitializer(initializer.ArgumentList, (MethodSymbol)this.ContainingMember(), diagnostics);
3851initializerInvocation = BindImplicitConstructorInitializer((MethodSymbol)this.ContainingMember(), diagnostics, Compilation);
3859var constructorInitializer = new BoundExpressionStatement(ctorSyntax, initializerInvocation) { WasCompilerGenerated = ((MethodSymbol)ContainingMember()).IsImplicitlyDeclared };
3872MethodSymbol constructor, BindingDiagnosticBag diagnostics, CSharpCompilation compilation)
3979internal static BoundCall? GenerateBaseParameterlessConstructorInitializer(MethodSymbol constructor, BindingDiagnosticBag diagnostics)
3982MethodSymbol? baseConstructor = null;
3986foreach (MethodSymbol ctor in baseType.InstanceConstructors)
4048MethodSymbol? baseConstructor = SynthesizedRecordCopyCtor.FindCopyConstructor(baseType, containingType, ref useSiteInfo);
4166SyntaxNode syntaxNode, BindingDiagnosticBag diagnostics, out MethodSymbol result, out bool isExpanded)
4230var patternMethodSymbol = call.Method;
Binder\ForEachLoopBinder.cs (35)
89(MethodSymbol)this.ContainingMemberOrLambda,
234MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo?.Method;
497ImmutableArray<MethodSymbol> originalUserDefinedConversions = elementConversionClassification.OriginalUserDefinedConversions;
730MethodSymbol nullableValueGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Nullable_T_get_Value, diagnostics, exprSyntax);
1063MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo.Method;
1101MethodSymbol getEnumeratorMethod;
1106getEnumeratorMethod = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerable_T__GetAsyncEnumerator,
1122getEnumeratorMethod = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerable_T__GetEnumerator, diagnostics, errorLocationSyntax);
1125MethodSymbol moveNextMethod = null;
1128MethodSymbol specificGetEnumeratorMethod = getEnumeratorMethod.AsMember(collectionType);
1139MethodSymbol currentPropertyGetter;
1144MethodSymbol moveNextAsync = (MethodSymbol)GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__MoveNextAsync,
1152currentPropertyGetter = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__get_Current, diagnostics, errorLocationSyntax.Location, isOptional: false);
1156currentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerator_T__get_Current, diagnostics, errorLocationSyntax);
1168moveNextMethod = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__MoveNext, diagnostics, errorLocationSyntax);
1183builder.CurrentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__get_Current, diagnostics, errorLocationSyntax);
1209MethodSymbol patternDisposeMethod = TryFindDisposePatternMethod(receiver, syntax, isAsync, patternDiagnostics, out bool expanded);
1315builder.CurrentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__get_Current, diagnostics, syntax);
1392ArrayBuilder<MethodSymbol> candidateMethods = ArrayBuilder<MethodSymbol>.GetInstance();
1407MethodSymbol method = (MethodSymbol)member;
1418candidateMethods.Add((MethodSymbol)member);
1433private MethodArgumentInfo PerformForEachPatternOverloadResolution(SyntaxNode syntax, SyntaxNode collectionSyntax, TypeSymbol patternType, ArrayBuilder<MethodSymbol> candidateMethods, bool warningsOnly, BindingDiagnosticBag diagnostics, bool isAsync)
1437var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
1452MethodSymbol result = null;
1537var result = overloadResolutionResult.ValidResult.Member;
1638MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo.Method;
1697MethodSymbol currentPropertyGetterCandidate = ((PropertySymbol)lookupSymbol).GetOwnOrInheritedGetMethod();
1740private bool IsInvalidMoveNextMethod(MethodSymbol moveNextMethodCandidate, bool isAsync)
1941var resolvedMember = (MethodSymbol)GetSpecialTypeMember(member, diagnostics, syntax);
1949private MethodArgumentInfo BindDefaultArguments(MethodSymbol method, BoundExpression extensionReceiverOpt, bool expanded, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
Binder\InMethodBinder.cs (5)
26private readonly MethodSymbol _methodSymbol;
31/// This map is used by <see cref="MethodCompiler.BindMethodBody(MethodSymbol, TypeCompilationState, BindingDiagnosticBag, bool, BoundNode?, bool, out ImportChain?, out bool, out bool, out MethodBodySemanticModel.InitialState)"/>
41public InMethodBinder(MethodSymbol owner, Binder enclosing)
273if (((MethodSymbol)newSymbol).MethodKind == MethodKind.LocalFunction)
309if (((MethodSymbol)newSymbol).MethodKind == MethodKind.LocalFunction)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (39)
101public void ObjectCreationOverloadResolution(ImmutableArray<MethodSymbol> constructors, AnalyzedArguments arguments, OverloadResolutionResult<MethodSymbol> result, bool dynamicResolution, bool isEarlyAttributeBinding, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
138ArrayBuilder<MethodSymbol> methods,
142OverloadResolutionResult<MethodSymbol> result,
226internal bool FilterMethodsForUniqueSignature(ArrayBuilder<MethodSymbol> methods, out bool useParams)
235var result = OverloadResolutionResult<MethodSymbol>.GetInstance();
249unreducedMethods = ArrayBuilder<MethodSymbol>.GetInstance(methods.Count);
250foreach (var method in methods)
295var applicableMethods = ArrayBuilder<MethodSymbol>.GetInstance(methods.Count);
544case MethodSymbol method:
614if (member is MethodSymbol { IsExtensionMethod: true })
665if (typeof(TMember) != typeof(MethodSymbol))
686var member = (MethodSymbol)(Symbol)result.Member;
806if (member is MethodSymbol method)
858Debug.Assert(typeof(TMember) == typeof(MethodSymbol));
868var method = (MethodSymbol)(Symbol)result.Member;
930private void AddConstructorToCandidateSet(MethodSymbol constructor, ArrayBuilder<MemberResolutionResult<MethodSymbol>> results,
939results.Add(new MemberResolutionResult<MethodSymbol>(constructor, constructor, MemberAnalysisResult.UnsupportedMetadata(), hasTypeArgumentInferredFromFunctionType: false));
961results.Add(new MemberResolutionResult<MethodSymbol>(constructor, constructor, result, hasTypeArgumentInferredFromFunctionType: false));
966MethodSymbol constructor,
1009MethodSymbol constructor,
1469return ((MethodSymbol)member).HidesBaseMethodsByName;
1745ArrayBuilder<MemberResolutionResult<MethodSymbol>> results,
1746ImmutableArray<MethodSymbol> constructors,
1759foreach (MethodSymbol constructor in constructors)
1775RemoveLowerPriorityMembers<MemberResolutionResult<MethodSymbol>, MethodSymbol>(results);
3288MethodSymbol invoke;
3575MethodSymbol invoke1 = d1.DelegateInvokeMethod;
3576MethodSymbol invoke2 = d2.DelegateInvokeMethod;
3703MethodSymbol invoke1 = d1.DelegateInvokeMethod;
3704MethodSymbol invoke2 = d2.DelegateInvokeMethod;
4395if (member is MethodSymbol method)
4470(MethodSymbol)(Symbol)member,
4592Debug.Assert(candidate is MethodSymbol { MethodKind: MethodKind.UserDefinedOperator });
4788return (TMember)(Symbol)(member as MethodSymbol).ConstructedFrom;
BoundTree\BoundObjectCreationExpression.cs (6)
12public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt,
15: this(syntax, constructor, ImmutableArray<MethodSymbol>.Empty, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, defaultArguments, constantValueOpt, initializerExpressionOpt, wasTargetTyped: false, type, hasErrors)
18public BoundObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded,
21return this.Update(constructor, ImmutableArray<MethodSymbol>.Empty, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, defaultArguments, constantValueOpt, initializerExpressionOpt, this.WasTargetTyped, type);
24public BoundObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<MethodSymbol> constructorsGroup, ImmutableArray<BoundExpression> arguments,
BoundTree\Constructors.cs (21)
90MethodSymbol method,
108MethodSymbol method,
124MethodSymbol method,
130ImmutableArray<MethodSymbol> originalMethods,
170public BoundCall Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments)
175public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method)
180public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, BoundExpression arg0)
185public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, BoundExpression arg0, BoundExpression arg1)
190public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt = default)
237static ImmutableArray<RefKind> getArgumentRefKinds(MethodSymbol method)
260public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, params BoundExpression[] arguments)
264public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments)
418MethodSymbol? methodOpt,
421ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt,
439MethodSymbol? methodOpt,
452MethodSymbol? methodOpt,
597: this(syntax, locals, ImmutableArray<MethodSymbol>.Empty, hasUnsafeModifier: false, instrumentation: null, statements, hasErrors)
688MethodSymbol? methodOpt,
700MethodSymbol? methodOpt,
713MethodSymbol? methodOpt,
726public BoundIncrementOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, BoundValuePlaceholder? operandPlaceholder, BoundExpression? operandConversion, BoundValuePlaceholder? resultPlaceholder, BoundExpression? resultConversion, LookupResultKind resultKind, TypeSymbol type)
CodeGen\EmitArrayInitializer.cs (8)
462var rosPointerCtor = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_ReadOnlySpan_T__ctor_Pointer, _diagnostics, syntax: wrappedExpression.Syntax, isOptional: true);
608MethodSymbol? createSpan = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__CreateSpanRuntimeFieldHandle, _diagnostics, syntax: wrappedExpression.Syntax, isOptional: true);
632if (!tryGetReadOnlySpanArrayCtor(wrappedExpression.Syntax, out var rosArrayCtor))
696if (!tryGetReadOnlySpanArrayCtor(arrayCreation.Syntax, out var rosArrayCtor))
775bool tryGetReadOnlySpanArrayCtor(SyntaxNode syntax, [NotNullWhen(true)] out MethodSymbol? rosArrayCtor)
777rosArrayCtor = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_ReadOnlySpan_T__ctor_Array, _diagnostics, syntax: syntax, isOptional: true);
CodeGen\EmitStatement.cs (18)
1566var sequenceEqualsTMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1572var sequenceEqualsCharMethod = sequenceEqualsTMethod.Construct(Binder.GetSpecialType(_module.Compilation, SpecialType.System_Char, syntaxNode, _diagnostics));
1575var asSpanMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_MemoryExtensions__AsSpan_String, _diagnostics, syntax: syntaxNode);
1581var stringEqualityMethod = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__op_Equality) as MethodSymbol;
1662var spanTLengthMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1667var spanCharLengthMethod = spanTLengthMethod.AsMember((NamedTypeSymbol)keyType);
1672var stringLengthMethod = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__Length) as MethodSymbol;
1686var spanTIndexerMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1692var spanCharLengthMethod = spanTIndexerMethod.AsMember((NamedTypeSymbol)keyType);
1698var stringCharsIndexer = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__Chars) as MethodSymbol;
1728Debug.Assert(stringEqualityMethodRef == _module.Translate((MethodSymbol)_module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__op_Equality), (CSharpSyntaxNode)syntaxNode, assertDiagnostics));
Compilation\CSharpCompilation.cs (34)
297internal bool IsNullableAnalysisEnabledIn(MethodSymbol method)
353if (symbol is not MethodSymbol { IsAsync: true } method)
604var methodSymbol = (debugEntryPoint as Symbols.PublicModel.MethodSymbol)?.UnderlyingMethodSymbol;
1937internal new MethodSymbol? GetEntryPoint(CancellationToken cancellationToken)
1976var entryPointMethod = FindEntryPoint(simpleProgramEntryPointSymbol, cancellationToken, out diagnostics);
1987private MethodSymbol? FindEntryPoint(MethodSymbol? simpleProgramEntryPointSymbol, CancellationToken cancellationToken, out ReadOnlyBindingDiagnostic<AssemblySymbol> sealedDiagnostics)
1991var entryPointCandidates = ArrayBuilder<MethodSymbol>.GetInstance();
2045foreach (var main in entryPointCandidates)
2066var taskEntryPoints = ArrayBuilder<(bool IsValid, MethodSymbol Candidate, BindingDiagnosticBag SpecificDiagnostics)>.GetInstance();
2073bool checkValid(MethodSymbol candidate, bool isCandidate, BindingDiagnosticBag specificDiagnostics)
2091var viableEntryPoints = ArrayBuilder<MethodSymbol>.GetInstance();
2093foreach (var candidate in entryPointCandidates)
2178MethodSymbol? entryPoint = null;
2192foreach (var viableEntryPoint in viableEntryPoints)
2232ArrayBuilder<MethodSymbol> entryPointCandidates, IEnumerable<Symbol> members)
2240if (member is MethodSymbol method && method.TryGetCorrespondingExtensionImplementationMethod() is { } implementationMethod)
2251static void addIfCandidate(ArrayBuilder<MethodSymbol> entryPointCandidates, Symbol member)
2253if (member is MethodSymbol method &&
2261internal bool ReturnsAwaitableToVoidOrInt(MethodSymbol method, BindingDiagnosticBag diagnostics)
2304internal (bool IsCandidate, bool IsTaskLike) HasEntryPointSignature(MethodSymbol method, BindingDiagnosticBag bag)
2358public readonly MethodSymbol? MethodSymbol;
2363public EntryPoint(MethodSymbol? methodSymbol, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics)
2517private ConcurrentSet<MethodSymbol>? _moduleInitializerMethods;
2519internal void AddModuleInitializerMethod(MethodSymbol method)
2547private ConcurrentDictionary<(ImmutableArray<byte> ContentHash, int Position), OneOrMany<(Location AttributeLocation, MethodSymbol Interceptor)>>? _interceptions;
2549internal void AddInterception(ImmutableArray<byte> contentHash, int position, Location attributeLocation, MethodSymbol interceptor)
2555() => new ConcurrentDictionary<(ImmutableArray<byte> ContentHash, int Position), OneOrMany<(Location AttributeLocation, MethodSymbol Interceptor)>>(comparer: InterceptorKeyComparer.Instance));
2576internal (Location AttributeLocation, MethodSymbol Interceptor)? TryGetInterceptor(SimpleNameSyntax? node)
3175if (symbol.Kind == SymbolKind.Method && symbol.IsImplicitlyDeclared && ((MethodSymbol)symbol).MethodKind == MethodKind.Constructor)
3607var entryPoint = MethodCompiler.GetEntryPoint(
3770foreach ((_, OneOrMany<(Location, MethodSymbol)> interceptionsOfAGivenLocation) in _interceptions)
3796foreach (MethodSymbol method in _moduleInitializerMethods.OrderBy<MethodSymbol>(LexicalOrderSymbolComparer.Instance))
Compilation\CSharpSemanticModel.cs (32)
1687if (symbol is MethodSymbol { IsExtensionMethod: true } extensionMethod)
1811case MethodSymbol { MethodKind: MethodKind.LambdaMethod }:
3512var methodSymbol = eventAssignment.IsAddition ? eventSymbol.AddMethod : eventSymbol.RemoveMethod;
3543var symbol = conversion.SymbolOpt;
3641memberGroup = dynamicInvocation.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3649memberGroup = collectionInit.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3669memberGroup = objectCreation.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3688memberGroup = boundObjectCreation.ConstructorsGroup.Cast<MethodSymbol, Symbol>();
3749return new ThisParameterSymbol(containingMember as MethodSymbol, typeOfThis);
3768thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, containingType);
3775thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, containingType);
3803thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, typeOfThis);
3957private static void GetSymbolsAndResultKind(BoundExpression node, Symbol symbolOpt, ImmutableArray<MethodSymbol> originalCandidates, out OneOrMany<Symbol> symbols, out LookupResultKind resultKind)
3988MethodSymbol constructor = null;
4034MethodSymbol constructorOpt,
4051ImmutableArray<MethodSymbol> candidateConstructors;
4072candidateConstructors = ImmutableArray<MethodSymbol>.Empty;
4087memberGroup = candidateConstructors.Cast<MethodSymbol, Symbol>();
4213private static ImmutableArray<MethodSymbol> FilterOverriddenOrHiddenMethods(ImmutableArray<MethodSymbol> methods)
4222foreach (MethodSymbol method in methods)
4315MethodSymbol method = null;
4344symbols = OneOrMany.Create(dynamicInvocation.ApplicableMethods.Cast<MethodSymbol, Symbol>());
4592ImmutableArray<MethodSymbol> nonHiddenMethods = FilterOverriddenOrHiddenMethods(node.Methods);
4595foreach (var method in nonHiddenMethods)
4654if (singleLookupResult.Symbol is not (MethodSymbol or PropertySymbol))
4781foreach (var method in FilterOverriddenOrHiddenMethods(methods))
4796var method = call.Method;
4803MethodSymbol reduced = method.ReduceExtensionMethod(receiver.Type, Compilation);
4813var method = delegateCreation.MethodOpt;
4818MethodSymbol reduced = method.ReduceExtensionMethod(receiverOpt.Type, Compilation);
5254if (node.GetInterceptableNameSyntax() is { } nameSyntax && Compilation.TryGetInterceptor(nameSyntax) is (_, MethodSymbol interceptor))
Compilation\MemberSemanticModel.SpeculativeMemberSemanticModel.cs (2)
52return NullableWalker.AnalyzeAndRewrite(Compilation, MemberSymbol as MethodSymbol, boundRoot, binder, initialState: null, diagnostics, createSnapshots: false, out snapshotManager, ref remappedSymbols);
57NullableWalker.AnalyzeWithoutRewrite(Compilation, MemberSymbol as MethodSymbol, boundRoot, binder, diagnostics, createSnapshots);
Compilation\MethodBodySemanticModel.cs (15)
44MethodSymbol owner,
61internal static MethodBodySemanticModel Create(SyntaxTreeSemanticModel containingSemanticModel, MethodSymbol owner, InitialState initialState)
112MethodSymbol owner,
124MethodSymbol owner,
137internal static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, ArrowExpressionClauseSyntax syntax, Binder rootBinder, int position)
145internal static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, ConstructorInitializerSyntax syntax, Binder rootBinder, int position)
153internal static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, PrimaryConstructorBaseTypeSyntax syntax, Binder rootBinder, int position)
168var methodSymbol = (MethodSymbol)this.MemberSymbol;
212var methodSymbol = (MethodSymbol)this.MemberSymbol;
230var methodSymbol = (MethodSymbol)this.MemberSymbol;
240if (MemberSymbol is MethodSymbol methodSymbol && methodSymbol.MethodKind == MethodKind.Constructor &&
305return Compilation.IsNullableAnalysisEnabledIn((MethodSymbol)MemberSymbol);
Compiler\MethodCompiler.cs (28)
136MethodSymbol? entryPoint = null;
226internal static MethodSymbol GetEntryPoint(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuilt, bool hasDeclarationErrors, bool emitMethodBodies, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken)
234var entryPoint = entryPointAndDiagnostics.MethodSymbol;
527MethodSymbol method = (MethodSymbol)member;
609foreach (var method in AnonymousTypeManager.GetAnonymousTypeHiddenMethods(containingType))
625MethodSymbol method = new SynthesizedStaticConstructor(sourceTypeSymbol);
680internal static MethodSymbol GetMethodToCompile(MethodSymbol method)
698var method = (MethodSymbol)definition.GetInternalSymbol();
717foreach (var method in additionalType.GetMethodsToEmit())
758var method = methodWithBody.Method;
903public override object VisitMethod(MethodSymbol symbol, TypeCompilationState arg)
924MethodSymbol methodSymbol,
1412private void EmitSkeletonMethodInExtension(MethodSymbol methodSymbol)
1424var ctor = (MethodSymbol)Binder.GetWellKnownTypeMember(_compilation, WellKnownMember.System_NotSupportedException__ctor, _diagnostics, syntax: syntax, isOptional: false);
1470private static MethodSymbol GetSymbolForEmittedBody(MethodSymbol methodSymbol)
1477MethodSymbol method,
1633MethodSymbol method,
1674MethodSymbol kickoffMethod;
1757MethodSymbol methodBodyParentSymbol = GetSymbolForEmittedBody(method);
1867internal static BoundBlock? BindSynthesizedMethodBody(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
1884MethodSymbol method,
2483private static BoundStatement BindImplicitConstructorInitializerIfAny(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
2507private static void ReportCtorInitializerCycles(MethodSymbol method, BoundExpression initializerInvocation, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
Compiler\TypeCompilationState.cs (19)
29public readonly MethodSymbol Method;
33internal MethodWithBody(MethodSymbol method, BoundStatement body, ImportChain? importChain)
52private Dictionary<MethodSymbol, MethodSymbol>? _wrappers;
80private SmallDictionary<MethodSymbol, MethodSymbol>? _constructorInitializers;
133public void AddSynthesizedMethod(MethodSymbol method, BoundStatement body)
150public void AddMethodWrapper(MethodSymbol method, MethodSymbol wrapper, BoundStatement body)
156_wrappers = new Dictionary<MethodSymbol, MethodSymbol>();
175public MethodSymbol? GetMethodWrapper(MethodSymbol method)
177MethodSymbol? wrapper = null;
202internal void ReportCtorInitializerCycles(MethodSymbol method1, MethodSymbol method2, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
217_constructorInitializers = new SmallDictionary<MethodSymbol, MethodSymbol>();
222MethodSymbol? next = method2;
Emitter\Model\PEModuleBuilder.cs (29)
28internal abstract class PEModuleBuilder : PEModuleBuilder<CSharpCompilation, SourceModuleSymbol, AssemblySymbol, TypeSymbol, NamedTypeSymbol, MethodSymbol, SyntaxNode, NoPia.EmbeddedTypesManager, ModuleCompilationState>
401var method = (MethodSymbol)member;
510internal virtual VariableSlotAllocator TryCreateVariableSlotAllocator(MethodSymbol method, MethodSymbol topLevelMethod, DiagnosticBag diagnostics)
515internal virtual MethodInstrumentation GetMethodBodyInstrumentations(MethodSymbol method)
993return ((MethodSymbol)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__InitializeArrayArrayRuntimeFieldHandle))?.GetCciAdapter();
1355internal sealed override Cci.IMethodReference Translate(MethodSymbol symbol, DiagnosticBag diagnostics, bool needDeclaration)
1361MethodSymbol methodSymbol,
1395MethodSymbol methodSymbol,
1455else if (methodSymbol is NativeIntegerMethodSymbol { UnderlyingMethod: MethodSymbol underlyingMethod })
1471MethodSymbol methodSymbol,
1583return container.Kind == SymbolKind.Method && ((MethodSymbol)container).IsGenericMethod ||
2002internal MethodSymbol EnsureThrowSwitchExpressionExceptionExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
2015private MethodSymbol EnsurePrivateImplClassMethodExists<TArg>(SyntaxNode syntaxNode, string methodName, Func<SynthesizedPrivateImplementationDetailsType, TArg, MethodSymbol> createMethodSymbol, TArg arg, DiagnosticBag diagnostics)
2022return (MethodSymbol)methodAdapter.GetInternalSymbol()!;
2025MethodSymbol methodSymbol = createMethodSymbol(privateImplClass, arg);
2030return (MethodSymbol)privateImplClass.PrivateImplementationDetails.GetMethod(methodName)!.GetInternalSymbol()!;
2049internal MethodSymbol EnsureThrowSwitchExpressionExceptionParameterlessExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
2069internal MethodSymbol EnsureThrowInvalidOperationExceptionExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
2086internal MethodSymbol EnsureInlineArrayAsSpanExists(SyntaxNode syntaxNode, NamedTypeSymbol spanType, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2122var attributeConstructor = (MethodSymbol)arg.factory.SpecialMember(SpecialMember.System_Runtime_CompilerServices_InlineArrayAttribute__ctor);
2157internal MethodSymbol EnsureInlineArrayAsReadOnlySpanExists(SyntaxNode syntaxNode, NamedTypeSymbol spanType, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2174internal MethodSymbol EnsureInlineArrayElementRefExists(SyntaxNode syntaxNode, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2190internal MethodSymbol EnsureInlineArrayElementRefReadOnlyExists(SyntaxNode syntaxNode, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2206internal MethodSymbol EnsureInlineArrayFirstElementRefExists(SyntaxNode syntaxNode, DiagnosticBag diagnostics)
2219internal MethodSymbol EnsureInlineArrayFirstElementRefReadOnlyExists(SyntaxNode syntaxNode, DiagnosticBag diagnostics)
Emitter\NoPia\EmbeddedTypesManager.cs (17)
41private readonly MethodSymbol[] _lazyWellKnownTypeMethods;
42private readonly MethodSymbol[] _lazySpecialTypeMethods;
47_lazyWellKnownTypeMethods = new MethodSymbol[(int)WellKnownMember.Count];
54_lazySpecialTypeMethods = new MethodSymbol[(int)SpecialMember.Count];
89public MethodSymbol GetWellKnownMethod(WellKnownMember method, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics)
97private MethodSymbol LazyGetWellKnownTypeMethod(ref MethodSymbol lazyMethod, WellKnownMember member, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics)
102var symbol = (MethodSymbol)Binder.GetWellKnownTypeMember(ModuleBeingBuilt.Compilation,
126public MethodSymbol GetSpecialMethod(SpecialMember method, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics)
134private MethodSymbol LazyGetSpecialTypeMethod(ref MethodSymbol lazyMethod, SpecialMember member, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics)
139var symbol = (MethodSymbol)Binder.GetSpecialTypeMember(ModuleBeingBuilt.Compilation,
165var ctor = GetWellKnownMethod(constructor, syntaxNodeOpt, diagnostics);
197var ctor = GetSpecialMethod(constructor, syntaxNodeOpt, diagnostics);
466foreach (MethodSymbol m in namedType.GetMethodsToEmit())
FlowAnalysis\AbstractFlowPass.cs (25)
470var method = _symbol as MethodSymbol;
484(_symbol as MethodSymbol)?.TryGetThisParameter(out thisParameter);
496var method = _symbol as MethodSymbol;
1420private void VisitReceiverBeforeCall(BoundExpression receiverOpt, MethodSymbol method)
1428private void VisitReceiverAfterCall(BoundExpression receiverOpt, MethodSymbol method)
1483var method = GetReadMethod(node.Indexer);
1517protected virtual void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method, ImmutableArray<int> argsToParamsOpt, bool expanded)
1545private void VisitArgumentsAfterCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol? method, ImmutableArray<int> argsToParamsOpt, bool expanded)
1579protected virtual void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method)
1643static bool ignoreReceiver(MethodSymbol method)
2122protected virtual void PropertySetter(BoundExpression node, BoundExpression receiver, MethodSymbol setter, BoundExpression value = null)
2149var method = GetWriteMethod(property);
2204var readMethod = GetReadMethod(property);
2223var writeMethod = GetWriteMethod(property);
2283var method = GetReadMethod(property);
2840var readMethod = GetReadMethod(property);
2841var writeMethod = GetWriteMethod(property);
3044var method = conversion.Method;
3621MethodSymbol method = null;
3732private static MethodSymbol GetReadMethod(PropertySymbol property) =>
3735private static MethodSymbol GetWriteMethod(PropertySymbol property) =>
3759var readMethod = property.GetOwnOrInheritedGetMethod();
3817var writeMethod = symbol.GetOwnOrInheritedSetMethod();
FlowAnalysis\FlowAnalysisPass.cs (6)
32MethodSymbol method,
113private static BoundBlock PrependImplicitInitializations(BoundBlock body, MethodSymbol method, ImmutableArray<FieldSymbol> implicitlyInitializedFields, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
168private static BoundBlock AppendImplicitReturn(BoundBlock body, MethodSymbol method, bool originalBodyNested)
179return body.Update(body.Locals, ImmutableArray<MethodSymbol>.Empty, body.HasUnsafeModifier, body.Instrumentation, builder.ToImmutableAndFree());
190internal static BoundBlock AppendImplicitReturn(BoundBlock body, MethodSymbol method)
212MethodSymbol method,
FlowAnalysis\NullableWalker.cs (181)
224private MethodSymbol? _delegateInvokeMethod;
263private PooledDictionary<MethodSymbol, Variables>? _nestedFunctionVariables;
288private readonly MethodSymbol? _baseOrThisInitializer;
485MethodSymbol? delegateInvokeMethodOpt,
490MethodSymbol? baseOrThisInitializer,
641if ((_symbol as MethodSymbol)?.IsConstructor() != true || _useConstructorExitWarnings)
669var method = _symbol as MethodSymbol;
741void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member, LocalState state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis)
835if (_symbol is MethodSymbol method)
913var baseOrThisInitializer = GetBaseOrThisInitializer();
1079private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt, LocalState state, MethodSymbol method, string memberName)
1113if (_symbol is MethodSymbol method)
1143if (_symbol is MethodSymbol method)
1191private void MakeMembersMaybeNull(MethodSymbol method, ImmutableArray<string> members)
1199void makeMemberMaybeNull(MethodSymbol method, string memberName)
1233containingSlot = GetReceiverSlotForMemberPostConditions(_symbol as MethodSymbol);
1249private MethodSymbol? GetBaseOrThisInitializer()
1256if (_symbol is not MethodSymbol method)
1304if (_symbol is not MethodSymbol method)
1422else if (CurrentSymbol is MethodSymbol { IsAsync: false })
1434if (CurrentSymbol is MethodSymbol method &&
1448MethodSymbol method,
1454MethodSymbol? baseOrThisInitializer,
1475MethodSymbol method,
1481MethodSymbol? baseOrThisInitializer,
1518if (symbol is MethodSymbol method
1534internal static VariableState? GetAfterInitializersState(CSharpCompilation compilation, MethodSymbol method, BoundNode nodeToAnalyze, BoundNode? constructorBody, BindingDiagnosticBag diagnostics)
1551MethodSymbol? baseOrThisInitializer = GetConstructorThisOrBaseSymbol(constructorBody);
1572private static MethodSymbol? GetConstructorThisOrBaseSymbol(BoundNode? constructorBody)
1801MethodSymbol? delegateInvokeMethodOpt,
1806var symbol = lambda.Symbol;
1847MethodSymbol? delegateInvokeMethodOpt,
1849MethodSymbol? baseOrThisInitializer,
2148var method = getTopLevelMethod(_symbol as MethodSymbol);
2227static MethodSymbol? getTopLevelMethod(MethodSymbol? method)
2236method = container as MethodSymbol;
2254var enclosingMemberMethod = _symbol as MethodSymbol;
2258enclosingMemberMethod = enclosingMemberMethod.ContainingSymbol as MethodSymbol;
2271if (this._symbol is MethodSymbol constructor
2806if (_symbol is not MethodSymbol method)
2961if (!(CurrentSymbol is MethodSymbol methodSymbol))
3124if (CurrentSymbol is MethodSymbol method)
3159var method = CurrentSymbol as MethodSymbol;
3167var delegateOrMethod = _useDelegateInvokeReturnType ? _delegateInvokeMethod! : method;
3399private Variables GetOrCreateNestedFunctionVariables(Variables container, MethodSymbol lambdaOrLocalFunction)
3401_nestedFunctionVariables ??= PooledDictionary<MethodSymbol, Variables>.GetInstance();
3413MethodSymbol lambdaOrFunctionSymbol,
3415MethodSymbol? delegateInvokeMethod,
3427var oldDelegateInvokeMethod = _delegateInvokeMethod;
3612private void VisitAwaitableInfoForUsing(BoundAwaitableInfo? awaitInfo, MethodSymbol? patternDisposeMethod)
3820var invokeMethod = n.DelegateInvokeMethod;
3967var constructor = (MethodSymbol)AsMemberOfType(collectionFinalType, objectCreation.Constructor);
4021var constructed = call.Method.Arity == 0 ? call.Method : call.Method.ConstructedFrom.Construct(allTypeArguments);
4070var addMethod = initializer.AddMethod;
4071MethodSymbol reinferredAddMethod;
4074reinferredAddMethod = (MethodSymbol)AsMemberOfType(targetCollectionType, addMethod);
4186var createMethod = node.CollectionBuilderMethod;
4202var createMethod = node.CollectionBuilderMethod;
4250MethodSymbol? constructor = getConstructor(node, node.Type);
4253ReinferenceResult<MethodSymbol> reinferenceResult = VisitArgumentsCore(
4259ArgumentsCompletionDelegate<MethodSymbol>? argumentsCompletion = reinferenceResult.Completion;
4264(int slot, NullableFlowState resultState, Func<TypeSymbol, MethodSymbol?, int>? initialStateInferenceCompletion) =
4281ArgumentsCompletionDelegate<MethodSymbol>? argumentsCompletion,
4282Func<TypeSymbol, MethodSymbol?, int>? initialStateInferenceCompletion,
4310ArgumentsCompletionDelegate<MethodSymbol> argumentsCompletion,
4311Func<TypeSymbol, MethodSymbol?, int> initialStateInferenceCompletion,
4323MethodSymbol? constructor = getConstructor(node, type);
4335static MethodSymbol? getConstructor(BoundObjectCreationExpressionBase node, TypeSymbol type)
4337var constructor = node.Constructor;
4341constructor = (MethodSymbol)AsMemberOfType(type, constructor);
4347(int slot, NullableFlowState resultState, Func<TypeSymbol, MethodSymbol?, int>? completion) inferInitialObjectState(
4348BoundExpression node, TypeSymbol type, MethodSymbol? constructor,
4418Func<TypeSymbol, MethodSymbol?, int> inferInitialObjectStateAsContinuation(
4424return (TypeSymbol type, MethodSymbol? constructor) =>
4763MethodSymbol addMethod = addMethodAsMemberOfContainingType(node, containingType, ref argumentResults);
4778MethodSymbol? reinferredMethod = reinferenceResult.Member;
4780ArgumentsCompletionDelegate<MethodSymbol>? visitArgumentsCompletion = reinferenceResult.Completion;
4796MethodSymbol? reinferredMethod,
4798ArgumentsCompletionDelegate<MethodSymbol>? visitArgumentsCompletion,
4823ArgumentsCompletionDelegate<MethodSymbol> visitArgumentsCompletion)
4827MethodSymbol addMethod = addMethodAsMemberOfContainingType(node, containingType, ref argumentResults);
4835static MethodSymbol addMethodAsMemberOfContainingType(BoundCollectionElementInitializer node, TypeSymbol containingType, ref ImmutableArray<VisitResult> argumentResults)
4837var method = node.AddMethod;
4861method = (MethodSymbol)AsMemberOfType(containingType, method);
5296private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType)
5535MethodSymbol? method,
5558MethodSymbol reinferredMethod = ReInferBinaryOperator(binary.Syntax, method, leftOperand, rightOperand, leftUnderlyingType, rightUnderlyingType);
5615private MethodSymbol ReInferBinaryOperator(
5617MethodSymbol method,
5624MethodSymbol reinferredMethod;
5630reinferredMethod = (MethodSymbol)AsMemberOfType(asMemberOfType, method);
6846ReinferenceResult<MethodSymbol> reinferenceResult = ReInferMethodAndVisitArguments(
6860MethodSymbol? method = reinferenceResult.Member;
6877private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method)
6891private ReinferenceResult<MethodSymbol> ReInferMethodAndVisitArguments(
6895MethodSymbol method,
6911method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
6919ReinferenceResult<MethodSymbol> reinferenceResult = VisitArgumentsCore(node, arguments, refKindsOpt, parameters, argsToParamsOpt, defaultArguments,
6923var newMethod = reinferenceResult.Member;
7012private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results)
7050static bool anyOverriddenMethodHasExplicitImplementation(MethodSymbol method)
7052for (var overriddenMethod = method; overriddenMethod is object; overriddenMethod = overriddenMethod.OverriddenMethod)
7063static bool isWellKnownEqualityMethodOrImplementation(CSharpCompilation compilation, MethodSymbol method, TypeSymbol? receiverType, WellKnownMember wellKnownMember)
7065var wellKnownMethod = (MethodSymbol?)compilation.GetWellKnownTypeMember(wellKnownMember);
7074var constructedMethod = wellKnownMethod.AsMember(constructedType);
7099for (var overriddenMethod = method; overriddenMethod is object; overriddenMethod = overriddenMethod.OverriddenMethod)
7177private bool IsCompareExchangeMethod(MethodSymbol? method)
7249private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method)
7282private TypeWithState GetReturnTypeWithState(MethodSymbol method)
7420protected override void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method, ImmutableArray<int> argsToParamsOpt, bool expanded)
7430MethodSymbol? method,
7546if (member is MethodSymbol reinferredMethod)
7566var method = member as MethodSymbol;
7814private void ApplyMemberPostConditions(BoundExpression? receiverOpt, MethodSymbol? method)
7838private int GetReceiverSlotForMemberPostConditions(MethodSymbol? method)
7850MethodSymbol? current = method;
7851while (current.ContainingSymbol is MethodSymbol container)
7868private void ApplyMemberPostConditions(int receiverSlot, MethodSymbol method)
8700internal override TypeWithAnnotations GetMethodGroupResultType(BoundMethodGroup group, MethodSymbol method)
8706method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
8801private void CheckMethodConstraints(SyntaxNode syntax, MethodSymbol method)
9012if (((MethodSymbol)symbol).MethodKind == MethodKind.LocalFunction)
9085if (result is MethodSymbol resultMethod && resultMethod.IsGenericMethod)
9087result = resultMethod.Construct(((MethodSymbol)symbol).TypeArgumentsWithAnnotations);
9466private void ReportNullabilityMismatchWithTargetDelegate(Location location, TypeSymbol targetType, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool invokedAsExtensionMethod)
9484void reportBadDelegateReturn(BindingDiagnosticBag bag, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool topLevel, (TypeSymbol targetType, Location location) arg)
9491void reportBadDelegateParameter(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameter, bool topLevel, (TypeSymbol targetType, Location location) arg)
9502MethodSymbol? targetInvokeMethod = delegateType.DelegateInvokeMethod;
9555void reportBadDelegateReturn(BindingDiagnosticBag bag, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool topLevel, Location location)
9562void reportBadDelegateParameter(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameterSymbol, bool topLevel, Location location)
9676var method = conversion.Method;
9693static (MethodSymbol invokeSignature, ImmutableArray<ParameterSymbol>) getDelegateOrFunctionPointerInfo(TypeSymbol targetType)
10215var method = conversion.Method;
10515var method = node.MethodOpt;
10645private MethodSymbol CheckMethodGroupReceiverNullability(BoundMethodGroup group, ImmutableArray<ParameterSymbol> parameters, MethodSymbol method, bool invokedAsExtensionMethod)
10655method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
10719var delegateInvokeMethod = delegateTypeOpt?.DelegateInvokeMethod;
10735private static void UseDelegateInvokeParameterAndReturnTypes(BoundLambda lambda, MethodSymbol? delegateInvokeMethod, out bool useDelegateInvokeParameterTypes, out bool useDelegateInvokeReturnType)
11037deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.Type, deconstructMethod);
11297ReinferenceResult<MethodSymbol> reinferenceResult = ReInferMethodAndVisitArguments(
11357MethodSymbol? incrementOperator = (node.OperatorKind.IsUserDefined() && node.MethodOpt?.ParameterCount == 1) ? node.MethodOpt : null;
11478ReinferenceResult<MethodSymbol> reinferenceResult = ReInferMethodAndVisitArguments(
11862var getMethod = ((PropertySymbol)member.OriginalDefinition).GetMethod;
11883var getValue = (MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Nullable_T_get_Value);
11948MethodSymbol? reinferredGetEnumeratorMethod = null;
11957ReinferenceResult<MethodSymbol> reinferenceResult = ReInferMethodAndVisitArguments(
12067reinferredGetEnumeratorMethod = (MethodSymbol)AsMemberOfType(getEnumeratorType, enumeratorInfoOpt.GetEnumeratorInfo.Method);
12080var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.Type, enumeratorInfoOpt.CurrentPropertyGetter);
12089var moveNextAsyncMethod = (MethodSymbol)AsMemberOfType(reinferredGetEnumeratorMethod.ReturnType, enumeratorInfoOpt.MoveNextInfo.Method);
12100var patternDisposeMethod = enumeratorInfoOpt.PatternDisposeInfo?.Method;
12103patternDisposeMethod = (MethodSymbol)AsMemberOfType(reinferredGetEnumeratorMethod.ReturnType, patternDisposeMethod);
12308node.MethodOpt is MethodSymbol method &&
12353private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType)
12357method = (MethodSymbol)AsMemberOfType(operandType.Type!.StrippedType(), method);
12530MethodSymbol logicalOperator = binary.LogicalOperator;
12533MethodSymbol reInferredMethod = ReInferBinaryOperator(binary.Syntax, logicalOperator, leftOperand, rightOperand, leftUnderlyingType, rightUnderlyingType);
12546MethodSymbol trueFalseOperator = isAnd ? binary.FalseOperator : binary.TrueOperator;
12549var updatedTrueFalseOperator = ReInferUnaryOperator(leftOperand.Syntax, trueFalseOperator, binary.Left, leftType);
12606var getResult = awaitableInfo.GetResult;
12607var reinferredGetResult = _visitResult.RValueType.Type is NamedTypeSymbol taskAwaiterType
13159var method = (MethodSymbol)CurrentSymbol;
13858var variables = (symbol.ContainingSymbol is MethodSymbol containingMethod ? _variables.GetVariablesForMethodScope(containingMethod) : null) ??
Generated\BoundNodes.xml.Generated.cs (232)
1207public BoundUnaryOperator(SyntaxNode syntax, UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1227public MethodSymbol? MethodOpt { get; }
1230public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1235public BoundUnaryOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
1249public BoundIncrementOperator(SyntaxNode syntax, UnaryOperatorKind operatorKind, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, BoundValuePlaceholder? operandPlaceholder, BoundExpression? operandConversion, BoundValuePlaceholder? resultPlaceholder, BoundExpression? resultConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1271public MethodSymbol? MethodOpt { get; }
1278public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1283public BoundIncrementOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, BoundValuePlaceholder? operandPlaceholder, BoundExpression? operandConversion, BoundValuePlaceholder? resultPlaceholder, BoundExpression? resultConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
1358public BoundFunctionPointerLoad(SyntaxNode syntax, MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type, bool hasErrors)
1369public BoundFunctionPointerLoad(SyntaxNode syntax, MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type)
1380public MethodSymbol TargetMethod { get; }
1387public BoundFunctionPointerLoad Update(MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type)
1507public BoundRefTypeOperator(SyntaxNode syntax, BoundExpression operand, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors = false)
1520public MethodSymbol? GetTypeFromHandle { get; }
1525public BoundRefTypeOperator Update(BoundExpression operand, MethodSymbol? getTypeFromHandle, TypeSymbol type)
1601public BoundFromEndIndexExpression(SyntaxNode syntax, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
1614public MethodSymbol? MethodOpt { get; }
1619public BoundFromEndIndexExpression Update(BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol type)
1633public BoundRangeExpression(SyntaxNode syntax, BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
1647public MethodSymbol? MethodOpt { get; }
1652public BoundRangeExpression Update(BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type)
1761public BoundUserDefinedConditionalLogicalOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, BoundValuePlaceholder? trueFalseOperandPlaceholder, BoundExpression? trueFalseOperandConversion, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type, bool hasErrors = false)
1788public MethodSymbol LogicalOperator { get; }
1789public MethodSymbol TrueOperator { get; }
1790public MethodSymbol FalseOperator { get; }
1795public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1800public BoundUserDefinedConditionalLogicalOperator Update(BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, BoundValuePlaceholder? trueFalseOperandPlaceholder, BoundExpression? trueFalseOperandConversion, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type)
1814public BoundCompoundAssignmentOperator(SyntaxNode syntax, BinaryOperatorSignature @operator, BoundExpression left, BoundExpression right, BoundValuePlaceholder? leftPlaceholder, BoundExpression? leftConversion, BoundValuePlaceholder? finalPlaceholder, BoundExpression? finalConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1842public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1847public BoundCompoundAssignmentOperator Update(BinaryOperatorSignature @operator, BoundExpression left, BoundExpression right, BoundValuePlaceholder? leftPlaceholder, BoundExpression? leftConversion, BoundValuePlaceholder? finalPlaceholder, BoundExpression? finalConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
2177public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder, bool hasErrors = false)
2197public MethodSymbol? GetResult { get; }
2204public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder)
2253protected BoundTypeOf(BoundKind kind, SyntaxNode syntax, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors)
2262protected BoundTypeOf(BoundKind kind, SyntaxNode syntax, MethodSymbol? getTypeFromHandle, TypeSymbol type)
2272public MethodSymbol? GetTypeFromHandle { get; }
2277public BoundTypeOfOperator(SyntaxNode syntax, BoundTypeExpression sourceType, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors = false)
2292public BoundTypeOfOperator Update(BoundTypeExpression sourceType, MethodSymbol? getTypeFromHandle, TypeSymbol type)
2338public BoundMethodDefIndex(SyntaxNode syntax, MethodSymbol method, TypeSymbol type, bool hasErrors)
2352public BoundMethodDefIndex(SyntaxNode syntax, MethodSymbol method, TypeSymbol type)
2363public MethodSymbol Method { get; }
2368public BoundMethodDefIndex Update(MethodSymbol method, TypeSymbol type)
2756public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type, bool hasErrors)
2767public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
2779public MethodSymbol Method { get; }
2780public MethodSymbol? GetMethodFromHandle { get; }
2785public BoundMethodInfo Update(MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
2799public BoundFieldInfo(SyntaxNode syntax, FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type, bool hasErrors)
2810public BoundFieldInfo(SyntaxNode syntax, FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type)
2823public MethodSymbol? GetFieldFromHandle { get; }
2828public BoundFieldInfo Update(FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type)
3048public BoundReadOnlySpanFromArray(SyntaxNode syntax, BoundExpression operand, MethodSymbol conversionMethod, TypeSymbol type, bool hasErrors = false)
3062public MethodSymbol ConversionMethod { get; }
3067public BoundReadOnlySpanFromArray Update(BoundExpression operand, MethodSymbol conversionMethod, TypeSymbol type)
3147public BoundFixedLocalCollectionInitializer(SyntaxNode syntax, TypeSymbol elementPointerType, BoundValuePlaceholder? elementPointerPlaceholder, BoundExpression? elementPointerConversion, BoundExpression expression, MethodSymbol? getPinnableOpt, TypeSymbol type, bool hasErrors = false)
3167public MethodSymbol? GetPinnableOpt { get; }
3172public BoundFixedLocalCollectionInitializer Update(TypeSymbol elementPointerType, BoundValuePlaceholder? elementPointerPlaceholder, BoundExpression? elementPointerConversion, BoundExpression expression, MethodSymbol? getPinnableOpt, TypeSymbol type)
3357public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3372public ImmutableArray<MethodSymbol> LocalFunctions { get; }
3379public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements)
3559public BoundLocalFunctionStatement(SyntaxNode syntax, MethodSymbol symbol, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false)
3570public MethodSymbol Symbol { get; }
3577public BoundLocalFunctionStatement Update(MethodSymbol symbol, BoundBlock? blockBody, BoundBlock? expressionBody)
3827public BoundSwitchStatement(SyntaxNode syntax, BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<MethodSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, LabelSymbol breakLabel, bool hasErrors = false)
3849public ImmutableArray<MethodSymbol> InnerLocalFunctions { get; }
3858public BoundSwitchStatement Update(BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<MethodSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, LabelSymbol breakLabel)
5441public BoundDagDeconstructEvaluation(SyntaxNode syntax, MethodSymbol deconstructMethod, BoundDagTemp input, bool hasErrors = false)
5451public MethodSymbol DeconstructMethod { get; }
5456public BoundDagDeconstructEvaluation Update(MethodSymbol deconstructMethod, BoundDagTemp input)
5950public BoundDynamicInvocation(SyntaxNode syntax, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false)
5967public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
5972public BoundDynamicInvocation Update(ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type)
6019public BoundLoweredConditionalAccess(SyntaxNode syntax, BoundExpression receiver, MethodSymbol? hasValueMethodOpt, BoundExpression whenNotNull, BoundExpression? whenNullOpt, int id, bool forceCopyOfNullableValueType, TypeSymbol type, bool hasErrors = false)
6037public MethodSymbol? HasValueMethodOpt { get; }
6046public BoundLoweredConditionalAccess Update(BoundExpression receiver, MethodSymbol? hasValueMethodOpt, BoundExpression whenNotNull, BoundExpression? whenNullOpt, int id, bool forceCopyOfNullableValueType, TypeSymbol type)
6131public BoundMethodGroup(SyntaxNode syntax, ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, string name, ImmutableArray<MethodSymbol> methods, Symbol? lookupSymbolOpt, DiagnosticInfo? lookupError, BoundMethodGroupFlags? flags, FunctionTypeSymbol? functionType, BoundExpression? receiverOpt, LookupResultKind resultKind, bool hasErrors = false)
6149public ImmutableArray<MethodSymbol> Methods { get; }
6158public BoundMethodGroup Update(ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, string name, ImmutableArray<MethodSymbol> methods, Symbol? lookupSymbolOpt, DiagnosticInfo? lookupError, BoundMethodGroupFlags? flags, FunctionTypeSymbol? functionType, BoundExpression? receiverOpt, LookupResultKind resultKind)
6200public BoundCall(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool isDelegateCall, bool expanded, bool invokedAsExtensionMethod, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalMethodsOpt, TypeSymbol type, bool hasErrors = false)
6230public MethodSymbol Method { get; }
6240public ImmutableArray<MethodSymbol> OriginalMethodsOpt { get; }
6245public BoundCall Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool isDelegateCall, bool expanded, bool invokedAsExtensionMethod, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalMethodsOpt, TypeSymbol type)
6298public BoundAttribute(SyntaxNode syntax, MethodSymbol? constructor, ImmutableArray<BoundExpression> constructorArguments, ImmutableArray<string?> constructorArgumentNamesOpt, ImmutableArray<int> constructorArgumentsToParamsOpt, bool constructorExpanded, BitVector constructorDefaultArguments, ImmutableArray<BoundAssignmentOperator> namedArguments, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
6317public MethodSymbol? Constructor { get; }
6329public BoundAttribute Update(MethodSymbol? constructor, ImmutableArray<BoundExpression> constructorArguments, ImmutableArray<string?> constructorArgumentNamesOpt, ImmutableArray<int> constructorArgumentsToParamsOpt, bool constructorExpanded, BitVector constructorDefaultArguments, ImmutableArray<BoundAssignmentOperator> namedArguments, LookupResultKind resultKind, TypeSymbol type)
6402public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<MethodSymbol> constructorsGroup, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ConstantValue? constantValueOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false)
6424public override MethodSymbol Constructor { get; }
6425public ImmutableArray<MethodSymbol> ConstructorsGroup { get; }
6439public BoundObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<MethodSymbol> constructorsGroup, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ConstantValue? constantValueOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, bool wasTargetTyped, TypeSymbol type)
6532public BoundCollectionExpression(SyntaxNode syntax, CollectionExpressionTypeKind collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundCollectionBuilderElementsPlaceholder? collectionBuilderElementsPlaceholder, bool wasTargetTyped, bool hasWithElement, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type, bool hasErrors = false)
6558public MethodSymbol? CollectionBuilderMethod { get; }
6567public BoundCollectionExpression Update(CollectionExpressionTypeKind collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundCollectionBuilderElementsPlaceholder? collectionBuilderElementsPlaceholder, bool wasTargetTyped, bool hasWithElement, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type)
6724public BoundDynamicObjectCreationExpression(SyntaxNode syntax, string name, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, ImmutableArray<MethodSymbol> applicableMethods, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false)
6747public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
6753public BoundDynamicObjectCreationExpression Update(string name, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, ImmutableArray<MethodSymbol> applicableMethods, bool wasTargetTyped, TypeSymbol type)
6968public BoundCollectionElementInitializer(SyntaxNode syntax, MethodSymbol addMethod, ImmutableArray<BoundExpression> arguments, BoundExpression? implicitReceiverOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, bool invokedAsExtensionMethod, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
6987public MethodSymbol AddMethod { get; }
6999public BoundCollectionElementInitializer Update(MethodSymbol addMethod, ImmutableArray<BoundExpression> arguments, BoundExpression? implicitReceiverOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, bool invokedAsExtensionMethod, LookupResultKind resultKind, TypeSymbol type)
7013public BoundDynamicCollectionElementInitializer(SyntaxNode syntax, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false)
7026public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
7031public BoundDynamicCollectionElementInitializer Update(ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type)
7080public BoundAnonymousObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<BoundAnonymousPropertyDeclaration> declarations, TypeSymbol type, bool hasErrors = false)
7095public MethodSymbol Constructor { get; }
7102public BoundAnonymousObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<BoundAnonymousPropertyDeclaration> declarations, TypeSymbol type)
7186public BoundDelegateCreationExpression(SyntaxNode syntax, BoundExpression argument, MethodSymbol? methodOpt, bool isExtensionMethod, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false)
7201public MethodSymbol? MethodOpt { get; }
7208public BoundDelegateCreationExpression Update(BoundExpression argument, MethodSymbol? methodOpt, bool isExtensionMethod, bool wasTargetTyped, TypeSymbol type)
7695public BoundLambda(SyntaxNode syntax, UnboundLambda unboundLambda, MethodSymbol symbol, BoundBlock body, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics, Binder binder, TypeSymbol? type, bool hasErrors = false)
7712public MethodSymbol Symbol { get; }
7721public BoundLambda Update(UnboundLambda unboundLambda, MethodSymbol symbol, BoundBlock body, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics, Binder binder, TypeSymbol? type)
8254public BoundRecursivePattern(SyntaxNode syntax, BoundTypeExpression? declaredType, MethodSymbol? deconstructMethod, ImmutableArray<BoundPositionalSubpattern> deconstruction, ImmutableArray<BoundPropertySubpattern> properties, bool isExplicitNotNullTest, Symbol? variable, BoundExpression? variableAccess, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false)
8273public MethodSymbol? DeconstructMethod { get; }
8281public BoundRecursivePattern Update(BoundTypeExpression? declaredType, MethodSymbol? deconstructMethod, ImmutableArray<BoundPositionalSubpattern> deconstruction, ImmutableArray<BoundPropertySubpattern> properties, bool isExplicitNotNullTest, Symbol? variable, BoundExpression? variableAccess, TypeSymbol inputType, TypeSymbol narrowedType)
8378public BoundITuplePattern(SyntaxNode syntax, MethodSymbol getLengthMethod, MethodSymbol getItemMethod, ImmutableArray<BoundPositionalSubpattern> subpatterns, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false)
8397public MethodSymbol GetLengthMethod { get; }
8398public MethodSymbol GetItemMethod { get; }
8404public BoundITuplePattern Update(MethodSymbol getLengthMethod, MethodSymbol getItemMethod, ImmutableArray<BoundPositionalSubpattern> subpatterns, TypeSymbol inputType, TypeSymbol narrowedType)
8934public BoundWithExpression(SyntaxNode syntax, BoundExpression receiver, MethodSymbol? cloneMethod, BoundObjectInitializerExpressionBase initializerExpression, TypeSymbol type, bool hasErrors = false)
8949public MethodSymbol? CloneMethod { get; }
8955public BoundWithExpression Update(BoundExpression receiver, MethodSymbol? cloneMethod, BoundObjectInitializerExpressionBase initializerExpression, TypeSymbol type)
11108MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11109ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11117MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11118ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11142MethodSymbol targetMethod = this.VisitMethodSymbol(node.TargetMethod);
11169MethodSymbol? getTypeFromHandle = this.VisitMethodSymbol(node.GetTypeFromHandle);
11188MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11195MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11217MethodSymbol logicalOperator = this.VisitMethodSymbol(node.LogicalOperator);
11218MethodSymbol trueOperator = this.VisitMethodSymbol(node.TrueOperator);
11219MethodSymbol falseOperator = this.VisitMethodSymbol(node.FalseOperator);
11220ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11231ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11310MethodSymbol? getResult = this.VisitMethodSymbol(node.GetResult);
11326MethodSymbol? getTypeFromHandle = this.VisitMethodSymbol(node.GetTypeFromHandle);
11340MethodSymbol method = this.VisitMethodSymbol(node.Method);
11400MethodSymbol method = this.VisitMethodSymbol(node.Method);
11401MethodSymbol? getMethodFromHandle = this.VisitMethodSymbol(node.GetMethodFromHandle);
11408MethodSymbol? getFieldFromHandle = this.VisitMethodSymbol(node.GetFieldFromHandle);
11453MethodSymbol conversionMethod = this.VisitMethodSymbol(node.ConversionMethod);
11471MethodSymbol? getPinnableOpt = this.VisitMethodSymbol(node.GetPinnableOpt);
11495ImmutableArray<MethodSymbol> localFunctions = this.VisitDeclaredLocalFunctions(node.LocalFunctions);
11533MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
11573ImmutableArray<MethodSymbol> innerLocalFunctions = this.VisitDeclaredLocalFunctions(node.InnerLocalFunctions);
11866MethodSymbol deconstructMethod = this.VisitMethodSymbol(node.DeconstructMethod);
11964ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
11979MethodSymbol? hasValueMethodOpt = this.VisitMethodSymbol(node.HasValueMethodOpt);
12000ImmutableArray<MethodSymbol> methods = this.VisitSymbols<MethodSymbol>(node.Methods);
12016MethodSymbol method = this.VisitMethodSymbol(node.Method);
12017ImmutableArray<MethodSymbol> originalMethodsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalMethodsOpt);
12033MethodSymbol? constructor = this.VisitMethodSymbol(node.Constructor);
12047MethodSymbol constructor = this.VisitMethodSymbol(node.Constructor);
12048ImmutableArray<MethodSymbol> constructorsGroup = this.VisitSymbols<MethodSymbol>(node.ConstructorsGroup);
12068MethodSymbol? collectionBuilderMethod = this.VisitMethodSymbol(node.CollectionBuilderMethod);
12107ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
12149MethodSymbol addMethod = this.VisitMethodSymbol(node.AddMethod);
12157ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
12170MethodSymbol constructor = this.VisitMethodSymbol(node.Constructor);
12190MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
12288MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
12385MethodSymbol? deconstructMethod = this.VisitMethodSymbol(node.DeconstructMethod);
12420MethodSymbol getLengthMethod = this.VisitMethodSymbol(node.GetLengthMethod);
12421MethodSymbol getItemMethod = this.VisitMethodSymbol(node.GetItemMethod);
12528MethodSymbol? cloneMethod = this.VisitMethodSymbol(node.CloneMethod);
12847MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12849ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12867MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12869ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12925MethodSymbol targetMethod = GetUpdatedSymbol(node, node.TargetMethod);
12996MethodSymbol? getTypeFromHandle = GetUpdatedSymbol(node, node.GetTypeFromHandle);
13048MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
13066MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
13269MethodSymbol? getResult = GetUpdatedSymbol(node, node.GetResult);
13297MethodSymbol? getTypeFromHandle = GetUpdatedSymbol(node, node.GetTypeFromHandle);
13323MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13472MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13473MethodSymbol? getMethodFromHandle = GetUpdatedSymbol(node, node.GetMethodFromHandle);
13491MethodSymbol? getFieldFromHandle = GetUpdatedSymbol(node, node.GetFieldFromHandle);
13609MethodSymbol conversionMethod = GetUpdatedSymbol(node, node.ConversionMethod);
13657MethodSymbol? getPinnableOpt = GetUpdatedSymbol(node, node.GetPinnableOpt);
13678ImmutableArray<MethodSymbol> localFunctions = GetUpdatedArray(node, node.LocalFunctions);
13709MethodSymbol symbol = GetUpdatedSymbol(node, node.Symbol);
13718ImmutableArray<MethodSymbol> innerLocalFunctions = GetUpdatedArray(node, node.InnerLocalFunctions);
13998MethodSymbol deconstructMethod = GetUpdatedSymbol(node, node.DeconstructMethod);
14128ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14165MethodSymbol? hasValueMethodOpt = GetUpdatedSymbol(node, node.HasValueMethodOpt);
14215ImmutableArray<MethodSymbol> methods = GetUpdatedArray(node, node.Methods);
14253MethodSymbol method = GetUpdatedSymbol(node, node.Method);
14254ImmutableArray<MethodSymbol> originalMethodsOpt = GetUpdatedArray(node, node.OriginalMethodsOpt);
14292MethodSymbol? constructor = GetUpdatedSymbol(node, node.Constructor);
14328MethodSymbol constructor = GetUpdatedSymbol(node, node.Constructor);
14329ImmutableArray<MethodSymbol> constructorsGroup = GetUpdatedArray(node, node.ConstructorsGroup);
14366MethodSymbol? collectionBuilderMethod = GetUpdatedSymbol(node, node.CollectionBuilderMethod);
14435ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14543MethodSymbol addMethod = GetUpdatedSymbol(node, node.AddMethod);
14562ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14593MethodSymbol constructor = GetUpdatedSymbol(node, node.Constructor);
14646MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
14865MethodSymbol symbol = GetUpdatedSymbol(node, node.Symbol);
15060MethodSymbol? deconstructMethod = GetUpdatedSymbol(node, node.DeconstructMethod);
15098MethodSymbol getLengthMethod = GetUpdatedSymbol(node, node.GetLengthMethod);
15099MethodSymbol getItemMethod = GetUpdatedSymbol(node, node.GetItemMethod);
15254MethodSymbol? cloneMethod = GetUpdatedSymbol(node, node.CloneMethod);
Lowering\AsyncRewriter\AsyncMethodBuilderMemberCollection.cs (33)
44internal readonly MethodSymbol CreateBuilder;
49internal readonly MethodSymbol SetException;
54internal readonly MethodSymbol SetResult;
59internal readonly MethodSymbol AwaitOnCompleted;
64internal readonly MethodSymbol AwaitUnsafeOnCompleted;
69internal readonly MethodSymbol Start;
74internal readonly MethodSymbol SetStateMachine;
89MethodSymbol createBuilder,
90MethodSymbol setException,
91MethodSymbol setResult,
92MethodSymbol awaitOnCompleted,
93MethodSymbol awaitUnsafeOnCompleted,
94MethodSymbol start,
95MethodSymbol setStateMachine,
112internal static bool TryCreate(SyntheticBoundNodeFactory F, MethodSymbol method, TypeMap typeMap, out AsyncMethodBuilderMemberCollection collection)
119TryGetBuilderMember<MethodSymbol>(
124out MethodSymbol createBuilderMethod);
152MethodSymbol createBuilderMethod;
154TryGetBuilderMember<MethodSymbol>(
186MethodSymbol createBuilderMethod = null;
215TryGetBuilderMember<MethodSymbol>(
267MethodSymbol createBuilderMethod = null;
298TryGetBuilderMember<MethodSymbol>(
376MethodSymbol createBuilderMethod,
386MethodSymbol setExceptionMethod;
387MethodSymbol setResultMethod;
388MethodSymbol awaitOnCompletedMethod;
389MethodSymbol awaitUnsafeOnCompletedMethod;
390MethodSymbol startMethod;
391MethodSymbol setStateMachineMethod;
469private static MethodSymbol GetCustomCreateMethod(
483var method = (MethodSymbol)member;
Lowering\ClosureConversion\ClosureConversion.cs (26)
63/// a (<see cref="MethodSymbol"/>, <see cref="BoundStatement"/>) pair for each generated method.
67/// (<see cref="MethodSymbol"/>, <see cref="BoundStatement"/>) pairs for additional methods that the lambda rewriter produced.
76private readonly MethodSymbol _topLevelMethod;
77private readonly MethodSymbol _substitutedSourceMethod;
100private MethodSymbol _currentMethod;
165MethodSymbol method,
167MethodSymbol substitutedSourceMethod,
208(localOrParameter as MethodSymbol)?.MethodKind == MethodKind.LocalFunction);
235MethodSymbol method,
237MethodSymbol substitutedSourceMethod,
323protected override MethodSymbol CurrentMethod
378var containingMethod = scope.ContainingFunctionOpt?.OriginalMethodSymbol ?? _topLevelMethod;
414var originalMethod = nestedFunction.OriginalMethodSymbol;
532var containingMethod = isNonGeneric ? null : (_substitutedSourceMethod ?? _topLevelMethod);
681MethodSymbol constructor = frame.Constructor.AsMember(frameType);
863var loweredSymbol = (node.Method.MethodKind is MethodKind.LambdaMethod or MethodKind.LocalFunction) ?
875MethodSymbol localFunc,
877out MethodSymbol method,
1017MethodSymbol originalMethod,
1020ref MethodSymbol synthesizedMethod,
1088out var method,
1350out var method,
1377out MethodSymbol remappedMethod,
1561var oldMethod = _currentMethod;
1608private void AddSynthesizedMethod(MethodSymbol method, BoundStatement body)
1652MethodSymbol referencedMethod = synthesizedMethod;
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (9)
392private static WellKnownMember GetBinaryOperatorFactory(BinaryOperatorKind opKind, MethodSymbol methodOpt, out bool isChecked, out bool isLifted, out bool requiresLifted)
488static bool useCheckedFactory(bool isChecked, MethodSymbol methodOpt)
494private BoundExpression VisitBinaryOperator(BinaryOperatorKind opKind, MethodSymbol methodOpt, TypeSymbol type, BoundExpression left, BoundExpression right)
574private BoundExpression MakeBinary(MethodSymbol methodOpt, TypeSymbol type, bool isLifted, bool requiresLifted, WellKnownMember opFactory, BoundExpression loweredLeft, BoundExpression loweredRight)
653var method = node.Method;
707var method = node.SymbolOpt;
765private BoundExpression DelegateCreation(BoundExpression receiver, MethodSymbol method, TypeSymbol delegateType, bool requiresInstanceReceiver)
780var createDelegate = _bound.WellKnownMethod(WellKnownMember.System_Reflection_MethodInfo__CreateDelegate, isOptional: true);
1154var getMethod = node.PropertySymbol.GetOwnOrInheritedGetMethod();
Lowering\DiagnosticsPass_ExpressionTrees.cs (13)
26private readonly MethodSymbol _containingSymbol;
31public static void IssueDiagnostics(CSharpCompilation compilation, BoundNode node, BindingDiagnosticBag diagnostics, MethodSymbol containingSymbol)
49private DiagnosticsPass(CSharpCompilation compilation, BindingDiagnosticBag diagnostics, MethodSymbol containingSymbol)
221private void CheckReferenceToMethodIfLocalFunction(BoundExpression node, MethodSymbol method)
307MethodSymbol method,
568var method = indexer.GetOwnOrInheritedGetMethod() ?? indexer.GetOwnOrInheritedSetMethod();
610var lambda = node.Symbol;
753var binary = node.LogicalOperator;
754var unary = node.OperatorKind.Operator() == BinaryOperatorKind.And ? node.FalseOperator : node.TrueOperator;
803if (_inExpressionLambda && node.MethodOpt is MethodSymbol method && (method.IsAbstract || method.IsVirtual) && method.IsStatic)
900if (_inExpressionLambda && node.Conversion.Method is MethodSymbol method && (method.IsAbstract || method.IsVirtual) && method.IsStatic)
933private void CheckMethodGroup(BoundMethodGroup node, MethodSymbol method, bool isExtensionMethod, bool parentIsConversion, TypeSymbol convertedToType)
942if ((node.LookupSymbolOpt as MethodSymbol)?.MethodKind == MethodKind.LocalFunction)
Lowering\ExtensionMethodBodyRewriter.cs (14)
32public ExtensionMethodBodyRewriter(MethodSymbol sourceMethod, SourceExtensionImplementationMethodSymbol implementationMethod)
51private (RewrittenMethodSymbol, ImmutableDictionary<Symbol, Symbol>) EnterMethod(MethodSymbol symbol, RewrittenMethodSymbol rewritten, ReadOnlySpan<ParameterSymbol> rewrittenParameters)
73private (RewrittenMethodSymbol, ImmutableDictionary<Symbol, Symbol>) EnterMethod(MethodSymbol symbol, RewrittenLambdaOrLocalFunctionSymbol rewritten)
78protected override MethodSymbol CurrentMethod => _rewrittenContainingMethod;
110MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
129foreach (var localFunction in node.LocalFunctions)
143protected override ImmutableArray<MethodSymbol> VisitDeclaredLocalFunctions(ImmutableArray<MethodSymbol> localFunctions)
145return localFunctions.SelectAsArray(static (l, map) => (MethodSymbol)map[l], _symbolMap);
149public override MethodSymbol? VisitMethodSymbol(MethodSymbol? symbol)
154return (MethodSymbol)_symbolMap[symbol];
159return (MethodSymbol)_symbolMap[symbol];
162return ((MethodSymbol)_symbolMap[symbol.OriginalDefinition]).ConstructIfGeneric(TypeMap.SubstituteTypes(symbol.TypeArgumentsWithAnnotations));
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (16)
26private readonly MethodSymbol _method;
28private readonly MethodSymbol _createPayloadForMethodsSpanningSingleFile;
29private readonly MethodSymbol _createPayloadForMethodsSpanningMultipleFiles;
40MethodSymbol method,
63MethodSymbol createPayloadForMethodsSpanningSingleFile = GetCreatePayloadOverload(
69MethodSymbol createPayloadForMethodsSpanningMultipleFiles = GetCreatePayloadOverload(
102MethodSymbol method,
105MethodSymbol createPayloadForMethodsSpanningSingleFile,
106MethodSymbol createPayloadForMethodsSpanningMultipleFiles,
123var oldMethod = methodBodyFactory.CurrentFunction;
141private static bool IsExcludedFromCodeCoverage(MethodSymbol method)
169MethodSymbol createPayloadForMethodsSpanningSingleFile,
170MethodSymbol createPayloadForMethodsSpanningMultipleFiles,
177MethodSymbol createPayloadOverload;
564private static MethodSymbol GetCreatePayloadOverload(CSharpCompilation compilation, WellKnownMember overload, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
566return (MethodSymbol)Binder.GetWellKnownTypeMember(compilation, overload, diagnostics, syntax: syntax);
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (16)
153MethodSymbol method,
204private MethodSymbol? GetLocalOrParameterStoreLogger(TypeSymbol variableType, Symbol targetSymbol, bool? refAssignmentSourceIsLocal, SyntaxNode syntax)
263var symbol = GetWellKnownMethodSymbol(overload, syntax);
268private MethodSymbol? GetWellKnownMethodSymbol(WellKnownMember overload, SyntaxNode syntax)
269=> (MethodSymbol?)Binder.GetWellKnownTypeMember(_factory.Compilation, overload, _diagnostics, syntax: syntax, isOptional: false);
271private MethodSymbol? GetSpecialMethodSymbol(SpecialMember overload, SyntaxNode syntax)
272=> (MethodSymbol?)Binder.GetSpecialTypeMember(_factory.Compilation, overload, _diagnostics, syntax: syntax);
301var currentFunction = _factory.CurrentFunction;
314var parameterLogger = GetLocalOrParameterStoreLogger(parameter.Type, parameter, refAssignmentSourceIsLocal: null, _factory.Syntax);
349var entryLogger = GetWellKnownMethodSymbol(entryOverload, _factory.Syntax);
353var returnLogger = GetWellKnownMethodSymbol(WellKnownMember.Microsoft_CodeAnalysis_Runtime_LocalStoreTracker__LogReturn, _factory.Syntax);
400var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal, original.Syntax);
471var toStringMethod = GetSpecialMethodSymbol(SpecialMember.System_Object__ToString, value.Syntax);
534var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, original.Syntax);
555MethodSymbol method = original.Method;
612var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, invocation.Syntax);
Lowering\LocalRewriter\DelegateCacheContainer.cs (8)
19private readonly Dictionary<(TypeSymbol?, TypeSymbol, MethodSymbol), FieldSymbol> _delegateFields = new(CLRSignatureComparer.Instance);
36TypeMap.ConcatMethodTypeParameters((MethodSymbol)owner, stopAt: null)))
40Debug.Assert(owner is NamedTypeSymbol { Arity: > 0 } or MethodSymbol { Arity: > 0 });
62var targetMethod = boundDelegateCreation.MethodOpt;
93private sealed class CLRSignatureComparer : IEqualityComparer<(TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod)>
97public bool Equals((TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) x, (TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) y)
106public int GetHashCode((TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) conversion)
Lowering\LocalRewriter\LocalRewriter.cs (18)
57MethodSymbol containingMethod,
86MethodSymbol method,
337delegateType.DelegateInvokeMethod() is MethodSymbol delegateInvoke &&
355var lambda = node.Symbol;
358var oldContainingSymbol = _factory.CurrentFunction;
388var localFunction = node.Symbol;
419static bool hasReturnTypeOrParameter(MethodSymbol localFunction, Func<TypeWithAnnotations, bool> predicate) =>
423var oldContainingSymbol = _factory.CurrentFunction;
615/// Recommendation: Do not use, use <see cref="TryGetSpecialTypeMethod(SyntaxNode, SpecialMember, out MethodSymbol, bool)"/> instead!
618private MethodSymbol UnsafeGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember)
625/// Recommendation: Do not use, use <see cref="TryGetSpecialTypeMethod(SyntaxNode, SpecialMember, CSharpCompilation, BindingDiagnosticBag, out MethodSymbol, bool)"/> instead!
628private static MethodSymbol UnsafeGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, CSharpCompilation compilation, BindingDiagnosticBag diagnostics)
630MethodSymbol method;
645private bool TryGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, out MethodSymbol method, bool isOptional = false)
650private static bool TryGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, CSharpCompilation compilation, BindingDiagnosticBag diagnostics, out MethodSymbol method, bool isOptional = false)
666MethodSymbol? getTypeFromHandle;
696MethodSymbol? getTypeFromHandle;
1139private void CheckRefReadOnlySymbols(MethodSymbol symbol)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (23)
187MethodSymbol? method,
203MethodSymbol? method,
545private BoundExpression RewriteLiftedBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt)
608MethodSymbol? leftTruthOperator,
733private BoundExpression MakeTruthTestForDynamicLogicalOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, TypeSymbol boolean, MethodSymbol? leftTruthOperator, TypeSymbol? constrainedToTypeOpt, bool negative)
757return new BoundUnaryOperator(syntax, UnaryOperatorKind.BoolLogicalNegation, converted, ConstantValue.NotAvailable, MethodSymbol.None, constrainedToTypeOpt: null, LookupResultKind.Viable, boolean)
792MethodSymbol? method,
819MethodSymbol? method,
1149MethodSymbol? method,
1318MethodSymbol? method,
1358MethodSymbol? method,
1427MethodSymbol? method,
1529MethodSymbol? method,
1855MethodSymbol getValueOrDefaultX = UnsafeGetNullableMethod(syntax, boundTempX.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1856MethodSymbol getValueOrDefaultY = UnsafeGetNullableMethod(syntax, boundTempY.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1913private MethodSymbol UnsafeGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member)
1923internal static MethodSymbol UnsafeGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member, CSharpCompilation compilation, BindingDiagnosticBag diagnostics)
1930private bool TryGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member, out MethodSymbol result, bool isOptional = false)
2021var method = UnsafeGetSpecialTypeMethod(syntax, member);
2029MethodSymbol method;
2032method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member);
2035(object)(method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member)) == null)
2082var method = UnsafeGetSpecialTypeMethod(syntax, member);
Lowering\LocalRewriter\LocalRewriter_Call.cs (13)
98private void EmbedIfNeedTo(BoundExpression receiver, ImmutableArray<MethodSymbol> methods, SyntaxNode syntaxNode)
109foreach (var m in methods)
137ref MethodSymbol method,
200var containingMethod = this._factory.CurrentFunction;
216var symbolForCompare = needToReduce ? ReducedExtensionMethodSymbol.Create(interceptor, receiverOpt!.Type, _compilation, out _) : interceptor;
379MethodSymbol method = node.Method;
459MethodSymbol method,
540private BoundExpression MakeCall(SyntaxNode syntax, BoundExpression? rewrittenReceiver, MethodSymbol method, ImmutableArray<BoundExpression> rewrittenArguments)
673var requiresInstanceReceiver = methodOrIndexer.RequiresInstanceReceiver() && methodOrIndexer is not MethodSymbol { MethodKind: MethodKind.Constructor } and not FunctionPointerMethodSymbol;
958(isReceiverTakenByValue && methodOrIndexer is MethodSymbol)) // Extension methods with by-value receivers capture by value as classic extension methods do.
1327return ((MethodSymbol)methodOrIndexer).Parameters[0].Type as NamedTypeSymbol;
1510MethodSymbol? arrayEmpty = _compilation.GetSpecialTypeMember(SpecialMember.System_Array__Empty) as MethodSymbol;
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (47)
115var addMethod = (MethodSymbol?)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__Add);
123static bool canOptimizeListElement(BoundNode element, MethodSymbol addMethod)
178if (!TryGetWellKnownTypeMember(node.Syntax, WellKnownMember.System_Linq_Enumerable__ToList, out MethodSymbol? toListGeneric, isOptional: true))
183var toListOfElementType = toListGeneric.Construct([listElementType]);
200private bool ShouldUseIEnumerableBulkAddMethod(TypeSymbol spreadType, TypeSymbol targetEnumerableType, MethodSymbol? getEnumeratorMethod)
304if (_factory.WellKnownMethod(WellKnownMember.System_Runtime_InteropServices_ImmutableCollectionsMarshal__AsImmutableArray_T, isOptional: true) is MethodSymbol asImmutableArray)
338var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_ReadOnlySpan_T__ctor_Array)).AsMember(spanType);
371var spanConstructor = _factory.WellKnownMethod(wellKnownMember).AsMember(spanType);
411var listToArray = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ToArray)).AsMember((NamedTypeSymbol)list.Type);
588var constructMethod = node.CollectionBuilderMethod;
653: WellKnownMember.System_Span_T__ctor_ref_T, isOptional: true) is MethodSymbol spanRefConstructor)
659var constructor = spanRefConstructor.AsMember(spanType);
671MethodSymbol elementRef = _factory.ModuleBuilderOpt.EnsureInlineArrayElementRefExists(syntax, intType, _diagnostics.DiagnosticBag).
698MethodSymbol inlineArrayAsSpan = asReadOnlySpan ?
774&& tryGetToArrayMethod(spreadTypeOriginalDefinition, WellKnownType.System_Collections_Generic_List_T, WellKnownMember.System_Collections_Generic_List_T__ToArray, out MethodSymbol? listToArrayMethod))
785var linqToArrayMethod = linqToArrayMethodGeneric.Construct([arrayType.ElementTypeWithAnnotations]);
794&& TryGetSpanConversion(spreadExpression.Type, writableOnly: false, out var asSpanMethod))
797if (tryGetToArrayMethod(spanType, WellKnownType.System_ReadOnlySpan_T, WellKnownMember.System_ReadOnlySpan_T__ToArray, out var toArrayMethod)
805bool tryGetToArrayMethod(TypeSymbol spreadTypeOriginalDefinition, WellKnownType wellKnownType, WellKnownMember wellKnownMember, [NotNullWhen(true)] out MethodSymbol? toArrayMethod)
988private bool TryGetSpanConversion(TypeSymbol type, bool writableOnly, out MethodSymbol? asSpanMethod)
1038if (!TryGetSpanConversion(type, writableOnly, out var asSpanMethod))
1048private BoundExpression CallAsSpanMethod(BoundExpression spreadExpression, MethodSymbol? asSpanMethod)
1054if (asSpanMethod is MethodSymbol { MethodKind: MethodKind.Constructor } constructor)
1058else if (asSpanMethod is MethodSymbol { IsStatic: true, ParameterCount: 1 })
1072private (MethodSymbol spanSliceMethod, BoundExpression spreadElementAsSpan, MethodSymbol getLengthMethod, MethodSymbol copyToMethod)? PrepareCopyToOptimization(
1097(MethodSymbol getLengthMethod, MethodSymbol copyToMethod)? getSpanMethodsForSpread(
1119MethodSymbol spanSliceMethod,
1121MethodSymbol getLengthMethod,
1122MethodSymbol copyToMethod)
1176MethodSymbol? setCount = null;
1177MethodSymbol? asSpan = null;
1182setCount = ((MethodSymbol?)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_CollectionsMarshal__SetCount_T))?.Construct(typeArguments);
1183asSpan = ((MethodSymbol?)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_CollectionsMarshal__AsSpan_T))?.Construct(typeArguments);
1199var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ctorInt32)).AsMember(collectionType);
1223var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ctor)).AsMember(collectionType);
1250var spanGetItem = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Span_T__get_Item)).AsMember((NamedTypeSymbol)spanTemp.Type);
1329var addMethod = _factory.WellKnownMethod(WellKnownMember.System_Collections_Generic_List_T__Add).AsMember(collectionType);
1330var addRangeMethod = _factory.WellKnownMethod(WellKnownMember.System_Collections_Generic_List_T__AddRange, isOptional: true)?.AsMember(collectionType);
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (24)
109if (!TryGetWellKnownTypeMember<MethodSymbol>(node.Syntax, WellKnownMember.System_ReadOnlySpan_T__ctor_Array_Start_Length, out MethodSymbol? ctor))
553MethodSymbol? symbolOpt = oldNodeOpt.SymbolOpt;
566var method = oldNodeOpt.SymbolOpt;
599MethodSymbol createSpan;
633MethodSymbol method = methodDefinition.AsMember(destinationType);
662MethodSymbol implicitOperator = implicitOperatorDefinition.AsMember((NamedTypeSymbol)sourceType);
675MethodSymbol castUpMethod = castUpMethodDefinition.AsMember(destinationType).Construct([sourceElementType]);
696MethodSymbol method = methodDefinition.AsMember(destinationType).Construct([sourceElementType]);
754delegateType.DelegateInvokeMethod() is MethodSymbol delegateInvoke &&
1078MethodSymbol ctor = UnsafeGetNullableMethod(syntax, rewrittenType, SpecialMember.System_Nullable_T__ctor);
1094MethodSymbol get_Value = UnsafeGetNullableMethod(syntax, rewrittenOperandType, SpecialMember.System_Nullable_T_get_Value);
1138if (!TryGetSpecialTypeMethod(syntax, DecimalConversionMethod(typeFromUnderlying, typeToUnderlying), out MethodSymbol method))
1182MethodSymbol getValueOrDefault;
1401MethodSymbol ctor = UnsafeGetNullableMethod(call.Syntax, resultType, SpecialMember.System_Nullable_T__ctor);
1454MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, boundTemp.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1516MethodSymbol method;
1749if (!TryGetSpecialTypeMethod(syntax, member, out MethodSymbol method))
1782var meth = conversion.Method;
1814MethodSymbol method;
1828MethodSymbol method;
1845MethodSymbol method;
1858MethodSymbol method;
1886private Conversion TryMakeUserDefinedConversion(SyntaxNode syntax, MethodSymbol meth, TypeSymbol fromType, TypeSymbol toType, bool @checked, bool isImplicit)
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (24)
61else if (node.EnumeratorInfoOpt?.MoveNextAwaitableInfo is null && CanRewriteForEachAsFor(node.Syntax, nodeExpressionType, out var indexerGet, out var lengthGetter))
71private bool CanRewriteForEachAsFor(SyntaxNode forEachSyntax, TypeSymbol nodeExpressionType, [NotNullWhen(true)] out MethodSymbol? indexerGet, [NotNullWhen(true)] out MethodSymbol? lengthGet)
76internal static bool CanRewriteForEachAsFor(CSharpCompilation compilation, SyntaxNode forEachSyntax, TypeSymbol nodeExpressionType, [NotNullWhen(true)] out MethodSymbol? indexerGet, [NotNullWhen(true)] out MethodSymbol? lengthGet, BindingDiagnosticBag diagnostics)
89lengthGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_Span_T__get_Length, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
90indexerGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_Span_T__get_Item, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
95lengthGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_ReadOnlySpan_T__get_Length, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
96indexerGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_ReadOnlySpan_T__get_Item, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
294private bool TryGetDisposeMethod(SyntaxNode forEachSyntax, ForEachEnumeratorInfo enumeratorInfo, out MethodSymbol disposeMethod)
299internal static bool TryGetDisposeMethod(CSharpCompilation compilation, SyntaxNode syntax, bool isAsync, BindingDiagnosticBag diagnostics, out MethodSymbol disposeMethod)
303disposeMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_IAsyncDisposable__DisposeAsync, diagnostics, syntax: syntax);
333MethodSymbol? disposeMethod = enumeratorInfo.PatternDisposeInfo?.Method; // pattern-based
505private BoundExpression ConvertReceiverForInvocation(CSharpSyntaxNode syntax, BoundExpression receiver, MethodSymbol method, Conversion receiverConversion, TypeSymbol convertedReceiverType)
708private BoundStatement RewriteForEachStatementAsFor(BoundForEachStatement node, MethodSymbol indexerGet, MethodSymbol lengthGet)
712getItem: static (LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, BoundLocal boundArrayVar, BoundLocal boundPositionVar, (MethodSymbol indexerGet, MethodSymbol lengthGet) arg) =>
721getLength: static (LocalRewriter rewriter, SyntaxNode syntax, BoundLocal boundArrayVar, (MethodSymbol indexerGet, MethodSymbol lengthGet) arg) =>
766MethodSymbol elementRef;
1064MethodSymbol getLowerBoundMethod = UnsafeGetSpecialTypeMethod(forEachSyntax, SpecialMember.System_Array__GetLowerBound);
1065MethodSymbol getUpperBoundMethod = UnsafeGetSpecialTypeMethod(forEachSyntax, SpecialMember.System_Array__GetUpperBound);
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (11)
158var getMethod = indexer.GetOwnOrInheritedGetMethod();
254var getItemOrSliceHelper = (MethodSymbol?)_compilation.GetWellKnownTypeMember(node.GetItemOrSliceHelper);
282MethodSymbol createSpan = getCreateSpanHelper(node, spanType: getItemOrSliceHelper.ContainingType, intType: (NamedTypeSymbol)getItemOrSliceHelper.Parameters[0].Type);
360MethodSymbol getCreateSpanHelper(BoundInlineArrayAccess node, NamedTypeSymbol spanType, NamedTypeSymbol intType)
364MethodSymbol createSpan;
377BoundExpression getElementRef(BoundInlineArrayAccess node, BoundExpression rewrittenReceiver, BoundExpression index, MethodSymbol getItemOrSliceHelper, int length)
389MethodSymbol elementRef;
408MethodSymbol elementRef;
431MethodSymbol createSpan = getCreateSpanHelper(node, spanType, intType);
769else if (unloweredExpr is BoundObjectCreationExpression { Constructor: MethodSymbol constructor, Arguments: { Length: 2 } arguments, ArgsToParamsOpt: { IsDefaultOrEmpty: true }, InitializerExpressionOpt: null } &&
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (4)
140TryGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeft.Type, SpecialMember.System_Nullable_T_GetValueOrDefault, out MethodSymbol? getValueOrDefault, isOptional: true))
147TryGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeft.Type, SpecialMember.System_Nullable_T_GetValueOrDefaultDefaultValue, out MethodSymbol? getValueOrDefaultDefaultValue, isOptional: true))
199var method = boundCall.Method;
257MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeftType, SpecialMember.System_Nullable_T_GetValueOrDefault);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (22)
156if (!TryGetSpecialTypeMethod(originalSyntax, concatMember, out var spanConcat, isOptional: true)
157|| !TryGetNeededToSpanMembers(this, originalSyntax, needsImplicitConversionFromStringToSpan, charType, out var readOnlySpanCtorRefParamChar, out var stringImplicitConversionToReadOnlySpan))
194var method = UnsafeGetSpecialTypeMethod(originalSyntax, concatMember);
407private MethodSymbol? _concatStringString = ErrorMethodSymbol.UnknownMethod;
408private MethodSymbol? _concatStringStringString = ErrorMethodSymbol.UnknownMethod;
409private MethodSymbol? _concatStringStringStringString = ErrorMethodSymbol.UnknownMethod;
410private MethodSymbol? _concatStringArray = ErrorMethodSymbol.UnknownMethod;
411private MethodSymbol? _objectToString = ErrorMethodSymbol.UnknownMethod;
455private readonly void InitializeField(ref MethodSymbol? member, SpecialMember specialMember)
459member = _compilation.GetSpecialTypeMember(specialMember) as MethodSymbol;
463private readonly bool IsConcatNonArray(BoundCall call, ref MethodSymbol? concatMethod, SpecialMember concatSpecialMember, out ImmutableArray<BoundExpression> arguments)
483[NotNullWhen(true)] out MethodSymbol? readOnlySpanCtorRefParamChar,
484out MethodSymbol? stringImplicitConversionToReadOnlySpan)
489if (self.TryGetSpecialTypeMethod(syntax, SpecialMember.System_ReadOnlySpan_T__ctor_Reference, out MethodSymbol? readOnlySpanCtorRefParamGeneric, isOptional: true) &&
511MethodSymbol spanConcat,
512MethodSymbol? stringImplicitConversionToReadOnlySpan,
513MethodSymbol readOnlySpanCtorRefParamChar,
607var method = UnsafeGetSpecialTypeMethod(current.Syntax, member);
662var objectToStringMethod = UnsafeGetSpecialTypeMethod(syntax, SpecialMember.System_Object__ToString);
666MethodSymbol? structToStringMethod = null;
673if (member is MethodSymbol toStringMethod &&
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (20)
66MethodSymbol? method,
78MethodSymbol? method,
167method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(SpecialMember.System_Decimal__op_UnaryNegation);
182MethodSymbol? method,
205MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, boundTemp.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
246MethodSymbol? method,
354private BoundExpression GetLiftedUnaryOperatorConsequence(UnaryOperatorKind kind, SyntaxNode syntax, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt, TypeSymbol type, BoundExpression nonNullOperand)
356MethodSymbol ctor = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T__ctor);
456private BoundExpression MakeInstanceCompoundAssignmentOperatorResult(SyntaxNode syntax, BoundExpression left, BoundExpression? rightOpt, MethodSymbol operatorMethod, bool isChecked, AssignmentKind assignmentKind)
523static BoundCall makeIncrementCall(SyntaxNode syntax, BoundLocal boundTemp, BoundExpression? rightOpt, MethodSymbol operatorMethod)
830MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T_GetValueOrDefault);
831MethodSymbol ctor = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T__ctor);
914MethodSymbol ctor = UnsafeGetNullableMethod(node.Syntax, binaryOperandType, SpecialMember.System_Nullable_T__ctor);
966private MethodSymbol GetDecimalIncDecOperator(BinaryOperatorKind oper)
977var method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member);
986MethodSymbol method = GetDecimalIncDecOperator(oper);
995MethodSymbol method = GetDecimalIncDecOperator(oper);
996MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
997MethodSymbol ctor = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T__ctor);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (4)
46private IteratorAndAsyncCaptureWalker(CSharpCompilation compilation, MethodSymbol method, BoundNode node, HashSet<Symbol> initiallyAssignedVariables, bool isRuntimeAsync)
58public static OrderedSet<Symbol> Analyze(CSharpCompilation compilation, MethodSymbol method, BoundNode node, bool isRuntimeAsync, DiagnosticBag diagnostics)
371private readonly MethodSymbol _topLevelMethod;
374public OutsideVariablesUsedInside(IteratorAndAsyncCaptureWalker analyzer, MethodSymbol topLevelMethod, IteratorAndAsyncCaptureWalker parent)
Lowering\SyntheticBoundNodeFactory.cs (47)
64private MethodSymbol? _currentFunction;
65public MethodSymbol? CurrentFunction
83private MethodSymbol? _topLevelMethod;
84public MethodSymbol? TopLevelMethod
103public SyntheticBoundNodeFactory(MethodSymbol topLevelMethod, SyntaxNode node, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, InstrumentationState? instrumentationState = null)
114public SyntheticBoundNodeFactory(MethodSymbol? topLevelMethodOpt, NamedTypeSymbol? currentClassOpt, SyntaxNode node, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, InstrumentationState? instrumentationState = null)
283var accessor = property.GetOwnOrInheritedGetMethod();
291var accessor = property.GetOwnOrInheritedGetMethod();
341public MethodSymbol? WellKnownMethod(WellKnownMember wm, bool isOptional)
343return (MethodSymbol?)WellKnownMember(wm, isOptional);
346public MethodSymbol WellKnownMethod(WellKnownMember wm)
348return (MethodSymbol)WellKnownMember(wm, isOptional: false)!;
399public MethodSymbol SpecialMethod(SpecialMember sm)
401var result = (MethodSymbol?)SpecialMember(sm, isOptional: false);
406public MethodSymbol? SpecialMethod(SpecialMember sm, bool isOptional)
408return (MethodSymbol?)SpecialMember(sm, isOptional);
483return Block(locals, ImmutableArray<MethodSymbol>.CastUp(localFunctions), statements);
486public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
638public ParameterSymbol SynthesizedParameter(TypeSymbol type, string name, MethodSymbol? container = null, int ordinal = 0)
762var ctor = type.InstanceConstructors.Single(c => c.ParameterCount == args.Length);
766public BoundObjectCreationExpression New(MethodSymbol ctor, params BoundExpression[] args)
771var ctor = type.InstanceConstructors.Single(c => c.ParameterCount == args.Length);
775public BoundObjectCreationExpression New(MethodSymbol ctor, ImmutableArray<BoundExpression> args)
778public BoundObjectCreationExpression New(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKinds)
795var ctor = WellKnownMethod(wm);
814public BoundExpression StaticCall(TypeSymbol receiver, MethodSymbol method, params BoundExpression[] args)
824public BoundExpression StaticCall(MethodSymbol method, ImmutableArray<BoundExpression> args)
829MethodSymbol methodSymbol = WellKnownMethod(method);
837MethodSymbol methodSymbol = WellKnownMethod(method);
848MethodSymbol methodSymbol = SpecialMethod(method);
853public BoundCall Call(BoundExpression? receiver, MethodSymbol method)
858public BoundCall Call(BoundExpression? receiver, MethodSymbol method, BoundExpression arg0, bool useStrictArgumentRefKinds = false)
863public BoundCall Call(BoundExpression? receiver, MethodSymbol method, BoundExpression arg0, BoundExpression arg1, bool useStrictArgumentRefKinds = false)
868public BoundCall Call(BoundExpression? receiver, MethodSymbol method, params BoundExpression[] args)
876public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<BoundExpression> args, bool useStrictArgumentRefKinds = false)
888public static ImmutableArray<RefKind> ArgumentRefKindsFromParameterRefKinds(MethodSymbol method, bool useStrictArgumentRefKinds)
918public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<RefKind> refKinds, ImmutableArray<BoundExpression> args)
1222var ctor = baseType.InstanceConstructors.Single(c => c.ParameterCount == 0);
1287MethodSymbol getTypeFromHandle;
1329internal BoundExpression ConstructorInfo(MethodSymbol ctor)
1347public BoundExpression MethodDefIndex(MethodSymbol method)
1429public BoundExpression MethodInfo(MethodSymbol method, TypeSymbol systemReflectionMethodInfo)
1464private MethodSymbol GetMethodFromHandleMethod(NamedTypeSymbol methodContainer, TypeSymbol systemReflectionMethodOrConstructorInfo)
1488private MethodSymbol GetFieldFromHandleMethod(NamedTypeSymbol fieldContainer)
1549MethodSymbol? arrayEmpty = SpecialMethod(CodeAnalysis.SpecialMember.System_Array__Empty, isOptional: true);
1658MethodSymbol? containingMethod = this.CurrentFunction;
Symbols\Compilation_WellKnownMembers.cs (13)
79/// <see cref="MethodSymbol.AsMember"/> to construct an instantiation.
251internal static Symbol? GetRuntimeMember(NamedTypeSymbol declaringType, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
257internal static Symbol? GetRuntimeMember(ImmutableArray<Symbol> members, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
311MethodSymbol method = (MethodSymbol)member;
400var ctorSymbol = (MethodSymbol?)Binder.GetWellKnownTypeMember(this, constructor, useSiteInfo: out _, isOptional: true);
447var ctorSymbol = (MethodSymbol)this.GetSpecialTypeMember(constructor);
1091internal class SpecialMembersSignatureComparer : SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol>
1161protected override ImmutableArray<ParameterSymbol> GetParameters(MethodSymbol method)
1181protected override TypeSymbol GetReturnType(MethodSymbol method)
1205protected override bool IsByRefMethod(MethodSymbol method)
Symbols\NamedTypeSymbol.cs (27)
175public MethodSymbol? DelegateInvokeMethod
190var method = methods[0] as MethodSymbol;
209internal void AddOperators(string name, ArrayBuilder<MethodSymbol> operators)
218internal static void AddOperators(ArrayBuilder<MethodSymbol> operators, ImmutableArray<Symbol> candidates)
222if (candidate is MethodSymbol { MethodKind: MethodKind.UserDefinedOperator or MethodKind.Conversion } method)
229internal static void AddOperators(ArrayBuilder<MethodSymbol> operators, ArrayBuilder<Symbol> candidates)
233if (candidate is MethodSymbol { MethodKind: MethodKind.UserDefinedOperator or MethodKind.Conversion } method)
243public ImmutableArray<MethodSymbol> InstanceConstructors
254public ImmutableArray<MethodSymbol> StaticConstructors
265public ImmutableArray<MethodSymbol> Constructors
273private ImmutableArray<MethodSymbol> GetConstructors(bool includeInstance, bool includeStatic)
286return ImmutableArray<MethodSymbol>.Empty;
289ArrayBuilder<MethodSymbol> constructors = ArrayBuilder<MethodSymbol>.GetInstance();
292if (candidate is MethodSymbol method)
300if (candidate is MethodSymbol method)
352private void DoGetExtensionMethods(ArrayBuilder<Symbol> methods, string? nameOpt, int arity, LookupOptions options, PooledHashSet<MethodSymbol>? implementationsToShadow)
362var method = (MethodSymbol)member;
418PooledHashSet<MethodSymbol>? implementationsToShadow = null;
438void doGetExtensionMembers(ArrayBuilder<Symbol> members, string? name, string? alternativeName, int arity, LookupOptions options, ref PooledHashSet<MethodSymbol>? implementationsToShadow, ConsList<FieldSymbol> fieldsBeingBound)
464if (candidate is MethodSymbol { IsStatic: false } shadows &&
467implementationsToShadow ??= PooledHashSet<MethodSymbol>.GetInstance();
487if ((options & LookupOptions.MustBeOperator) != 0 && member is not MethodSymbol { MethodKind: MethodKind.UserDefinedOperator })
518public virtual MethodSymbol? TryGetCorrespondingExtensionImplementationMethod(MethodSymbol method)
Symbols\Retargeting\RetargetingSymbolTranslator.cs (25)
45return new RetargetingMethodSymbol(this, (MethodSymbol)symbol);
874public MethodSymbol Retarget(MethodSymbol method)
879return (MethodSymbol)this.SymbolMap.GetOrAdd(method, _retargetingModule._createRetargetingMethod);
882public MethodSymbol Retarget(MethodSymbol method, IEqualityComparer<MethodSymbol> retargetedMethodComparer)
903var retargetedDefinition = Retarget(method.OriginalDefinition, retargetedMethodComparer);
964private MethodSymbol FindMethodInRetargetedType(MethodSymbol method, NamedTypeSymbol retargetedType, IEqualityComparer<MethodSymbol> retargetedMethodComparer)
972private readonly MethodSymbol _toFind;
974private RetargetedTypeMethodFinder(RetargetingModuleSymbol retargetingModule, NamedTypeSymbol retargetedType, MethodSymbol toFind) :
981public static MethodSymbol Find(RetargetingSymbolTranslator translator, MethodSymbol method, NamedTypeSymbol retargetedType, IEqualityComparer<MethodSymbol> retargetedMethodComparer)
994private static MethodSymbol FindWorker
997MethodSymbol method,
999IEqualityComparer<MethodSymbol> retargetedMethodComparer
1027ImmutableArray<MethodSymbol>.Empty);
1033var retargetedMethod = (MethodSymbol)retargetedMember;
1158MethodSymbol oldAttributeCtor = oldAttributeData.AttributeConstructor;
1159MethodSymbol newAttributeCtor = (object)oldAttributeCtor == null ?
1349public override Symbol VisitMethod(MethodSymbol symbol, RetargetOptions options)
Symbols\Source\SourceComplexParameterSymbol.cs (8)
1273else if (this.ContainingSymbol is MethodSymbol method &&
1394|| ContainingSymbol is MethodSymbol { MethodKind: MethodKind.Constructor or MethodKind.DelegateInvoke or MethodKind.LambdaMethod }
1641withElement: null, syntax, Type, out MethodSymbol? constructor, isExpanded: out _, diagnostics, isParamsModifierValidation: true))
1651if (!binder.HasCollectionExpressionApplicableAddMethod(syntax, Type, out ImmutableArray<MethodSymbol> addMethods, diagnostics))
1664MethodSymbol? reportAsLessVisible = null;
1666foreach (var addMethod in addMethods)
1727bool isAtLeastAsVisible(ParameterSyntax syntax, Binder binder, MethodSymbol method, BindingDiagnosticBag diagnostics)
1738void checkIsAtLeastAsVisible(ParameterSyntax syntax, Binder binder, MethodSymbol method, BindingDiagnosticBag diagnostics)
Symbols\Source\SourceMemberContainerSymbol.cs (89)
1643WhereAsArray(s => !s.IsIndexer() && (!s.IsAccessor() || ((MethodSymbol)s).AssociatedSymbol?.IsIndexer() != true)));
2018var methodsBySignature = new Dictionary<MethodSymbol, MethodSymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2019var conversionsAsMethods = new Dictionary<MethodSymbol, MethodSymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2020var conversionsAsConversions = new HashSet<MethodSymbol>(ConversionSignatureComparer.Comparer);
2134if (symbol is MethodSymbol { MethodKind: MethodKind.Conversion } conversion)
2157if (methodsBySignature.TryGetValue(conversion, out var previousMethod))
2164else if (symbol is MethodSymbol method)
2169if (conversionsAsMethods.TryGetValue(method, out var previousConversion))
2178if (methodsBySignature.TryGetValue(method, out var previousMethod))
2195private static void ReportMethodSignatureCollision(SourceMemberContainerTypeSymbol containerForDiagnostics, BindingDiagnosticBag diagnostics, MethodSymbol method1, MethodSymbol method2)
2706if (member.Kind != SymbolKind.Method || ((MethodSymbol)member).MethodKind != MethodKind.Destructor)
2761var ops1 = ArrayBuilder<MethodSymbol>.GetInstance();
2766var ops2 = ArrayBuilder<MethodSymbol>.GetInstance();
2774var ops2 = ArrayBuilder<MethodSymbol>.GetInstance();
2784static void reportOperatorNeedsMatch(BindingDiagnosticBag diagnostics, string operatorName2, MethodSymbol op1)
2791static void reportCheckedOperatorNeedsMatch(BindingDiagnosticBag diagnostics, string operatorName2, MethodSymbol op1)
2798string operatorName1, ArrayBuilder<MethodSymbol> ops1)
2809ArrayBuilder<MethodSymbol> ops1,
2810ArrayBuilder<MethodSymbol> ops2,
2812Action<BindingDiagnosticBag, string, MethodSymbol> reportMatchNotFoundError)
2814foreach (var op1 in ops1)
2822foreach (var op2 in ops2)
2838internal static bool DoOperatorsPair(MethodSymbol op1, MethodSymbol op2)
2878var ops = ArrayBuilder<MethodSymbol>.GetInstance();
2933if (member is not MethodSymbol method || !method.ShouldCheckRequiredMembers())
2960foreach (var method in this.GetMembers(name).OfType<MethodSymbol>())
3728!(member is MethodSymbol method && MethodCompiler.GetMethodToCompile(method) is SourceMemberMethodSymbol sourceMethod))
3858if (member is MethodSymbol { IsImplicitlyDeclared: false, MethodKind: not (MethodKind.Constructor or MethodKind.StaticConstructor or MethodKind.Destructor or MethodKind.ExplicitInterfaceImplementation) } method &&
4119(prevMethod.IsPartialImplementation || (prevMethod.OtherPartOfPartial is MethodSymbol otherImplementation && (object)otherImplementation != currentMethod)))
4125(prevMethod.IsPartialDefinition || (prevMethod.OtherPartOfPartial is MethodSymbol otherDefinition && (object)otherDefinition != currentMethod)))
4363MethodSymbol accessor = getNotSet ? propertySymbol.GetMethod : propertySymbol.SetMethod;
4388var methodSymbol = (MethodSymbol)symbol;
4427var methodSymbol = (MethodSymbol)symbol;
4580var meth = (MethodSymbol)member;
4642var meth = (MethodSymbol)member;
4689var m = s as MethodSymbol;
4734if (hasInitializers && !builder.NonTypeMembersWithPartialImplementations.Any(member => member is MethodSymbol { MethodKind: MethodKind.Constructor }))
4786case MethodSymbol { MethodKind: not (MethodKind.Ordinary or MethodKind.Constructor) }:
4842var thisEquals = addThisEquals(equalityContract);
4850var getHashCode = addGetHashCode(equalityContract);
4858var printMembers = addPrintMembersMethod(membersSoFar);
4896ImmutableArray<MethodSymbol>.Empty);
4904var deconstruct = (MethodSymbol)existingDeconstructMethod;
4944ImmutableArray<MethodSymbol>.Empty);
4958var constructor = (MethodSymbol)existingConstructor;
4977MethodSymbol addPrintMembersMethod(IEnumerable<Symbol> userDefinedMembers)
4996explicitInterfaceImplementations: ImmutableArray<MethodSymbol>.Empty);
4998MethodSymbol printMembersMethod;
5006printMembersMethod = (MethodSymbol)existingPrintMembersMethod;
5037void addToStringMethod(MethodSymbol printMethod)
5051explicitInterfaceImplementations: ImmutableArray<MethodSymbol>.Empty);
5053var baseToStringMethod = getBaseToStringMethod();
5080var toStringMethod = (MethodSymbol)existingToStringMethod;
5091MethodSymbol? getBaseToStringMethod()
5099if (member is not MethodSymbol method)
5206void addObjectEquals(MethodSymbol thisEquals)
5211MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5225ImmutableArray<MethodSymbol>.Empty);
5227MethodSymbol getHashCode;
5236getHashCode = (MethodSymbol)existingHashCodeMethod;
5304MethodSymbol addThisEquals(PropertySymbol? equalityContract)
5324ImmutableArray<MethodSymbol>.Empty);
5326MethodSymbol thisEquals;
5335thisEquals = (MethodSymbol)existingEqualsMethod;
5398var method = (MethodSymbol)member;
5854private void AddAccessorIfAvailable(ArrayBuilder<Symbol> symbols, MethodSymbol? accessorOpt)
6019if (member is MethodSymbol { MethodKind: MethodKind.Ordinary })
6047ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)>.Empty);
6050public readonly ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> MethodImpls;
6054ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> methodImpls)
6062ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> methodImpls)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (62)
18internal delegate void ReportMismatchInReturnType<TArg>(BindingDiagnosticBag bag, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, bool topLevel, TArg arg);
19internal delegate void ReportMismatchInParameterType<TArg>(BindingDiagnosticBag bag, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, ParameterSymbol parameter, bool topLevel, TArg arg);
73internal sealed override IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls()
115var methodImpls = ArrayBuilder<(MethodSymbol Body, MethodSymbol Implemented)>.GetInstance();
237var associatedPropertyOrEvent = interfaceMemberKind == SymbolKind.Method ? ((MethodSymbol)interfaceMember).AssociatedSymbol : null;
551var method = (MethodSymbol)member;
552if (MethodSymbol.CanOverrideOrHide(method.MethodKind) && !method.IsAccessor())
573MethodSymbol overridden = method.GetFirstRuntimeOverriddenMethodIgnoringNewSlot(out _);
587var getMethod = property.GetMethod;
588var setMethod = property.SetMethod;
628var addMethod = @event.AddMethod;
629var removeMethod = @event.RemoveMethod;
719if (hiddenMember.Kind == SymbolKind.Method && !((MethodSymbol)hiddenMember).CanBeHiddenByMember(symbol))
797associatedPropertyOrEvent = ((MethodSymbol)overridingMember).AssociatedSymbol;
806? ((MethodSymbol)overridingMember).ParameterTypesWithAnnotations
870if (!this.ContainingAssembly.RuntimeSupportsCovariantReturnsOfClasses && overridingMember is MethodSymbol overridingMethod)
875var ambiguousMethod = overridingMethod.OverriddenMethod;
907!(overridingMemberIsMethod && ((MethodSymbol)overriddenMember).MethodKind == MethodKind.Destructor)) //destructors are metadata virtual
936else if (overriddenMember is MethodSymbol overridden && overridden.IsOperator() != ((MethodSymbol)overridingMember).IsOperator())
1006var overridingMethod = (MethodSymbol)overridingMember;
1007var overriddenMethod = (MethodSymbol)overriddenMember;
1125MethodSymbol overriddenGetMethod = overriddenProperty.GetOwnOrInheritedGetMethod();
1135var ownOrInheritedOverriddenSetMethod = overriddenProperty.GetOwnOrInheritedSetMethod();
1156MethodSymbol ownOrInheritedGetMethod = overridingProperty.GetOwnOrInheritedGetMethod();
1163MethodSymbol ownOrInheritedSetMethod = overridingProperty.GetOwnOrInheritedSetMethod();
1176MethodSymbol overriddenMethod,
1177MethodSymbol overridingMethod,
1253(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, bool topLevel, Location location)
1260(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, ParameterSymbol overridingParameter, bool topLevel, Location location)
1271MethodSymbol baseMethod,
1272MethodSymbol overrideMethod,
1412internal static bool RequiresValidScopedOverrideForRefSafety(MethodSymbol? method, ParameterSymbol? overrideThisParameter)
1471internal static bool ReportInvalidScopedOverrideAsError(MethodSymbol baseMethod, MethodSymbol overrideMethod)
1482MethodSymbol? baseMethod,
1483MethodSymbol? overrideMethod,
1535MethodSymbol? baseMethod,
1536MethodSymbol? overrideMethod,
1686if (hidingMember is MethodSymbol hidingMethod && hiddenMembers[0] is MethodSymbol hiddenMethod)
1746var associatedPropertyOrEvent = ((MethodSymbol)hidingMember).AssociatedSymbol;
1864private (SynthesizedExplicitImplementationForwardingMethod? ForwardingMethod, (MethodSymbol Body, MethodSymbol Implemented)? MethodImpl)
1883MethodSymbol interfaceMethod = (MethodSymbol)interfaceMember;
1884MethodSymbol implementingMethod = (MethodSymbol)implementingMember;
1894MethodSymbol implementingMethodOriginalDefinition = implementingMethod.OriginalDefinition;
1913else if (implementingMethod.IsMetadataVirtual(MethodSymbol.IsMetadataVirtualOption.IgnoreInterfaceImplementationChanges))
1966private static bool IsPossibleImplementationUnderRuntimeRules(MethodSymbol implementingMethod, NamedTypeSymbol @interface)
1990private static bool IsOverrideOfPossibleImplementationUnderRuntimeRules(MethodSymbol implementingMethod, NamedTypeSymbol @interface)
1992MethodSymbol curr = implementingMethod;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (62)
322(MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerable__GetEnumerator),
342(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__CopyTo)!,
347(PropertySymbol)((MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__get_Item)!).AssociatedSymbol,
363(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Add)!,
368(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Clear)!,
373(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Contains)!,
378(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IndexOf)!,
383(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Insert)!,
388(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Remove)!,
393(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__RemoveAt)!,
398((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerable_T__GetEnumerator)!).AsMember(iEnumerableT),
410((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyList_T__get_Item)!).AssociatedSymbol).AsMember(iReadOnlyListT),
426((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Add)!).AsMember(iCollectionT),
431((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Clear)!).AsMember(iCollectionT),
436((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Contains)!).AsMember(iCollectionT),
441((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__CopyTo)!).AsMember(iCollectionT),
446((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Remove)!).AsMember(iCollectionT),
451((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__get_Item)!).AssociatedSymbol).AsMember(iListT),
457((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__IndexOf)!).AsMember(iListT),
462((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__Insert)!).AsMember(iListT),
467((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__RemoveAt)!).AsMember(iListT),
472static BoundStatement generateGetEnumerator(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
504static BoundStatement generateCount(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
532static BoundStatement generateIsSynchronized(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
539static BoundStatement generateSyncRoot(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
557static BoundStatement generateIsFixedSize(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
564static BoundStatement generateIsReadOnly(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
571static BoundStatement generateContains(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
604var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__Contains);
614static BoundStatement generateCopyTo(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
626var arraySetValueMethod = (MethodSymbol)method.DeclaringCompilation.GetSpecialTypeMember(SpecialMember.System_Array__SetValue)!;
671var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__CopyTo);
683static BoundStatement generateIndexer(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
694var constructor = (MethodSymbol)method.DeclaringCompilation.GetWellKnownTypeMember(WellKnownMember.System_IndexOutOfRangeException__ctor)!;
710var listMember = (PropertySymbol)((MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__get_Item)).AssociatedSymbol;
717static BoundStatement generateIndexOf(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
754var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__IndexOf);
763static BoundStatement generateNotSupportedException(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
765var constructor = (MethodSymbol)method.DeclaringCompilation.GetWellKnownTypeMember(WellKnownMember.System_NotSupportedException__ctor)!;
785var equalityComparer_get_Default = f.WellKnownMethod(
787var equalityComparer_Equals = f.WellKnownMethod(
1002internal override IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls() => SpecializedCollections.EmptyEnumerable<(MethodSymbol Body, MethodSymbol Implemented)>();
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (6)
220public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations
222get { return ImmutableArray<MethodSymbol>.Empty; }
293private static BoundCall CreateParameterlessCall(CSharpSyntaxNode syntax, BoundExpression receiver, ThreeState receiverIsSubjectToCloning, MethodSymbol method)
346internal readonly MethodSymbol UserMain;
348internal AsyncForwardEntryPoint(CSharpCompilation compilation, NamedTypeSymbol containingType, MethodSymbol userMain) :
385if (Binder.TryGetSpecialTypeMember(compilation, specialMember, _userMainReturnTypeSyntax, BindingDiagnosticBag.Discarded, out MethodSymbol handleAsyncEntryPointMethod, isOptional: true)
Symbols\TypeSymbol.cs (64)
85internal ImmutableDictionary<MethodSymbol, MethodSymbol>? synthesizedMethodImplMap;
867if (checkPendingExplicitImplementations && interfaceMember is MethodSymbol interfaceMethod &&
871MethodSymbol bodyOfSynthesizedMethodImpl = currType.GetBodyOfSynthesizedInterfaceMethodImpl(interfaceMethod);
945if (implementingTypeIsFromSomeCompilation && implicitImpl is MethodSymbol implicitImplMethod && implicitImplMethod.IsOperator() != ((MethodSymbol)interfaceMember).IsOperator())
957CheckForImplementationOfCorrespondingPropertyOrEvent((MethodSymbol)interfaceMember, implementingType, implementingTypeIsFromSomeCompilation, ref implicitImpl);
1064(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1089static bool stopLookup(MethodSymbol interfaceAccessor, TypeSymbol implementingType)
1116(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1172(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1404private static (MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) GetImplementableAccessors(Symbol interfaceMember)
1406MethodSymbol interfaceAccessor1;
1407MethodSymbol interfaceAccessor2;
1467(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1502private static bool TryGetExplicitImplementationAssociatedPropertyOrEvent(bool checkPendingExplicitImplementations, MethodSymbol interfaceAccessor, TypeSymbol currType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out Symbol associated)
1513? ((MethodSymbol)implementation).AssociatedSymbol
1522MethodSymbol bodyOfSynthesizedMethodImpl = currType.GetBodyOfSynthesizedInterfaceMethodImpl(interfaceAccessor);
1546private static void CheckForImplementationOfCorrespondingPropertyOrEvent(MethodSymbol interfaceMethod, TypeSymbol implementingType, bool implementingTypeIsFromSomeCompilation,
1566MethodSymbol correspondingImplementingAccessor = null;
1607MethodSymbol interfaceAccessorWithImplementationName = new SignatureOnlyMethodSymbol(
1683var interfaceMethod = (MethodSymbol)interfaceMember;
1697var implicitImplMethod = (MethodSymbol)implicitImpl;
1812MethodSymbol implementedMethod,
1813MethodSymbol implementingMethod,
1939var implementingGetMethod = implementedProperty.GetMethod.IsImplementable() ?
1942var implementingSetMethod = implementedProperty.SetMethod.IsImplementable() ?
1966var implementingMethod = (MethodSymbol)implementingMember;
1967var implementedMethod = (MethodSymbol)interfaceMember;
2032var method = (MethodSymbol)interfaceMember;
2052hasRefReturnMismatch = ((MethodSymbol)closestMismatch).RefKind != interfaceMemberRefKind;
2071else if (interfaceMember is MethodSymbol interfaceMethod &&
2072interfaceMethod.IsOperator() != ((MethodSymbol)closestMismatch).IsOperator())
2085if (!(one is MethodSymbol oneMethod))
2090if (!(other is MethodSymbol otherMethod))
2115private static bool ReportAnyMismatchedConstraints(MethodSymbol interfaceMethod, TypeSymbol implementingType, MethodSymbol implicitImpl, BindingDiagnosticBag diagnostics)
2202if (interfaceMember is MethodSymbol { IsStatic: true } interfaceMethod)
2212(((MethodSymbol)member).MethodKind is MethodKind.UserDefinedOperator or MethodKind.Conversion) != isOperator.GetValueOrDefault())
2316Debug.Assert(interfaceMember.Kind != SymbolKind.Method || (object)interfaceMember == ((MethodSymbol)interfaceMember).ConstructedFrom);
2327/// <see cref="MethodSymbol.ExplicitInterfaceImplementations"/> API, this method returns the "Body" part
2335protected MethodSymbol? GetBodyOfSynthesizedInterfaceMethodImpl(MethodSymbol interfaceMethod)
2348if (info.synthesizedMethodImplMap.TryGetValue(interfaceMethod, out MethodSymbol? result))
2355ImmutableDictionary<MethodSymbol, MethodSymbol> makeSynthesizedMethodImplMap()
2357var map = ImmutableDictionary.CreateBuilder<MethodSymbol, MethodSymbol>(ExplicitInterfaceImplementationTargetMemberEqualityComparer.Instance);
2358foreach ((MethodSymbol body, MethodSymbol implemented) in this.SynthesizedInterfaceMethodImpls())
2370/// <see cref="MethodSymbol.ExplicitInterfaceImplementations"/> API. The "Body" is the method that
2377internal abstract IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls();
2433overriddenMember = ((MethodSymbol)member).OverriddenMethod;