Binder\Binder_Conversions.cs (47)
413if (conversion.Method is MethodSymbol method && method.IsStatic)
529MethodSymbol? castUpMethod = TryFindCastUpMethod(sourceForCastUp, destination.OriginalDefinition);
556static void reportUseSiteOrMissing(MethodSymbol? method, object containingType, string methodName, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
574internal static MethodSymbol? TryFindImplicitOperatorFromArray(TypeSymbol type)
584internal static MethodSymbol? TryFindImplicitOperatorFromSpan(TypeSymbol spanType, TypeSymbol readonlySpanType)
594private static MethodSymbol? TryFindImplicitOperator<TArg>(TypeSymbol type, TArg arg,
595Func<TArg, MethodSymbol, bool> predicate)
624internal static MethodSymbol? TryFindCastUpMethod(TypeSymbol source, TypeSymbol destination)
652internal static MethodSymbol? TryFindAsSpanCharMethod(CSharpCompilation compilation, TypeSymbol readOnlySpanType)
658MethodSymbol? result = null;
686private static MethodSymbol? TryFindSingleMethod<TArg>(TypeSymbol type, string name, TArg arg, Func<TArg, MethodSymbol, bool> predicate)
689MethodSymbol? result = null;
692if (member is MethodSymbol method && predicate(arg, method))
820var collectionTypeKind = conversion.GetCollectionExpressionTypeKind(out var elementType, out MethodSymbol? constructor, out bool isExpanded);
837MethodSymbol? collectionBuilderMethod = null;
886HasParamsCollectionTypeInProgress(namedType, out NamedTypeSymbol? inProgress, out MethodSymbol? inProgressConstructor))
1032internal MethodSymbol? GetAndValidateCollectionBuilderMethod(
1038MethodSymbol? collectionBuilderMethod;
1076internal BoundExpression BindCollectionExpressionConstructor(SyntaxNode syntax, TypeSymbol targetType, MethodSymbol? constructor, BindingDiagnosticBag diagnostics)
1106internal bool HasCollectionExpressionApplicableConstructor(SyntaxNode syntax, TypeSymbol targetType, out MethodSymbol? constructor, out bool isExpanded, BindingDiagnosticBag diagnostics, bool isParamsModifierValidation = false)
1142out MemberResolutionResult<MethodSymbol> memberResolutionResult,
1176MemberResolutionResult<MethodSymbol> memberResolutionResult,
1217out MethodSymbol? constructor)
1238internal bool HasCollectionExpressionApplicableAddMethod(SyntaxNode syntax, TypeSymbol targetType, out ImmutableArray<MethodSymbol> addMethods, BindingDiagnosticBag diagnostics)
1280out ImmutableArray<MethodSymbol> addMethods)
1298out ImmutableArray<MethodSymbol> addMethods)
1339out ImmutableArray<MethodSymbol> addMethods)
1354out ImmutableArray<MethodSymbol> addMethods)
1432resolution.MethodGroup, diagnostics: diagnostics, out var addMethod);
1447static ImmutableArray<MethodSymbol> filterOutBadGenericMethods(
1449ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1452var resultBuilder = ArrayBuilder<MethodSymbol>.GetInstance(finalApplicableCandidates.Length);
1469MethodSymbol? constructed = null;
1555OverloadResolutionResult<MethodSymbol> result,
1559out MethodSymbol? addMethod)
1832private MethodSymbol? GetCollectionBuilderMethod(
1856if (candidate is not MethodSymbol { IsStatic: true } method)
1882MethodSymbol methodWithTargetTypeParameters; // builder method substituted with type parameters from target type
2261private static void CheckParameterModifierMismatchMethodConversion(SyntaxNode syntax, MethodSymbol lambdaOrMethod, TypeSymbol targetType, bool invokedAsExtensionMethod, BindingDiagnosticBag diagnostics)
2263MethodSymbol? delegateMethod;
2578private bool MemberGroupFinalValidation(BoundExpression? receiverOpt, MethodSymbol methodSymbol, SyntaxNode node, BindingDiagnosticBag diagnostics, bool invokedAsExtensionMethod)
2657Debug.Assert(memberSymbol is not MethodSymbol { MethodKind: not MethodKind.Constructor } ||
2662if (receiverOpt != null || memberSymbol is not MethodSymbol { MethodKind: MethodKind.Constructor })
2809internal bool MethodIsCompatibleWithDelegateOrFunctionPointer(BoundExpression? receiverOpt, bool isExtensionMethod, MethodSymbol method, TypeSymbol delegateType, Location errorLocation, BindingDiagnosticBag diagnostics)
2815MethodSymbol delegateOrFuncPtrMethod = delegateType switch
2999MethodSymbol selectedMethod = conversion.Method;
Binder\Binder_Expressions.cs (95)
1312MethodSymbol method = this.ContainingMember() as MethodSymbol;
1453case MethodSymbol { AssociatedSymbol: SourcePropertySymbol property }:
1460if (contextualAttributeBinder is { AttributeTarget: MethodSymbol { AssociatedSymbol: SourcePropertySymbol property } })
1937var containingMethod = this.ContainingMemberOrLambda as MethodSymbol;
2082(this.ContainingMember() is MethodSymbol { MethodKind: MethodKind.Constructor } containingMember && (object)containingMember != primaryCtor)) && // We are in a non-primary instance constructor
2116bool capture = (this.ContainingMember() is MethodSymbol containingMethod && (object)primaryCtor != containingMethod);
2137this.ContainingMemberOrLambda is MethodSymbol { MethodKind: MethodKind.AnonymousFunction or MethodKind.LocalFunction } &&
2593MethodSymbol symbolOpt = GetWellKnownTypeMember(WellKnownMember.System_Index__ctor, diagnostics, syntax: node) as MethodSymbol;
2603MethodSymbol symbolOpt = null;
2628symbolOpt = (MethodSymbol)GetWellKnownTypeMember(
2637symbolOpt = (MethodSymbol)GetWellKnownTypeMember(
2758ImmutableArray<MethodSymbol> originalUserDefinedConversions = conversion.OriginalUserDefinedConversions;
3248&& ((MethodSymbol)containingSymbol).IsAsync
4724MethodSymbol constructor,
4748MethodSymbol constructor,
4884MemberResolutionResult<MethodSymbol> memberResolutionResult;
4885ImmutableArray<MethodSymbol> candidateConstructors;
4910MethodSymbol constructor,
4918MemberResolutionResult<MethodSymbol> memberResolutionResult,
4919ImmutableArray<MethodSymbol> candidateConstructors,
4929this.CheckAndCoerceArguments<MethodSymbol>(nonNullSyntax, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, out argsToParamsOpt);
4938MethodSymbol resultMember = memberResolutionResult.Member;
5055static void validateRecordCopyConstructor(MethodSymbol constructor, NamedTypeSymbol baseType, MethodSymbol resultMember, Location errorLocation, BindingDiagnosticBag diagnostics)
5106internal static bool IsUserDefinedRecordCopyConstructor(MethodSymbol constructor)
6082private static ImmutableSegmentedDictionary<string, Symbol> GetMembersRequiringInitialization(MethodSymbol constructor)
6094MethodSymbol constructor,
6429applicableMethods: ImmutableArray<MethodSymbol>.Empty,
6553internal ImmutableArray<MethodSymbol> FilterInaccessibleConstructors(ImmutableArray<MethodSymbol> constructors, bool allowProtectedConstructorsOfBaseType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
6555ArrayBuilder<MethodSymbol> builder = null;
6559MethodSymbol constructor = constructors[i];
6565builder = ArrayBuilder<MethodSymbol>.GetInstance();
6578private bool IsConstructorAccessible(MethodSymbol constructor, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool allowProtectedConstructorsOfBaseType = false)
6648OverloadResolutionResult<MethodSymbol> overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
6649ImmutableArray<MethodSymbol> accessibleConstructors = GetAccessibleConstructorsForOverloadResolution(type, ref useSiteInfo);
6698out MemberResolutionResult<MethodSymbol> memberResolutionResult,
6699out ImmutableArray<MethodSymbol> candidateConstructors,
6718MemberResolutionResult<MethodSymbol> memberResolutionResult,
6719ImmutableArray<MethodSymbol> candidateConstructors,
6738this.CheckAndCoerceArguments<MethodSymbol>(node, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, out argToParams);
6745var method = memberResolutionResult.Member;
6802MemberResolutionResult<MethodSymbol> memberResolutionResult,
6803ImmutableArray<MethodSymbol> candidateConstructors,
6819this.CheckAndCoerceArguments<MethodSymbol>(node, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, argsToParamsOpt: out _);
7102out MemberResolutionResult<MethodSymbol> memberResolutionResult,
7103out ImmutableArray<MethodSymbol> candidateConstructors,
7109ImmutableArray<MethodSymbol> allInstanceConstructors;
7113OverloadResolutionResult<MethodSymbol> result = OverloadResolutionResult<MethodSymbol>.GetInstance();
7134OverloadResolutionResult<MethodSymbol> inaccessibleResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
7152default(MemberResolutionResult<MethodSymbol>); // Invalid results are not interesting - we have enough info in candidateConstructors.
7223private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
7225ImmutableArray<MethodSymbol> allInstanceConstructors;
7229private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, bool allowProtectedConstructorsOfBaseType, out ImmutableArray<MethodSymbol> allInstanceConstructors, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
7980lookupResult.Symbols.All(s => s.Kind == SymbolKind.Method) ? lookupResult.Symbols.SelectAsArray(s_toMethodSymbolFunc) : ImmutableArray<MethodSymbol>.Empty,
8129var builder = ArrayBuilder<MethodSymbol>.GetInstance();
8132var m = s as MethodSymbol;
8402var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
9247else if (convertedIndex is BoundObjectCreationExpression { Constructor: MethodSymbol constructor, Arguments: { Length: 2 } arguments, ArgsToParamsOpt: { IsDefaultOrEmpty: true }, InitializerExpressionOpt: null } &&
10059var substring = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_String__Substring, diagnostics, syntax);
10090candidate is MethodSymbol method &&
10107void makeCall(SyntaxNode syntax, BoundExpression receiver, MethodSymbol method,
10130internal static bool MethodHasValidSliceSignature(MethodSymbol method)
10197property.GetOwnOrInheritedGetMethod()?.OriginalDefinition is MethodSymbol getMethod &&
10396var method = node.LookupSymbolOpt as MethodSymbol;
10434var result = OverloadResolutionResult<MethodSymbol>.GetInstance();
10463var method = GetUniqueSignatureFromMethodGroup(node, out bool useParams);
10480private MethodSymbol? GetUniqueSignatureFromMethodGroup_CSharp10(BoundMethodGroup node, out bool useParams)
10482MethodSymbol? method = null;
10483var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: node.Methods.Length);
10484foreach (var m in node.Methods)
10592static bool isCandidateUnique(ref MethodSymbol? method, MethodSymbol candidate)
10616private MethodSymbol? GetUniqueSignatureFromMethodGroup(BoundMethodGroup node, out bool useParams)
10624MethodSymbol? foundMethod = null;
10628var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: node.Methods.Length);
10629foreach (var memberMethod in node.Methods)
10652var substituted = typeArguments.IsDefaultOrEmpty ? memberMethod : memberMethod.Construct(typeArguments);
10693var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: methodGroup.Methods.Count);
10750static bool isCandidateUnique(ref MethodSymbol? foundMethod, MethodSymbol candidate)
10765bool satisfiesConstraintChecks(MethodSymbol method)
10792MethodSymbol methodSymbol,
10912MethodSymbol invoke = possibleDelegateType.DelegateInvokeMethod();
11034return symbol is MethodSymbol method &&
Binder\Binder_Invocation.cs (34)
41private static ImmutableArray<MethodSymbol> GetOriginalMethods(OverloadResolutionResult<MethodSymbol> overloadResolutionResult)
51return ImmutableArray<MethodSymbol>.Empty;
54var builder = ArrayBuilder<MethodSymbol>.GetInstance();
348result = BindDynamicInvocation(node, boundExpression, analyzedArguments, ImmutableArray<MethodSymbol>.Empty, diagnostics, queryClause);
394ImmutableArray<MethodSymbol> applicableMethods,
633var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
664private static bool HasApplicableConditionalMethod(ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates)
724ImmutableArray<MethodSymbol> originalMethods;
846private void ReportDynamicInvocationWarnings(SyntaxNode syntax, BoundMethodGroup methodGroup, BindingDiagnosticBag diagnostics, ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates)
886MemberResolutionResult<MethodSymbol> methodResolutionResult,
887MethodSymbol singleCandidate)
942MemberResolutionResult<MethodSymbol> methodResolutionResult)
944MethodSymbol singleCandidate = methodResolutionResult.LeastOverriddenMember;
951var resultWithSingleCandidate = OverloadResolutionResult<MethodSymbol>.GetInstance();
998(typeArgumentsOpt.IsDefault || ((MethodSymbol)(object)result.Member).CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, syntax.Location, candidateDiagnostics))))
1102OverloadResolutionResult<MethodSymbol> result,
1186var method = methodResult.Member;
1323var method = property.GetMethod ?? property.SetMethod;
1334internal ThreeState ReceiverIsSubjectToCloning(BoundExpression? receiver, MethodSymbol method)
1393if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_UnknownWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1402if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_DispatchWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1780internal bool CheckImplicitThisCopyInReadOnlyMember(BoundExpression receiver, MethodSymbol method, BindingDiagnosticBag diagnostics)
1786ContainingMemberOrLambda is MethodSymbol containingMethod &&
1916ImmutableArray<MethodSymbol> methods,
1923MethodSymbol method;
1927var constructedMethods = ArrayBuilder<MethodSymbol>.GetInstance();
1928foreach (var m in methods)
1956private static bool IsUnboundGeneric(MethodSymbol method)
1966private ImmutableArray<BoundExpression> BuildArgumentsForErrorRecovery(AnalyzedArguments analyzedArguments, ImmutableArray<MethodSymbol> methods)
1969foreach (var m in methods)
2174MethodSymbol method = new ErrorMethodSymbol(methodContainer, returnType, string.Empty);
2179var originalMethods = (expr.Kind == BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty;
2381BuildArgumentsForErrorRecovery(analyzedArguments, StaticCast<MethodSymbol>.From(methods)),
Binder\Binder_Operators.cs (27)
122ImmutableArray<MethodSymbol> originalUserDefinedOperators;
284MethodSymbol method = isAddition ? eventSymbol.AddMethod : eventSymbol.RemoveMethod;
388MethodSymbol userDefinedOperator = null;
578ImmutableArray<MethodSymbol> originalUserDefinedOperators;
699out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators,
964ImmutableArray<MethodSymbol> originalUserDefinedOperators;
990MethodSymbol trueOperator = null, falseOperator = null;
1051private bool IsValidDynamicCondition(BoundExpression left, bool isNegative, BindingDiagnosticBag diagnostics, out MethodSymbol userDefinedOperator)
1103out MethodSymbol trueOperator,
1104out MethodSymbol falseOperator)
1158MethodSymbol definition;
1266private bool HasApplicableBooleanOperator(NamedTypeSymbol containingType, string name, TypeSymbol argumentType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out MethodSymbol @operator)
1268var operators = ArrayBuilder<MethodSymbol>.GetInstance();
1319out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
1324originalUserDefinedOperators = default(ImmutableArray<MethodSymbol>);
1337var builder = ArrayBuilder<MethodSymbol>.GetInstance();
1340MethodSymbol method = analysisResult.Signature.Method;
1363originalUserDefinedOperators = ImmutableArray<MethodSymbol>.Empty;
1377private void ReportObsoleteAndFeatureAvailabilityDiagnostics(MethodSymbol operatorMethod, CSharpSyntaxNode node, BindingDiagnosticBag diagnostics)
1419out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
1430var builder = ArrayBuilder<MethodSymbol>.GetInstance();
1433MethodSymbol method = analysisResult.Signature.Method;
1472originalUserDefinedOperators = ImmutableArray<MethodSymbol>.Empty;
2308originalUserDefinedOperatorsOpt: default(ImmutableArray<MethodSymbol>),
2314ImmutableArray<MethodSymbol> originalUserDefinedOperators;
2385private bool CheckConstraintLanguageVersionAndRuntimeSupportForOperator(SyntaxNode node, MethodSymbol? methodOpt, bool isUnsignedRightShift, TypeSymbol? constrainedToTypeOpt, BindingDiagnosticBag diagnostics)
2773ImmutableArray<MethodSymbol> originalUserDefinedOperators;
Binder\Binder_Patterns.cs (16)
976MethodSymbol? deconstructMethod = null;
1005ShouldUseITupleForRecursivePattern(node, declType, diagnostics, out var iTupleType, out var iTupleGetLength, out var iTupleGetItem))
1048private MethodSymbol? BindDeconstructSubpatterns(
1057var deconstructMethod = deconstruct.ExpressionSymbol as MethodSymbol;
1200[NotNullWhen(true)] out MethodSymbol? iTupleGetLength,
1201[NotNullWhen(true)] out MethodSymbol? iTupleGetItem)
1238[NotNullWhen(true)] out MethodSymbol? iTupleGetLength,
1239[NotNullWhen(true)] out MethodSymbol? iTupleGetItem)
1269iTupleGetLength = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Length);
1270iTupleGetItem = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Item);
1376MethodSymbol? deconstructMethod = null;
1401ShouldUseITuple(node, strippedInputType, diagnostics, out var iTupleType, out var iTupleGetLength, out var iTupleGetItem))
1414deconstructMethod = deconstruct.ExpressionSymbol as MethodSymbol;
Binder\Binder_Statements.cs (38)
219var method = (MethodSymbol)this.ContainingMemberOrLambda;
482new SourceLabelSymbol((MethodSymbol)ContainingMemberOrLambda, node.Identifier);
637private bool ImplicitReturnIsOkay(MethodSymbol method)
748/// Checks for a Dispose method on <paramref name="expr"/> and returns its <see cref="MethodSymbol"/> if found.
753/// <returns>The <see cref="MethodSymbol"/> of the Dispose method if one is found, otherwise null.</returns>
754internal MethodSymbol TryFindDisposePatternMethod(BoundExpression expr, SyntaxNode syntaxNode, bool hasAwait, BindingDiagnosticBag diagnostics, out bool isExpanded)
764out var disposeMethod,
1243MethodSymbol fixedPatternMethod = null;
1320private MethodSymbol GetFixedPatternMethodOpt(BoundExpression initializer, BindingDiagnosticBag additionalDiagnostics)
1329var result = PerformPatternMethodLookup(initializer, methodName, initializer.Syntax, additionalDiagnostics, out var patternMethodSymbol, out bool isExpanded);
1357MethodSymbol patternMethodOpt,
1797return (member as MethodSymbol)?.MethodKind == (isStatic ?
2270ImmutableArray<MethodSymbol> originalUserDefinedConversions = conversion.OriginalUserDefinedConversions;
2706var best = this.UnaryOperatorOverloadResolution(UnaryOperatorKind.True, expr, node, diagnostics, out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators);
2932protected static bool IsInAsyncMethod(MethodSymbol method)
2939return IsInAsyncMethod(this.ContainingMemberOrLambda as MethodSymbol);
2945return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningTask(this.Compilation);
2951return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningGenericTask(this.Compilation);
2959var method = (MethodSymbol)symbol;
2968var symbol = this.ContainingMemberOrLambda as MethodSymbol;
3523var inferringLambda = this.ContainingMemberOrLambda is MethodSymbol method && (object)method.ReturnType == LambdaSymbol.ReturnTypeIsBeingInferred;
3706BoundExpression initializerInvocation = GetBinder(initializer).BindConstructorInitializer(initializer.ArgumentList, (MethodSymbol)this.ContainingMember(), diagnostics);
3727if (isInstanceConstructor(out MethodSymbol constructorSymbol) &&
3758bool isInstanceConstructor(out MethodSymbol constructorSymbol)
3760if (this.ContainingMember() is MethodSymbol { IsStatic: false } method)
3772BoundExpression initializerInvocation = GetBinder(initializer).BindConstructorInitializer(initializer.ArgumentList, (MethodSymbol)this.ContainingMember(), diagnostics);
3784initializerInvocation = BindImplicitConstructorInitializer((MethodSymbol)this.ContainingMember(), diagnostics, Compilation);
3792var constructorInitializer = new BoundExpressionStatement(ctorSyntax, initializerInvocation) { WasCompilerGenerated = ((MethodSymbol)ContainingMember()).IsImplicitlyDeclared };
3805MethodSymbol constructor, BindingDiagnosticBag diagnostics, CSharpCompilation compilation)
3912internal static BoundCall? GenerateBaseParameterlessConstructorInitializer(MethodSymbol constructor, BindingDiagnosticBag diagnostics)
3915MethodSymbol? baseConstructor = null;
3919foreach (MethodSymbol ctor in baseType.InstanceConstructors)
3981MethodSymbol? baseConstructor = SynthesizedRecordCopyCtor.FindCopyConstructor(baseType, containingType, ref useSiteInfo);
4095SyntaxNode syntaxNode, BindingDiagnosticBag diagnostics, out MethodSymbol result, out bool isExpanded)
4157var patternMethodSymbol = call.Method;
Binder\ForEachLoopBinder.cs (35)
89(MethodSymbol)this.ContainingMemberOrLambda,
234MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo?.Method;
482ImmutableArray<MethodSymbol> originalUserDefinedConversions = elementConversionClassification.OriginalUserDefinedConversions;
708MethodSymbol nullableValueGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Nullable_T_get_Value, diagnostics, exprSyntax);
1036MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo.Method;
1079MethodSymbol getEnumeratorMethod;
1084getEnumeratorMethod = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerable_T__GetAsyncEnumerator,
1100getEnumeratorMethod = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerable_T__GetEnumerator, diagnostics, errorLocationSyntax);
1103MethodSymbol moveNextMethod = null;
1106MethodSymbol specificGetEnumeratorMethod = getEnumeratorMethod.AsMember(collectionType);
1117MethodSymbol currentPropertyGetter;
1122MethodSymbol moveNextAsync = (MethodSymbol)GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__MoveNextAsync,
1130currentPropertyGetter = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__get_Current, diagnostics, errorLocationSyntax.Location, isOptional: false);
1134currentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerator_T__get_Current, diagnostics, errorLocationSyntax);
1146moveNextMethod = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__MoveNext, diagnostics, errorLocationSyntax);
1161builder.CurrentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__get_Current, diagnostics, errorLocationSyntax);
1198MethodSymbol patternDisposeMethod = TryFindDisposePatternMethod(receiver, syntax, isAsync, patternDiagnostics, out bool expanded);
1301builder.CurrentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__get_Current, diagnostics, syntax);
1378ArrayBuilder<MethodSymbol> candidateMethods = ArrayBuilder<MethodSymbol>.GetInstance();
1393MethodSymbol method = (MethodSymbol)member;
1404candidateMethods.Add((MethodSymbol)member);
1419private MethodArgumentInfo PerformForEachPatternOverloadResolution(SyntaxNode syntax, SyntaxNode collectionSyntax, TypeSymbol patternType, ArrayBuilder<MethodSymbol> candidateMethods, bool warningsOnly, BindingDiagnosticBag diagnostics, bool isAsync)
1423var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
1438MethodSymbol result = null;
1517var result = overloadResolutionResult.ValidResult.Member;
1596MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo.Method;
1655MethodSymbol currentPropertyGetterCandidate = ((PropertySymbol)lookupSymbol).GetOwnOrInheritedGetMethod();
1698private bool IsInvalidMoveNextMethod(MethodSymbol moveNextMethodCandidate, bool isAsync)
1898var resolvedMember = (MethodSymbol)GetSpecialTypeMember(member, diagnostics, syntax);
1906private MethodArgumentInfo BindDefaultArguments(MethodSymbol method, BoundExpression extensionReceiverOpt, bool expanded, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
Binder\InMethodBinder.cs (5)
25private readonly MethodSymbol _methodSymbol;
30/// This map is used by <see cref="MethodCompiler.BindMethodBody(MethodSymbol, TypeCompilationState, BindingDiagnosticBag, bool, BoundNode?, bool, out ImportChain?, out bool, out bool, out MethodBodySemanticModel.InitialState)"/>
40public InMethodBinder(MethodSymbol owner, Binder enclosing)
272if (((MethodSymbol)newSymbol).MethodKind == MethodKind.LocalFunction)
300if (((MethodSymbol)newSymbol).MethodKind == MethodKind.LocalFunction)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (45)
101public void ObjectCreationOverloadResolution(ImmutableArray<MethodSymbol> constructors, AnalyzedArguments arguments, OverloadResolutionResult<MethodSymbol> result, bool dynamicResolution, bool isEarlyAttributeBinding, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
137ArrayBuilder<MethodSymbol> methods,
141OverloadResolutionResult<MethodSymbol> result,
225internal bool FilterMethodsForUniqueSignature(ArrayBuilder<MethodSymbol> methods, out bool useParams)
234var result = OverloadResolutionResult<MethodSymbol>.GetInstance();
248unreducedMethods = ArrayBuilder<MethodSymbol>.GetInstance(methods.Count);
294var applicableMethods = ArrayBuilder<MethodSymbol>.GetInstance(methods.Count);
543case MethodSymbol method:
644if (typeof(TMember) != typeof(MethodSymbol))
652var member = (MethodSymbol)(Symbol)result.Member;
667if (typeof(TMember) != typeof(MethodSymbol))
688var member = (MethodSymbol)(Symbol)result.Member;
794private bool FailsConstraintChecks(MethodSymbol method, out ArrayBuilder<TypeParameterDiagnosticInfo> constraintFailureDiagnosticsOpt, CompoundUseSiteInfo<AssemblySymbol> template)
847Debug.Assert(typeof(TMember) == typeof(MethodSymbol));
857var method = (MethodSymbol)(Symbol)result.Member;
919private void AddConstructorToCandidateSet(MethodSymbol constructor, ArrayBuilder<MemberResolutionResult<MethodSymbol>> results,
928results.Add(new MemberResolutionResult<MethodSymbol>(constructor, constructor, MemberAnalysisResult.UnsupportedMetadata(), hasTypeArgumentInferredFromFunctionType: false));
950results.Add(new MemberResolutionResult<MethodSymbol>(constructor, constructor, result, hasTypeArgumentInferredFromFunctionType: false));
955MethodSymbol constructor,
998MethodSymbol constructor,
1451return ((MethodSymbol)member).HidesBaseMethodsByName;
1723ArrayBuilder<MemberResolutionResult<MethodSymbol>> results,
1724ImmutableArray<MethodSymbol> constructors,
1737foreach (MethodSymbol constructor in constructors)
1753RemoveLowerPriorityMembers<MemberResolutionResult<MethodSymbol>, MethodSymbol>(results);
3249MethodSymbol invoke;
3515MethodSymbol invoke1 = d1.DelegateInvokeMethod;
3516MethodSymbol invoke2 = d2.DelegateInvokeMethod;
3627MethodSymbol invoke1 = d1.DelegateInvokeMethod;
3628MethodSymbol invoke2 = d2.DelegateInvokeMethod;
3775MethodSymbol method,
4184MethodSymbol method;
4188member.Kind == SymbolKind.Method && (method = (MethodSymbol)(Symbol)member).Arity > 0)
4190MethodSymbol leastOverriddenMethod = (MethodSymbol)(Symbol)leastOverriddenMember;
4305MethodSymbol method,
4491(ignoreOpenTypes && parameters.ParameterTypes[argumentPosition].Type.ContainsTypeParameter(parameterContainer: (MethodSymbol)candidate))));
4589if (ignoreOpenTypes && parameterType.ContainsTypeParameter(parameterContainer: (MethodSymbol)candidate))
4642return (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 (27)
90MethodSymbol method,
108MethodSymbol method,
124MethodSymbol method,
130ImmutableArray<MethodSymbol> originalMethods,
163public BoundCall Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments)
168public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method)
173public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, BoundExpression arg0)
178public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, BoundExpression arg0, BoundExpression arg1)
183public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt = default)
230static ImmutableArray<RefKind> getArgumentRefKinds(MethodSymbol method)
253public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, params BoundExpression[] arguments)
257public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments)
433MethodSymbol? methodOpt,
436ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt,
454MethodSymbol? methodOpt,
467MethodSymbol? methodOpt,
491MethodSymbol logicalOperator,
492MethodSymbol trueOperator,
493MethodSymbol falseOperator,
496ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt,
517MethodSymbol logicalOperator,
518MethodSymbol trueOperator,
519MethodSymbol falseOperator,
747MethodSymbol? methodOpt,
759MethodSymbol? methodOpt,
772MethodSymbol? methodOpt,
785public 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)
464var rosPointerCtor = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_ReadOnlySpan_T__ctor_Pointer, _diagnostics, syntax: wrappedExpression.Syntax, isOptional: true);
610MethodSymbol? createSpan = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__CreateSpanRuntimeFieldHandle, _diagnostics, syntax: wrappedExpression.Syntax, isOptional: true);
634if (!tryGetReadOnlySpanArrayCtor(wrappedExpression.Syntax, out var rosArrayCtor))
698if (!tryGetReadOnlySpanArrayCtor(arrayCreation.Syntax, out var rosArrayCtor))
777bool tryGetReadOnlySpanArrayCtor(SyntaxNode syntax, [NotNullWhen(true)] out MethodSymbol? rosArrayCtor)
779rosArrayCtor = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_ReadOnlySpan_T__ctor_Array, _diagnostics, syntax: syntax, isOptional: true);
CodeGen\EmitStatement.cs (18)
1533var sequenceEqualsTMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1539var sequenceEqualsCharMethod = sequenceEqualsTMethod.Construct(Binder.GetSpecialType(_module.Compilation, SpecialType.System_Char, syntaxNode, _diagnostics));
1542var asSpanMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_MemoryExtensions__AsSpan_String, _diagnostics, syntax: syntaxNode);
1548var stringEqualityMethod = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__op_Equality) as MethodSymbol;
1628var spanTLengthMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1633var spanCharLengthMethod = spanTLengthMethod.AsMember((NamedTypeSymbol)keyType);
1638var stringLengthMethod = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__Length) as MethodSymbol;
1652var spanTIndexerMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1658var spanCharLengthMethod = spanTIndexerMethod.AsMember((NamedTypeSymbol)keyType);
1664var stringCharsIndexer = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__Chars) as MethodSymbol;
1694Debug.Assert(stringEqualityMethodRef == _module.Translate((MethodSymbol)_module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__op_Equality), (CSharpSyntaxNode)syntaxNode, assertDiagnostics));
Compilation\CSharpCompilation.cs (27)
270internal bool IsNullableAnalysisEnabledIn(MethodSymbol method)
527var methodSymbol = (debugEntryPoint as Symbols.PublicModel.MethodSymbol)?.UnderlyingMethodSymbol;
1860internal new MethodSymbol? GetEntryPoint(CancellationToken cancellationToken)
1899var entryPointMethod = FindEntryPoint(simpleProgramEntryPointSymbol, cancellationToken, out diagnostics);
1919private MethodSymbol? FindEntryPoint(MethodSymbol? simpleProgramEntryPointSymbol, CancellationToken cancellationToken, out ReadOnlyBindingDiagnostic<AssemblySymbol> sealedDiagnostics)
1923var entryPointCandidates = ArrayBuilder<MethodSymbol>.GetInstance();
1991var taskEntryPoints = ArrayBuilder<(bool IsValid, MethodSymbol Candidate, BindingDiagnosticBag SpecificDiagnostics)>.GetInstance();
1998bool checkValid(MethodSymbol candidate, bool isCandidate, BindingDiagnosticBag specificDiagnostics)
2016var viableEntryPoints = ArrayBuilder<MethodSymbol>.GetInstance();
2103MethodSymbol? entryPoint = null;
2157ArrayBuilder<MethodSymbol> entryPointCandidates, IEnumerable<Symbol> members)
2161if (member is MethodSymbol method &&
2169internal bool ReturnsAwaitableToVoidOrInt(MethodSymbol method, BindingDiagnosticBag diagnostics)
2207internal (bool IsCandidate, bool IsTaskLike) HasEntryPointSignature(MethodSymbol method, BindingDiagnosticBag bag)
2261public readonly MethodSymbol? MethodSymbol;
2266public EntryPoint(MethodSymbol? methodSymbol, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics)
2420private ConcurrentSet<MethodSymbol>? _moduleInitializerMethods;
2422internal void AddModuleInitializerMethod(MethodSymbol method)
2450private ConcurrentDictionary<(ImmutableArray<byte> ContentHash, int Position), OneOrMany<(Location AttributeLocation, MethodSymbol Interceptor)>>? _interceptions;
2452internal void AddInterception(ImmutableArray<byte> contentHash, int position, Location attributeLocation, MethodSymbol interceptor)
2458() => new ConcurrentDictionary<(ImmutableArray<byte> ContentHash, int Position), OneOrMany<(Location AttributeLocation, MethodSymbol Interceptor)>>(comparer: InterceptorKeyComparer.Instance));
2479internal (Location AttributeLocation, MethodSymbol Interceptor)? TryGetInterceptor(SimpleNameSyntax? node)
3078if (symbol.Kind == SymbolKind.Method && symbol.IsImplicitlyDeclared && ((MethodSymbol)symbol).MethodKind == MethodKind.Constructor)
3639foreach ((_, OneOrMany<(Location, MethodSymbol)> interceptionsOfAGivenLocation) in _interceptions)
3665foreach (MethodSymbol method in _moduleInitializerMethods.OrderBy<MethodSymbol>(LexicalOrderSymbolComparer.Instance))
Compilation\CSharpSemanticModel.cs (48)
1668foreach (MethodSymbol extensionMethod in lookupResult.Symbols)
1670var reduced = extensionMethod.ReduceExtensionMethod(containingType, Compilation);
1784case MethodSymbol { MethodKind: MethodKind.LambdaMethod }:
3499var methodSymbol = eventAssignment.IsAddition ? eventSymbol.AddMethod : eventSymbol.RemoveMethod;
3530var symbol = conversion.SymbolOpt;
3628memberGroup = dynamicInvocation.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3636memberGroup = collectionInit.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3656memberGroup = objectCreation.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3675memberGroup = boundObjectCreation.ConstructorsGroup.Cast<MethodSymbol, Symbol>();
3736return new ThisParameterSymbol(containingMember as MethodSymbol, typeOfThis);
3750thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, containingType);
3757thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, containingType);
3785thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, typeOfThis);
3939private static void GetSymbolsAndResultKind(BoundExpression node, Symbol symbolOpt, ImmutableArray<MethodSymbol> originalCandidates, out OneOrMany<Symbol> symbols, out LookupResultKind resultKind)
3970MethodSymbol constructor = null;
4016MethodSymbol constructorOpt,
4033ImmutableArray<MethodSymbol> candidateConstructors;
4054candidateConstructors = ImmutableArray<MethodSymbol>.Empty;
4069memberGroup = candidateConstructors.Cast<MethodSymbol, Symbol>();
4195private static ImmutableArray<MethodSymbol> FilterOverriddenOrHiddenMethods(ImmutableArray<MethodSymbol> methods)
4204foreach (MethodSymbol method in methods)
4254methodGroup = GetReducedAndFilteredMethodGroupSymbols(binder, boundNode).Cast<MethodSymbol, Symbol>();
4297MethodSymbol method = null;
4326symbols = OneOrMany.Create(dynamicInvocation.ApplicableMethods.Cast<MethodSymbol, Symbol>());
4561internal static ImmutableArray<MethodSymbol> GetReducedAndFilteredMethodGroupSymbols(Binder binder, BoundMethodGroup node)
4563var methods = ArrayBuilder<MethodSymbol>.GetInstance();
4564var filteredMethods = ArrayBuilder<MethodSymbol>.GetInstance();
4574ImmutableArray<MethodSymbol> nonHiddenMethods = FilterOverriddenOrHiddenMethods(node.Methods);
4577foreach (var method in nonHiddenMethods)
4628var extensionMethods = ArrayBuilder<MethodSymbol>.GetInstance();
4663ArrayBuilder<MethodSymbol> methods,
4664ArrayBuilder<MethodSymbol> filteredMethods,
4665MethodSymbol method,
4670MethodSymbol constructedMethod;
4702ArrayBuilder<MethodSymbol> methods,
4703ArrayBuilder<MethodSymbol> filteredMethods,
4729var method = (MethodSymbol)singleResult.Symbol;
4747private static OneOrMany<MethodSymbol> CreateReducedExtensionMethodsFromOriginalsIfNecessary(BoundCall call, CSharpCompilation compilation)
4769var methodBuilder = ArrayBuilder<MethodSymbol>.GetInstance();
4770var filteredMethodBuilder = ArrayBuilder<MethodSymbol>.GetInstance();
4771foreach (var method in FilterOverriddenOrHiddenMethods(methods))
4786var method = call.Method;
4793MethodSymbol reduced = method.ReduceExtensionMethod(receiver.Type, Compilation);
4803var method = delegateCreation.MethodOpt;
4808MethodSymbol reduced = method.ReduceExtensionMethod(receiverOpt.Type, Compilation);
5200if (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 (21)
136MethodSymbol entryPoint = null;
221private static MethodSymbol GetEntryPoint(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuilt, bool hasDeclarationErrors, bool emitMethodBodies, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken)
229var entryPoint = entryPointAndDiagnostics.MethodSymbol;
512MethodSymbol method = (MethodSymbol)member;
584foreach (var method in AnonymousTypeManager.GetAnonymousTypeHiddenMethods(containingType))
600MethodSymbol method = new SynthesizedStaticConstructor(sourceTypeSymbol);
655internal static MethodSymbol GetMethodToCompile(MethodSymbol method)
673var method = (MethodSymbol)definition.GetInternalSymbol();
689foreach (var method in additionalType.GetMethodsToEmit())
865public override object VisitMethod(MethodSymbol symbol, TypeCompilationState arg)
886MethodSymbol methodSymbol,
1363MethodSymbol method,
1487MethodSymbol method,
1526MethodSymbol kickoffMethod;
1717internal static BoundBlock? BindSynthesizedMethodBody(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
1734MethodSymbol method,
2333private static BoundStatement BindImplicitConstructorInitializerIfAny(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
2357private 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)
26internal abstract class PEModuleBuilder : PEModuleBuilder<CSharpCompilation, SourceModuleSymbol, AssemblySymbol, TypeSymbol, NamedTypeSymbol, MethodSymbol, SyntaxNode, NoPia.EmbeddedTypesManager, ModuleCompilationState>
391var method = (MethodSymbol)member;
500internal virtual VariableSlotAllocator TryCreateVariableSlotAllocator(MethodSymbol method, MethodSymbol topLevelMethod, DiagnosticBag diagnostics)
505internal virtual MethodInstrumentation GetMethodBodyInstrumentations(MethodSymbol method)
841return ((MethodSymbol)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__InitializeArrayArrayRuntimeFieldHandle))?.GetCciAdapter();
1203internal sealed override Cci.IMethodReference Translate(MethodSymbol symbol, DiagnosticBag diagnostics, bool needDeclaration)
1209MethodSymbol methodSymbol,
1243MethodSymbol methodSymbol,
1303else if (methodSymbol is NativeIntegerMethodSymbol { UnderlyingMethod: MethodSymbol underlyingMethod })
1319MethodSymbol methodSymbol,
1431return container.Kind == SymbolKind.Method && ((MethodSymbol)container).IsGenericMethod ||
1820internal MethodSymbol EnsureThrowSwitchExpressionExceptionExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
1833private MethodSymbol EnsurePrivateImplClassMethodExists<TArg>(SyntaxNode syntaxNode, string methodName, Func<SynthesizedPrivateImplementationDetailsType, TArg, MethodSymbol> createMethodSymbol, TArg arg, DiagnosticBag diagnostics)
1840return (MethodSymbol)methodAdapter.GetInternalSymbol()!;
1843MethodSymbol methodSymbol = createMethodSymbol(privateImplClass, arg);
1848return (MethodSymbol)privateImplClass.PrivateImplementationDetails.GetMethod(methodName)!.GetInternalSymbol()!;
1867internal MethodSymbol EnsureThrowSwitchExpressionExceptionParameterlessExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
1887internal MethodSymbol EnsureThrowInvalidOperationExceptionExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
1904internal MethodSymbol EnsureInlineArrayAsSpanExists(SyntaxNode syntaxNode, NamedTypeSymbol spanType, NamedTypeSymbol intType, DiagnosticBag diagnostics)
1932var attributeConstructor = (MethodSymbol)factory.SpecialMember(SpecialMember.System_Runtime_CompilerServices_InlineArrayAttribute__ctor);
1973internal MethodSymbol EnsureInlineArrayAsReadOnlySpanExists(SyntaxNode syntaxNode, NamedTypeSymbol spanType, NamedTypeSymbol intType, DiagnosticBag diagnostics)
1990internal MethodSymbol EnsureInlineArrayElementRefExists(SyntaxNode syntaxNode, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2006internal MethodSymbol EnsureInlineArrayElementRefReadOnlyExists(SyntaxNode syntaxNode, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2022internal MethodSymbol EnsureInlineArrayFirstElementRefExists(SyntaxNode syntaxNode, DiagnosticBag diagnostics)
2035internal MethodSymbol EnsureInlineArrayFirstElementRefReadOnlyExists(SyntaxNode syntaxNode, DiagnosticBag diagnostics)
FlowAnalysis\AbstractFlowPass.cs (25)
470var method = _symbol as MethodSymbol;
484(_symbol as MethodSymbol)?.TryGetThisParameter(out thisParameter);
496var method = _symbol as MethodSymbol;
1419private void VisitReceiverBeforeCall(BoundExpression receiverOpt, MethodSymbol method)
1427private void VisitReceiverAfterCall(BoundExpression receiverOpt, MethodSymbol method)
1482var method = GetReadMethod(node.Indexer);
1516protected virtual void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method)
1543private void VisitArgumentsAfterCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method)
1571protected virtual void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method)
1635static bool ignoreReceiver(MethodSymbol method)
2114protected virtual void PropertySetter(BoundExpression node, BoundExpression receiver, MethodSymbol setter, BoundExpression value = null)
2141var method = GetWriteMethod(property);
2196var readMethod = GetReadMethod(property);
2215var writeMethod = GetWriteMethod(property);
2275var method = GetReadMethod(property);
2811var readMethod = GetReadMethod(property);
2812var writeMethod = GetWriteMethod(property);
3015var method = conversion.Method;
3587MethodSymbol method = null;
3688private static MethodSymbol GetReadMethod(PropertySymbol property) =>
3691private static MethodSymbol GetWriteMethod(PropertySymbol property) =>
3715var readMethod = property.GetOwnOrInheritedGetMethod();
3773var writeMethod = symbol.GetOwnOrInheritedSetMethod();
FlowAnalysis\NullableWalker.cs (158)
199private MethodSymbol? _delegateInvokeMethod;
238private PooledDictionary<MethodSymbol, Variables>? _nestedFunctionVariables;
263private readonly MethodSymbol? _baseOrThisInitializer;
453MethodSymbol? delegateInvokeMethodOpt,
458MethodSymbol? baseOrThisInitializer,
602if ((_symbol as MethodSymbol)?.IsConstructor() != true || _useConstructorExitWarnings)
630var method = _symbol as MethodSymbol;
704void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member, LocalState state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis)
797if (_symbol is MethodSymbol method)
875var baseOrThisInitializer = GetBaseOrThisInitializer();
1041private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt, LocalState state, MethodSymbol method, string memberName)
1075if (_symbol is MethodSymbol method)
1105if (_symbol is MethodSymbol method)
1153private void MakeMembersMaybeNull(MethodSymbol method, ImmutableArray<string> members)
1161void makeMemberMaybeNull(MethodSymbol method, string memberName)
1184int containingSlot = GetReceiverSlotForMemberPostConditions(_symbol as MethodSymbol);
1209private MethodSymbol? GetBaseOrThisInitializer()
1371else if (CurrentSymbol is MethodSymbol { IsAsync: false })
1383if (CurrentSymbol is MethodSymbol method &&
1397MethodSymbol method,
1403MethodSymbol? baseOrThisInitializer,
1424MethodSymbol method,
1430MethodSymbol? baseOrThisInitializer,
1466if (symbol is MethodSymbol method
1482internal static VariableState? GetAfterInitializersState(CSharpCompilation compilation, MethodSymbol method, BoundNode nodeToAnalyze, BoundNode? constructorBody, BindingDiagnosticBag diagnostics)
1499MethodSymbol? baseOrThisInitializer = GetConstructorThisOrBaseSymbol(constructorBody);
1520private static MethodSymbol? GetConstructorThisOrBaseSymbol(BoundNode? constructorBody)
1745MethodSymbol? delegateInvokeMethodOpt,
1788MethodSymbol? delegateInvokeMethodOpt,
1790MethodSymbol? baseOrThisInitializer,
2085var method = getTopLevelMethod(_symbol as MethodSymbol);
2164static MethodSymbol? getTopLevelMethod(MethodSymbol? method)
2173method = container as MethodSymbol;
2191var enclosingMemberMethod = _symbol as MethodSymbol;
2195enclosingMemberMethod = enclosingMemberMethod.ContainingSymbol as MethodSymbol;
2208if (this._symbol is MethodSymbol constructor
2839if (!(CurrentSymbol is MethodSymbol methodSymbol))
3002if (CurrentSymbol is MethodSymbol method)
3036var method = CurrentSymbol as MethodSymbol;
3044var delegateOrMethod = _useDelegateInvokeReturnType ? _delegateInvokeMethod! : method;
3277private Variables GetOrCreateNestedFunctionVariables(Variables container, MethodSymbol lambdaOrLocalFunction)
3279_nestedFunctionVariables ??= PooledDictionary<MethodSymbol, Variables>.GetInstance();
3291MethodSymbol lambdaOrFunctionSymbol,
3293MethodSymbol? delegateInvokeMethod,
3305var oldDelegateInvokeMethod = _delegateInvokeMethod;
3673var invokeMethod = n.DelegateInvokeMethod;
3858var createMethod = node.CollectionBuilderMethod;
3874var createMethod = node.CollectionBuilderMethod;
3918MethodSymbol? constructor = getConstructor(node, node.Type);
3929(int slot, NullableFlowState resultState, Func<TypeSymbol, MethodSymbol?, int>? initialStateInferenceCompletion) = inferInitialObjectState(node, type, constructor, arguments, argumentResults, isTargetTyped);
3947Func<TypeSymbol, MethodSymbol?, int>? initialStateInferenceCompletion,
3976Func<TypeSymbol, MethodSymbol?, int> initialStateInferenceCompletion,
3988MethodSymbol? constructor = getConstructor(node, type);
4000static MethodSymbol? getConstructor(BoundObjectCreationExpressionBase node, TypeSymbol type)
4002var constructor = node.Constructor;
4006constructor = (MethodSymbol)AsMemberOfType(type, constructor);
4012(int slot, NullableFlowState resultState, Func<TypeSymbol, MethodSymbol?, int>? completion) inferInitialObjectState(
4013BoundExpression node, TypeSymbol type, MethodSymbol? constructor,
4082Func<TypeSymbol, MethodSymbol?, int> inferInitialObjectStateAsContinuation(
4087return (TypeSymbol type, MethodSymbol? constructor) =>
4365MethodSymbol addMethod = addMethodAsMemberOfContainingType(node, containingType, ref argumentResults);
4368(MethodSymbol? reinferredMethod,
4398MethodSymbol? reinferredMethod,
4429MethodSymbol addMethod = addMethodAsMemberOfContainingType(node, containingType, ref argumentResults);
4437static MethodSymbol addMethodAsMemberOfContainingType(BoundCollectionElementInitializer node, TypeSymbol containingType, ref ImmutableArray<VisitResult> argumentResults)
4439var method = node.AddMethod;
4462method = (MethodSymbol)AsMemberOfType(containingType, method);
4896private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType)
5135MethodSymbol? method,
5160var reinferredMethod = (MethodSymbol)AsMemberOfType(asMemberOfType, method);
6338var method = node.Method;
6343method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
6366private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results)
6404static bool anyOverriddenMethodHasExplicitImplementation(MethodSymbol method)
6406for (var overriddenMethod = method; overriddenMethod is object; overriddenMethod = overriddenMethod.OverriddenMethod)
6417static bool isWellKnownEqualityMethodOrImplementation(CSharpCompilation compilation, MethodSymbol method, TypeSymbol? receiverType, WellKnownMember wellKnownMember)
6419var wellKnownMethod = (MethodSymbol?)compilation.GetWellKnownTypeMember(wellKnownMember);
6428var constructedMethod = wellKnownMethod.AsMember(constructedType);
6453for (var overriddenMethod = method; overriddenMethod is object; overriddenMethod = overriddenMethod.OverriddenMethod)
6531private bool IsCompareExchangeMethod(MethodSymbol? method)
6603private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method)
6631private TypeWithState GetReturnTypeWithState(MethodSymbol method)
6769protected override void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method)
6775private (MethodSymbol? method, ImmutableArray<VisitResult> results, bool returnNotNull) VisitArguments(
6779MethodSymbol? method,
6803private (MethodSymbol? method, ImmutableArray<VisitResult> results, bool returnNotNull) VisitArguments(
6812MethodSymbol? method = null,
6821private delegate (MethodSymbol? method, bool returnNotNull) ArgumentsCompletionDelegate(ImmutableArray<VisitResult> argumentResults, ImmutableArray<ParameterSymbol> parametersOpt, MethodSymbol? method);
6823private (MethodSymbol? method, ImmutableArray<VisitResult> results, bool returnNotNull, ArgumentsCompletionDelegate? completion)
6833MethodSymbol? method,
6861(MethodSymbol? method, ImmutableArray<VisitResult> results, bool returnNotNull, ArgumentsCompletionDelegate? completion)
6874MethodSymbol? method,
7044return (ImmutableArray<VisitResult> results, ImmutableArray<ParameterSymbol> parametersOpt, MethodSymbol? method) =>
7147private void ApplyMemberPostConditions(BoundExpression? receiverOpt, MethodSymbol? method)
7169private int GetReceiverSlotForMemberPostConditions(MethodSymbol? method)
7181MethodSymbol? current = method;
7182while (current.ContainingSymbol is MethodSymbol container)
7199private void ApplyMemberPostConditions(int receiverSlot, MethodSymbol method)
7876private MethodSymbol InferMethodTypeArguments(
7877MethodSymbol method,
7887var definition = method.ConstructedFrom;
7974internal override TypeWithAnnotations GetMethodGroupResultType(BoundMethodGroup group, MethodSymbol method)
7980method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
8064private void CheckMethodConstraints(SyntaxNode syntax, MethodSymbol method)
8241if (((MethodSymbol)symbol).MethodKind == MethodKind.LocalFunction)
8313if (result is MethodSymbol resultMethod && resultMethod.IsGenericMethod)
8315result = resultMethod.Construct(((MethodSymbol)symbol).TypeArgumentsWithAnnotations);
8694private void ReportNullabilityMismatchWithTargetDelegate(Location location, TypeSymbol targetType, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool invokedAsExtensionMethod)
8712void reportBadDelegateReturn(BindingDiagnosticBag bag, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool topLevel, (TypeSymbol targetType, Location location) arg)
8719void reportBadDelegateParameter(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameter, bool topLevel, (TypeSymbol targetType, Location location) arg)
8730MethodSymbol? targetInvokeMethod = delegateType.DelegateInvokeMethod;
8783void reportBadDelegateReturn(BindingDiagnosticBag bag, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool topLevel, Location location)
8790void reportBadDelegateParameter(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameterSymbol, bool topLevel, Location location)
8904var method = conversion.Method;
8921static (MethodSymbol invokeSignature, ImmutableArray<ParameterSymbol>) getDelegateOrFunctionPointerInfo(TypeSymbol targetType)
9436var method = conversion.Method;
9736var method = node.MethodOpt;
9866private MethodSymbol CheckMethodGroupReceiverNullability(BoundMethodGroup group, ImmutableArray<ParameterSymbol> parameters, MethodSymbol method, bool invokedAsExtensionMethod)
9874method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
9928var delegateInvokeMethod = delegateTypeOpt?.DelegateInvokeMethod;
9944private static void UseDelegateInvokeParameterAndReturnTypes(BoundLambda lambda, MethodSymbol? delegateInvokeMethod, out bool useDelegateInvokeParameterTypes, out bool useDelegateInvokeReturnType)
10218var deconstructMethod = invocation?.Method;
10233deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.Type, deconstructMethod);
10484MethodSymbol? incrementOperator = (node.OperatorKind.IsUserDefined() && node.MethodOpt?.ParameterCount == 1) ? node.MethodOpt : null;
10868var getMethod = ((PropertySymbol)member.OriginalDefinition).GetMethod;
10889var getValue = (MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Nullable_T_get_Value);
10956MethodSymbol? reinferredGetEnumeratorMethod = null;
11069reinferredGetEnumeratorMethod = (MethodSymbol)AsMemberOfType(getEnumeratorType, enumeratorInfoOpt.GetEnumeratorInfo.Method);
11082var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.Type, enumeratorInfoOpt.CurrentPropertyGetter);
11091var moveNextAsyncMethod = (MethodSymbol)AsMemberOfType(reinferredGetEnumeratorMethod.ReturnType, enumeratorInfoOpt.MoveNextInfo.Method);
11107var disposeAsyncMethod = (MethodSymbol)AsMemberOfType(reinferredGetEnumeratorMethod.ReturnType, originalDisposeMethod);
11313node.MethodOpt is MethodSymbol method &&
11322method = (MethodSymbol)AsMemberOfType(operandType.Type!.StrippedType(), method);
11418MethodSymbol? logicalOperator = null;
11419MethodSymbol? trueFalseOperator = null;
11502var getResult = awaitableInfo.GetResult;
11503var reinferredGetResult = _visitResult.RValueType.Type is NamedTypeSymbol taskAwaiterType
12055var method = (MethodSymbol)CurrentSymbol;
12707var variables = (symbol.ContainingSymbol is MethodSymbol containingMethod ? _variables.GetVariablesForMethodScope(containingMethod) : null) ??
Generated\BoundNodes.xml.Generated.cs (167)
1183public BoundUnaryOperator(SyntaxNode syntax, UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1203public MethodSymbol? MethodOpt { get; }
1206public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1211public BoundUnaryOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
1225public 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)
1247public MethodSymbol? MethodOpt { get; }
1254public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1259public 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)
1334public BoundFunctionPointerLoad(SyntaxNode syntax, MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type, bool hasErrors)
1345public BoundFunctionPointerLoad(SyntaxNode syntax, MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type)
1356public MethodSymbol TargetMethod { get; }
1363public BoundFunctionPointerLoad Update(MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type)
1483public BoundRefTypeOperator(SyntaxNode syntax, BoundExpression operand, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors = false)
1496public MethodSymbol? GetTypeFromHandle { get; }
1501public BoundRefTypeOperator Update(BoundExpression operand, MethodSymbol? getTypeFromHandle, TypeSymbol type)
1577public BoundFromEndIndexExpression(SyntaxNode syntax, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
1590public MethodSymbol? MethodOpt { get; }
1595public BoundFromEndIndexExpression Update(BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol type)
1609public BoundRangeExpression(SyntaxNode syntax, BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
1623public MethodSymbol? MethodOpt { get; }
1628public BoundRangeExpression Update(BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type)
1733public BoundUserDefinedConditionalLogicalOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type, bool hasErrors = false)
1754public MethodSymbol LogicalOperator { get; }
1755public MethodSymbol TrueOperator { get; }
1756public MethodSymbol FalseOperator { get; }
1759public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1764public BoundUserDefinedConditionalLogicalOperator Update(BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type)
1778public 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)
1806public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1811public BoundCompoundAssignmentOperator Update(BinaryOperatorSignature @operator, BoundExpression left, BoundExpression right, BoundValuePlaceholder? leftPlaceholder, BoundExpression? leftConversion, BoundValuePlaceholder? finalPlaceholder, BoundExpression? finalConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
2141public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, bool hasErrors = false)
2155public MethodSymbol? GetResult { get; }
2160public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult)
2209protected BoundTypeOf(BoundKind kind, SyntaxNode syntax, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors)
2218protected BoundTypeOf(BoundKind kind, SyntaxNode syntax, MethodSymbol? getTypeFromHandle, TypeSymbol type)
2228public MethodSymbol? GetTypeFromHandle { get; }
2233public BoundTypeOfOperator(SyntaxNode syntax, BoundTypeExpression sourceType, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors = false)
2248public BoundTypeOfOperator Update(BoundTypeExpression sourceType, MethodSymbol? getTypeFromHandle, TypeSymbol type)
2294public BoundMethodDefIndex(SyntaxNode syntax, MethodSymbol method, TypeSymbol type, bool hasErrors)
2304public BoundMethodDefIndex(SyntaxNode syntax, MethodSymbol method, TypeSymbol type)
2315public MethodSymbol Method { get; }
2320public BoundMethodDefIndex Update(MethodSymbol method, TypeSymbol type)
2708public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type, bool hasErrors)
2719public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
2731public MethodSymbol Method { get; }
2732public MethodSymbol? GetMethodFromHandle { get; }
2737public BoundMethodInfo Update(MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
2751public BoundFieldInfo(SyntaxNode syntax, FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type, bool hasErrors)
2762public BoundFieldInfo(SyntaxNode syntax, FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type)
2775public MethodSymbol? GetFieldFromHandle { get; }
2780public BoundFieldInfo Update(FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type)
2952public BoundConversion(SyntaxNode syntax, BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, ImmutableArray<MethodSymbol> originalUserDefinedConversionsOpt, TypeSymbol type, bool hasErrors = false)
2977public ImmutableArray<MethodSymbol> OriginalUserDefinedConversionsOpt { get; }
2982public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, ImmutableArray<MethodSymbol> originalUserDefinedConversionsOpt, TypeSymbol type)
2996public BoundReadOnlySpanFromArray(SyntaxNode syntax, BoundExpression operand, MethodSymbol conversionMethod, TypeSymbol type, bool hasErrors = false)
3010public MethodSymbol ConversionMethod { get; }
3015public BoundReadOnlySpanFromArray Update(BoundExpression operand, MethodSymbol conversionMethod, TypeSymbol type)
3095public BoundFixedLocalCollectionInitializer(SyntaxNode syntax, TypeSymbol elementPointerType, BoundValuePlaceholder? elementPointerPlaceholder, BoundExpression? elementPointerConversion, BoundExpression expression, MethodSymbol? getPinnableOpt, TypeSymbol type, bool hasErrors = false)
3115public MethodSymbol? GetPinnableOpt { get; }
3120public BoundFixedLocalCollectionInitializer Update(TypeSymbol elementPointerType, BoundValuePlaceholder? elementPointerPlaceholder, BoundExpression? elementPointerConversion, BoundExpression expression, MethodSymbol? getPinnableOpt, TypeSymbol type)
5385public BoundDagDeconstructEvaluation(SyntaxNode syntax, MethodSymbol deconstructMethod, BoundDagTemp input, bool hasErrors = false)
5395public MethodSymbol DeconstructMethod { get; }
5400public BoundDagDeconstructEvaluation Update(MethodSymbol deconstructMethod, BoundDagTemp input)
5894public BoundDynamicInvocation(SyntaxNode syntax, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false)
5911public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
5916public BoundDynamicInvocation Update(ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type)
5963public BoundLoweredConditionalAccess(SyntaxNode syntax, BoundExpression receiver, MethodSymbol? hasValueMethodOpt, BoundExpression whenNotNull, BoundExpression? whenNullOpt, int id, bool forceCopyOfNullableValueType, TypeSymbol type, bool hasErrors = false)
5981public MethodSymbol? HasValueMethodOpt { get; }
5990public BoundLoweredConditionalAccess Update(BoundExpression receiver, MethodSymbol? hasValueMethodOpt, BoundExpression whenNotNull, BoundExpression? whenNullOpt, int id, bool forceCopyOfNullableValueType, TypeSymbol type)
6075public 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)
6093public ImmutableArray<MethodSymbol> Methods { get; }
6102public BoundMethodGroup Update(ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, string name, ImmutableArray<MethodSymbol> methods, Symbol? lookupSymbolOpt, DiagnosticInfo? lookupError, BoundMethodGroupFlags? flags, FunctionTypeSymbol? functionType, BoundExpression? receiverOpt, LookupResultKind resultKind)
6144public 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)
6170public MethodSymbol Method { get; }
6180public ImmutableArray<MethodSymbol> OriginalMethodsOpt { get; }
6185public 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)
6238public 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)
6257public MethodSymbol? Constructor { get; }
6269public BoundAttribute Update(MethodSymbol? constructor, ImmutableArray<BoundExpression> constructorArguments, ImmutableArray<string?> constructorArgumentNamesOpt, ImmutableArray<int> constructorArgumentsToParamsOpt, bool constructorExpanded, BitVector constructorDefaultArguments, ImmutableArray<BoundAssignmentOperator> namedArguments, LookupResultKind resultKind, TypeSymbol type)
6342public 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)
6364public override MethodSymbol Constructor { get; }
6365public ImmutableArray<MethodSymbol> ConstructorsGroup { get; }
6379public 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)
6434public BoundCollectionExpression(SyntaxNode syntax, CollectionExpressionTypeKind collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundValuePlaceholder? collectionBuilderInvocationPlaceholder, BoundExpression? collectionBuilderInvocationConversion, bool wasTargetTyped, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type, bool hasErrors = false)
6456public MethodSymbol? CollectionBuilderMethod { get; }
6465public BoundCollectionExpression Update(CollectionExpressionTypeKind collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundValuePlaceholder? collectionBuilderInvocationPlaceholder, BoundExpression? collectionBuilderInvocationConversion, bool wasTargetTyped, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type)
6622public 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)
6645public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
6651public BoundDynamicObjectCreationExpression Update(string name, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, ImmutableArray<MethodSymbol> applicableMethods, bool wasTargetTyped, TypeSymbol type)
6866public 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)
6885public MethodSymbol AddMethod { get; }
6897public BoundCollectionElementInitializer Update(MethodSymbol addMethod, ImmutableArray<BoundExpression> arguments, BoundExpression? implicitReceiverOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, bool invokedAsExtensionMethod, LookupResultKind resultKind, TypeSymbol type)
6911public BoundDynamicCollectionElementInitializer(SyntaxNode syntax, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false)
6924public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
6929public BoundDynamicCollectionElementInitializer Update(ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type)
6978public BoundAnonymousObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<BoundAnonymousPropertyDeclaration> declarations, TypeSymbol type, bool hasErrors = false)
6993public MethodSymbol Constructor { get; }
7000public BoundAnonymousObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<BoundAnonymousPropertyDeclaration> declarations, TypeSymbol type)
7084public BoundDelegateCreationExpression(SyntaxNode syntax, BoundExpression argument, MethodSymbol? methodOpt, bool isExtensionMethod, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false)
7099public MethodSymbol? MethodOpt { get; }
7106public BoundDelegateCreationExpression Update(BoundExpression argument, MethodSymbol? methodOpt, bool isExtensionMethod, bool wasTargetTyped, TypeSymbol type)
8148public 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)
8167public MethodSymbol? DeconstructMethod { get; }
8175public BoundRecursivePattern Update(BoundTypeExpression? declaredType, MethodSymbol? deconstructMethod, ImmutableArray<BoundPositionalSubpattern> deconstruction, ImmutableArray<BoundPropertySubpattern> properties, bool isExplicitNotNullTest, Symbol? variable, BoundExpression? variableAccess, TypeSymbol inputType, TypeSymbol narrowedType)
8272public BoundITuplePattern(SyntaxNode syntax, MethodSymbol getLengthMethod, MethodSymbol getItemMethod, ImmutableArray<BoundPositionalSubpattern> subpatterns, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false)
8291public MethodSymbol GetLengthMethod { get; }
8292public MethodSymbol GetItemMethod { get; }
8298public BoundITuplePattern Update(MethodSymbol getLengthMethod, MethodSymbol getItemMethod, ImmutableArray<BoundPositionalSubpattern> subpatterns, TypeSymbol inputType, TypeSymbol narrowedType)
8828public BoundWithExpression(SyntaxNode syntax, BoundExpression receiver, MethodSymbol? cloneMethod, BoundObjectInitializerExpressionBase initializerExpression, TypeSymbol type, bool hasErrors = false)
8843public MethodSymbol? CloneMethod { get; }
8849public BoundWithExpression Update(BoundExpression receiver, MethodSymbol? cloneMethod, BoundObjectInitializerExpressionBase initializerExpression, TypeSymbol type)
12546MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12548ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12566MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12568ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12624MethodSymbol targetMethod = GetUpdatedSymbol(node, node.TargetMethod);
12695MethodSymbol? getTypeFromHandle = GetUpdatedSymbol(node, node.GetTypeFromHandle);
12747MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12765MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12802ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12991MethodSymbol? getResult = GetUpdatedSymbol(node, node.GetResult);
13017MethodSymbol? getTypeFromHandle = GetUpdatedSymbol(node, node.GetTypeFromHandle);
13035MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13184MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13185MethodSymbol? getMethodFromHandle = GetUpdatedSymbol(node, node.GetMethodFromHandle);
13203MethodSymbol? getFieldFromHandle = GetUpdatedSymbol(node, node.GetFieldFromHandle);
13304ImmutableArray<MethodSymbol> originalUserDefinedConversionsOpt = GetUpdatedArray(node, node.OriginalUserDefinedConversionsOpt);
13322MethodSymbol conversionMethod = GetUpdatedSymbol(node, node.ConversionMethod);
13370MethodSymbol? getPinnableOpt = GetUpdatedSymbol(node, node.GetPinnableOpt);
13712MethodSymbol deconstructMethod = GetUpdatedSymbol(node, node.DeconstructMethod);
13842ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
13879MethodSymbol? hasValueMethodOpt = GetUpdatedSymbol(node, node.HasValueMethodOpt);
13929ImmutableArray<MethodSymbol> methods = GetUpdatedArray(node, node.Methods);
13967MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13968ImmutableArray<MethodSymbol> originalMethodsOpt = GetUpdatedArray(node, node.OriginalMethodsOpt);
14006MethodSymbol? constructor = GetUpdatedSymbol(node, node.Constructor);
14042MethodSymbol constructor = GetUpdatedSymbol(node, node.Constructor);
14043ImmutableArray<MethodSymbol> constructorsGroup = GetUpdatedArray(node, node.ConstructorsGroup);
14079MethodSymbol? collectionBuilderMethod = GetUpdatedSymbol(node, node.CollectionBuilderMethod);
14149ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14257MethodSymbol addMethod = GetUpdatedSymbol(node, node.AddMethod);
14276ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14307MethodSymbol constructor = GetUpdatedSymbol(node, node.Constructor);
14360MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
14774MethodSymbol? deconstructMethod = GetUpdatedSymbol(node, node.DeconstructMethod);
14812MethodSymbol getLengthMethod = GetUpdatedSymbol(node, node.GetLengthMethod);
14813MethodSymbol getItemMethod = GetUpdatedSymbol(node, node.GetItemMethod);
14977MethodSymbol? 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;
160MethodSymbol method,
162MethodSymbol substitutedSourceMethod,
203(localOrParameter as MethodSymbol)?.MethodKind == MethodKind.LocalFunction);
230MethodSymbol method,
232MethodSymbol substitutedSourceMethod,
318protected override MethodSymbol CurrentMethod
373var containingMethod = scope.ContainingFunctionOpt?.OriginalMethodSymbol ?? _topLevelMethod;
409var originalMethod = nestedFunction.OriginalMethodSymbol;
527var containingMethod = isNonGeneric ? null : (_substitutedSourceMethod ?? _topLevelMethod);
676MethodSymbol constructor = frame.Constructor.AsMember(frameType);
858var loweredSymbol = (node.Method.MethodKind is MethodKind.LambdaMethod or MethodKind.LocalFunction) ?
870MethodSymbol localFunc,
872out MethodSymbol method,
1012MethodSymbol originalMethod,
1015ref MethodSymbol synthesizedMethod,
1083out var method,
1347out var method,
1374out MethodSymbol remappedMethod,
1557var oldMethod = _currentMethod;
1604private void AddSynthesizedMethod(MethodSymbol method, BoundStatement body)
1648MethodSymbol referencedMethod = synthesizedMethod;
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (9)
385private static WellKnownMember GetBinaryOperatorFactory(BinaryOperatorKind opKind, MethodSymbol methodOpt, out bool isChecked, out bool isLifted, out bool requiresLifted)
481static bool useCheckedFactory(bool isChecked, MethodSymbol methodOpt)
487private BoundExpression VisitBinaryOperator(BinaryOperatorKind opKind, MethodSymbol methodOpt, TypeSymbol type, BoundExpression left, BoundExpression right)
567private BoundExpression MakeBinary(MethodSymbol methodOpt, TypeSymbol type, bool isLifted, bool requiresLifted, WellKnownMember opFactory, BoundExpression loweredLeft, BoundExpression loweredRight)
646var method = node.Method;
699var method = node.SymbolOpt;
757private BoundExpression DelegateCreation(BoundExpression receiver, MethodSymbol method, TypeSymbol delegateType, bool requiresInstanceReceiver)
762var createDelegate = _bound.WellKnownMethod(WellKnownMember.System_Reflection_MethodInfo__CreateDelegate, isOptional: true);
1104var getMethod = node.PropertySymbol.GetOwnOrInheritedGetMethod();
Lowering\DiagnosticsPass_ExpressionTrees.cs (12)
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)
305MethodSymbol method,
529var method = indexer.GetOwnOrInheritedGetMethod() ?? indexer.GetOwnOrInheritedSetMethod();
707var binary = node.LogicalOperator;
708var unary = node.OperatorKind.Operator() == BinaryOperatorKind.And ? node.FalseOperator : node.TrueOperator;
741if (_inExpressionLambda && node.MethodOpt is MethodSymbol method && (method.IsAbstract || method.IsVirtual) && method.IsStatic)
838if (_inExpressionLambda && node.Conversion.Method is MethodSymbol method && (method.IsAbstract || method.IsVirtual) && method.IsStatic)
871private void CheckMethodGroup(BoundMethodGroup node, MethodSymbol method, bool isExtensionMethod, bool parentIsConversion, TypeSymbol convertedToType)
880if ((node.LookupSymbolOpt as MethodSymbol)?.MethodKind == MethodKind.LocalFunction)
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 (14)
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);
312var parameterLogger = GetLocalOrParameterStoreLogger(parameter.Type, parameter, refAssignmentSourceIsLocal: null, _factory.Syntax);
343var entryLogger = GetWellKnownMethodSymbol(entryOverload, _factory.Syntax);
347var returnLogger = GetWellKnownMethodSymbol(WellKnownMember.Microsoft_CodeAnalysis_Runtime_LocalStoreTracker__LogReturn, _factory.Syntax);
394var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal, original.Syntax);
464var toStringMethod = GetSpecialMethodSymbol(SpecialMember.System_Object__ToString, value.Syntax);
525var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, original.Syntax);
589var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, invocation.Syntax);
Lowering\LocalRewriter\DelegateCacheContainer.cs (7)
18private readonly Dictionary<(TypeSymbol?, TypeSymbol, MethodSymbol), FieldSymbol> _delegateFields = new(CLRSignatureComparer.Instance);
30internal DelegateCacheContainer(MethodSymbol ownerMethod, int topLevelMethodOrdinal, int ownerUniqueId, int generationOrdinal)
56var targetMethod = boundDelegateCreation.MethodOpt;
87private sealed class CLRSignatureComparer : IEqualityComparer<(TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod)>
91public bool Equals((TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) x, (TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) y)
100public int GetHashCode((TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) conversion)
Lowering\LocalRewriter\LocalRewriter.cs (15)
57MethodSymbol containingMethod,
86MethodSymbol method,
333delegateType.DelegateInvokeMethod() is MethodSymbol delegateInvoke &&
354var oldContainingSymbol = _factory.CurrentFunction;
419var oldContainingSymbol = _factory.CurrentFunction;
606/// Recommendation: Do not use, use <see cref="TryGetSpecialTypeMethod(SyntaxNode, SpecialMember, out MethodSymbol, bool)"/> instead!
609private MethodSymbol UnsafeGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember)
616/// Recommendation: Do not use, use <see cref="TryGetSpecialTypeMethod(SyntaxNode, SpecialMember, CSharpCompilation, BindingDiagnosticBag, out MethodSymbol, bool)"/> instead!
619private static MethodSymbol UnsafeGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, CSharpCompilation compilation, BindingDiagnosticBag diagnostics)
621MethodSymbol method;
636private bool TryGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, out MethodSymbol method, bool isOptional = false)
641private static bool TryGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, CSharpCompilation compilation, BindingDiagnosticBag diagnostics, out MethodSymbol method, bool isOptional = false)
657MethodSymbol? getTypeFromHandle;
687MethodSymbol? getTypeFromHandle;
1125private void CheckRefReadOnlySymbols(MethodSymbol symbol)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (23)
180MethodSymbol? method,
196MethodSymbol? method,
537private BoundExpression RewriteLiftedBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt)
600MethodSymbol? leftTruthOperator,
725private BoundExpression MakeTruthTestForDynamicLogicalOperator(SyntaxNode syntax, BoundExpression loweredLeft, TypeSymbol boolean, MethodSymbol? leftTruthOperator, TypeSymbol? constrainedToTypeOpt, bool negative)
747return new BoundUnaryOperator(syntax, UnaryOperatorKind.BoolLogicalNegation, converted, ConstantValue.NotAvailable, MethodSymbol.None, constrainedToTypeOpt: null, LookupResultKind.Viable, boolean)
773MethodSymbol? method,
800MethodSymbol? method,
1130MethodSymbol? method,
1299MethodSymbol? method,
1339MethodSymbol? method,
1408MethodSymbol? method,
1510MethodSymbol? method,
1836MethodSymbol getValueOrDefaultX = UnsafeGetNullableMethod(syntax, boundTempX.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1837MethodSymbol getValueOrDefaultY = UnsafeGetNullableMethod(syntax, boundTempY.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1894private MethodSymbol UnsafeGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member)
1904internal static MethodSymbol UnsafeGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member, CSharpCompilation compilation, BindingDiagnosticBag diagnostics)
1911private bool TryGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member, out MethodSymbol result, bool isOptional = false)
2002var method = UnsafeGetSpecialTypeMethod(syntax, member);
2010MethodSymbol method;
2013method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member);
2016(object)(method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member)) == null)
2063var method = UnsafeGetSpecialTypeMethod(syntax, member);
Lowering\LocalRewriter\LocalRewriter_Call.cs (12)
97private void EmbedIfNeedTo(BoundExpression receiver, ImmutableArray<MethodSymbol> methods, SyntaxNode syntaxNode)
108foreach (var m in methods)
136ref MethodSymbol method,
187var containingMethod = this._factory.CurrentFunction;
203var symbolForCompare = needToReduce ? ReducedExtensionMethodSymbol.Create(interceptor, receiverOpt!.Type, _compilation, out _) : interceptor;
383MethodSymbol method = node.Method;
441MethodSymbol method,
522private BoundExpression MakeCall(SyntaxNode syntax, BoundExpression? rewrittenReceiver, MethodSymbol method, ImmutableArray<BoundExpression> rewrittenArguments)
665var requiresInstanceReceiver = methodOrIndexer.RequiresInstanceReceiver() && methodOrIndexer is not MethodSymbol { MethodKind: MethodKind.Constructor } and not FunctionPointerMethodSymbol;
1233((MethodSymbol)methodOrIndexer).Parameters[0].Type as NamedTypeSymbol :
1426MethodSymbol? arrayEmpty = _compilation.GetSpecialTypeMember(SpecialMember.System_Array__Empty) as MethodSymbol;
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (46)
79if (_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_ImmutableCollectionsMarshal__AsImmutableArray_T) is MethodSymbol asImmutableArray &&
106var addMethod = (MethodSymbol?)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__Add);
114static bool canOptimizeListElement(BoundNode element, MethodSymbol addMethod)
169if (!TryGetWellKnownTypeMember(node.Syntax, WellKnownMember.System_Linq_Enumerable__ToList, out MethodSymbol? toListGeneric, isOptional: true))
191private bool ShouldUseIEnumerableBulkAddMethod(TypeSymbol spreadType, TypeSymbol targetEnumerableType, MethodSymbol? getEnumeratorMethod)
235private BoundExpression VisitImmutableArrayCollectionExpression(BoundCollectionExpression node, TypeWithAnnotations elementType, MethodSymbol asImmutableArray)
255MethodSymbol? spanConstructor = null;
279var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_ReadOnlySpan_T__ctor_Array)).AsMember(spanType);
297spanConstructor = ((MethodSymbol)_factory.WellKnownMember(
319var listToArray = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ToArray)).AsMember((NamedTypeSymbol)list.Type);
478var constructMethod = node.CollectionBuilderMethod;
557: WellKnownMember.System_Span_T__ctor_ref_T, isOptional: true) is MethodSymbol spanRefConstructor)
563var constructor = spanRefConstructor.AsMember(spanType);
575MethodSymbol elementRef = _factory.ModuleBuilderOpt.EnsureInlineArrayElementRefExists(syntax, intType, _diagnostics.DiagnosticBag).
602MethodSymbol inlineArrayAsSpan = asReadOnlySpan ?
668&& tryGetToArrayMethod(spreadTypeOriginalDefinition, WellKnownType.System_Collections_Generic_List_T, WellKnownMember.System_Collections_Generic_List_T__ToArray, out MethodSymbol? listToArrayMethod))
688&& TryGetSpanConversion(spreadExpression.Type, writableOnly: false, out var asSpanMethod))
691if (tryGetToArrayMethod(spanType, WellKnownType.System_ReadOnlySpan_T, WellKnownMember.System_ReadOnlySpan_T__ToArray, out var toArrayMethod)
699bool tryGetToArrayMethod(TypeSymbol spreadTypeOriginalDefinition, WellKnownType wellKnownType, WellKnownMember wellKnownMember, [NotNullWhen(true)] out MethodSymbol? toArrayMethod)
856private bool TryGetSpanConversion(TypeSymbol type, bool writableOnly, out MethodSymbol? asSpanMethod)
906if (!TryGetSpanConversion(type, writableOnly, out var asSpanMethod))
916private BoundExpression CallAsSpanMethod(BoundExpression spreadExpression, MethodSymbol? asSpanMethod)
922if (asSpanMethod is MethodSymbol { MethodKind: MethodKind.Constructor } constructor)
926else if (asSpanMethod is MethodSymbol { IsStatic: true, ParameterCount: 1 })
940private (MethodSymbol spanSliceMethod, BoundExpression spreadElementAsSpan, MethodSymbol getLengthMethod, MethodSymbol copyToMethod)? PrepareCopyToOptimization(
965(MethodSymbol getLengthMethod, MethodSymbol copyToMethod)? getSpanMethodsForSpread(
987MethodSymbol spanSliceMethod,
989MethodSymbol getLengthMethod,
990MethodSymbol copyToMethod)
1036MethodSymbol? setCount = null;
1037MethodSymbol? asSpan = null;
1042setCount = ((MethodSymbol?)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_CollectionsMarshal__SetCount_T))?.Construct(typeArguments);
1043asSpan = ((MethodSymbol?)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_CollectionsMarshal__AsSpan_T))?.Construct(typeArguments);
1058var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ctorInt32)).AsMember(collectionType);
1082var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ctor)).AsMember(collectionType);
1108var spanGetItem = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Span_T__get_Item)).AsMember((NamedTypeSymbol)spanTemp.Type);
1162var addMethod = _factory.WellKnownMethod(WellKnownMember.System_Collections_Generic_List_T__Add).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);
656MethodSymbol implicitOperator = implicitOperatorDefinition.AsMember((NamedTypeSymbol)sourceType);
669MethodSymbol castUpMethod = castUpMethodDefinition.AsMember(destinationType).Construct([sourceElementType]);
690MethodSymbol method = methodDefinition.AsMember(destinationType).Construct([sourceElementType]);
745delegateType.DelegateInvokeMethod() is MethodSymbol delegateInvoke &&
1064MethodSymbol ctor = UnsafeGetNullableMethod(syntax, rewrittenType, SpecialMember.System_Nullable_T__ctor);
1080MethodSymbol get_Value = UnsafeGetNullableMethod(syntax, rewrittenOperandType, SpecialMember.System_Nullable_T_get_Value);
1126if (!TryGetSpecialTypeMethod(syntax, DecimalConversionMethod(typeFromUnderlying, typeToUnderlying), out MethodSymbol method))
1167MethodSymbol getValueOrDefault;
1384MethodSymbol ctor = UnsafeGetNullableMethod(call.Syntax, resultType, SpecialMember.System_Nullable_T__ctor);
1435MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, boundTemp.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1497MethodSymbol method;
1730if (!TryGetSpecialTypeMethod(syntax, member, out MethodSymbol method))
1760var meth = conversion.Method;
1792MethodSymbol method;
1806MethodSymbol method;
1823MethodSymbol method;
1836MethodSymbol method;
1864private Conversion TryMakeUserDefinedConversion(SyntaxNode syntax, MethodSymbol meth, TypeSymbol fromType, TypeSymbol toType, bool @checked, bool isImplicit)
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (21)
60else if (node.AwaitOpt is null && CanRewriteForEachAsFor(node.Syntax, nodeExpressionType, out var indexerGet, out var lengthGetter))
70private bool CanRewriteForEachAsFor(SyntaxNode forEachSyntax, TypeSymbol nodeExpressionType, [NotNullWhen(true)] out MethodSymbol? indexerGet, [NotNullWhen(true)] out MethodSymbol? lengthGet)
83lengthGet = (MethodSymbol?)_factory.WellKnownMember(WellKnownMember.System_Span_T__get_Length, isOptional: true)?.SymbolAsMember(spanType);
84indexerGet = (MethodSymbol?)_factory.WellKnownMember(WellKnownMember.System_Span_T__get_Item, isOptional: true)?.SymbolAsMember(spanType);
89lengthGet = (MethodSymbol?)_factory.WellKnownMember(WellKnownMember.System_ReadOnlySpan_T__get_Length, isOptional: true)?.SymbolAsMember(spanType);
90indexerGet = (MethodSymbol?)_factory.WellKnownMember(WellKnownMember.System_ReadOnlySpan_T__get_Item, isOptional: true)?.SymbolAsMember(spanType);
290private bool TryGetDisposeMethod(SyntaxNode forEachSyntax, ForEachEnumeratorInfo enumeratorInfo, out MethodSymbol disposeMethod)
294disposeMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_compilation, WellKnownMember.System_IAsyncDisposable__DisposeAsync, _diagnostics, syntax: forEachSyntax);
324MethodSymbol? disposeMethod = enumeratorInfo.PatternDisposeInfo?.Method; // pattern-based
495private BoundExpression ConvertReceiverForInvocation(CSharpSyntaxNode syntax, BoundExpression receiver, MethodSymbol method, Conversion receiverConversion, TypeSymbol convertedReceiverType)
711private BoundStatement RewriteForEachStatementAsFor(BoundForEachStatement node, MethodSymbol indexerGet, MethodSymbol lengthGet)
715getItem: static (LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, BoundLocal boundArrayVar, BoundLocal boundPositionVar, (MethodSymbol indexerGet, MethodSymbol lengthGet) arg) =>
724getLength: static (LocalRewriter rewriter, SyntaxNode syntax, BoundLocal boundArrayVar, (MethodSymbol indexerGet, MethodSymbol lengthGet) arg) =>
769MethodSymbol elementRef;
1067MethodSymbol getLowerBoundMethod = UnsafeGetSpecialTypeMethod(forEachSyntax, SpecialMember.System_Array__GetLowerBound);
1068MethodSymbol getUpperBoundMethod = UnsafeGetSpecialTypeMethod(forEachSyntax, SpecialMember.System_Array__GetUpperBound);
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (11)
156var getMethod = indexer.GetOwnOrInheritedGetMethod();
215var getItemOrSliceHelper = (MethodSymbol?)_compilation.GetWellKnownTypeMember(node.GetItemOrSliceHelper);
243MethodSymbol createSpan = getCreateSpanHelper(node, spanType: getItemOrSliceHelper.ContainingType, intType: (NamedTypeSymbol)getItemOrSliceHelper.Parameters[0].Type);
321MethodSymbol getCreateSpanHelper(BoundInlineArrayAccess node, NamedTypeSymbol spanType, NamedTypeSymbol intType)
325MethodSymbol createSpan;
338BoundExpression getElementRef(BoundInlineArrayAccess node, BoundExpression rewrittenReceiver, BoundExpression index, MethodSymbol getItemOrSliceHelper, int length)
350MethodSymbol elementRef;
369MethodSymbol elementRef;
392MethodSymbol createSpan = getCreateSpanHelper(node, spanType, intType);
729else 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 (18)
172var method = boundCall.Method;
374var method = UnsafeGetSpecialTypeMethod(syntax, SpecialMember.System_String__ConcatStringString);
386var method = UnsafeGetSpecialTypeMethod(syntax, SpecialMember.System_String__ConcatStringStringString);
399var method = UnsafeGetSpecialTypeMethod(syntax, SpecialMember.System_String__ConcatStringStringStringString);
410var method = UnsafeGetSpecialTypeMethod(syntax, SpecialMember.System_String__ConcatStringArray);
476if (TryGetSpecialTypeMethod(syntax, concatMember, out MethodSymbol? spanConcat, isOptional: true) &&
477tryGetNeededToSpanMembers(this, syntax, needsImplicitConversionFromStringToSpan, charType, out MethodSymbol? readOnlySpanCtorRefParamChar, out MethodSymbol? stringImplicitConversionToReadOnlySpan))
499[NotNullWhen(true)] out MethodSymbol? readOnlySpanCtorRefParamChar,
500out MethodSymbol? stringImplicitConversionToReadOnlySpan)
505if (self.TryGetSpecialTypeMethod(syntax, SpecialMember.System_ReadOnlySpan_T__ctor_Reference, out MethodSymbol? readOnlySpanCtorRefParamGeneric, isOptional: true) &&
527MethodSymbol spanConcat,
528MethodSymbol? stringImplicitConversionToReadOnlySpan,
529MethodSymbol readOnlySpanCtorRefParamChar,
599var method = UnsafeGetSpecialTypeMethod(syntax, member);
658var objectToStringMethod = UnsafeGetSpecialTypeMethod(syntax, SpecialMember.System_Object__ToString);
662MethodSymbol? structToStringMethod = null;
669if (member is MethodSymbol toStringMethod &&
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (18)
65MethodSymbol? method,
77MethodSymbol? method,
166method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(SpecialMember.System_Decimal__op_UnaryNegation);
181MethodSymbol? method,
204MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, boundTemp.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
245MethodSymbol? method,
353private BoundExpression GetLiftedUnaryOperatorConsequence(UnaryOperatorKind kind, SyntaxNode syntax, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt, TypeSymbol type, BoundExpression nonNullOperand)
355MethodSymbol ctor = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T__ctor);
671MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T_GetValueOrDefault);
672MethodSymbol ctor = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T__ctor);
755MethodSymbol ctor = UnsafeGetNullableMethod(node.Syntax, binaryOperandType, SpecialMember.System_Nullable_T__ctor);
807private MethodSymbol GetDecimalIncDecOperator(BinaryOperatorKind oper)
818var method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member);
827MethodSymbol method = GetDecimalIncDecOperator(oper);
836MethodSymbol method = GetDecimalIncDecOperator(oper);
837MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
838MethodSymbol ctor = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T__ctor);
Lowering\SyntheticBoundNodeFactory.cs (45)
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)
275var accessor = property.GetOwnOrInheritedGetMethod();
283var accessor = property.GetOwnOrInheritedGetMethod();
333public MethodSymbol? WellKnownMethod(WellKnownMember wm, bool isOptional)
335return (MethodSymbol?)WellKnownMember(wm, isOptional);
338public MethodSymbol WellKnownMethod(WellKnownMember wm)
340return (MethodSymbol)WellKnownMember(wm, isOptional: false)!;
391public MethodSymbol SpecialMethod(SpecialMember sm)
393var result = (MethodSymbol?)SpecialMember(sm, isOptional: false);
398public MethodSymbol? SpecialMethod(SpecialMember sm, bool isOptional)
400return (MethodSymbol?)SpecialMember(sm, isOptional);
624public ParameterSymbol SynthesizedParameter(TypeSymbol type, string name, MethodSymbol? container = null, int ordinal = 0)
733var ctor = type.InstanceConstructors.Single(c => c.ParameterCount == args.Length);
737public BoundObjectCreationExpression New(MethodSymbol ctor, params BoundExpression[] args)
742var ctor = type.InstanceConstructors.Single(c => c.ParameterCount == args.Length);
746public BoundObjectCreationExpression New(MethodSymbol ctor, ImmutableArray<BoundExpression> args)
749public BoundObjectCreationExpression New(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKinds)
766var ctor = WellKnownMethod(wm);
785public BoundExpression StaticCall(TypeSymbol receiver, MethodSymbol method, params BoundExpression[] args)
795public BoundExpression StaticCall(MethodSymbol method, ImmutableArray<BoundExpression> args)
800MethodSymbol methodSymbol = WellKnownMethod(method);
808MethodSymbol methodSymbol = WellKnownMethod(method);
819MethodSymbol methodSymbol = SpecialMethod(method);
824public BoundCall Call(BoundExpression? receiver, MethodSymbol method)
829public BoundCall Call(BoundExpression? receiver, MethodSymbol method, BoundExpression arg0, bool useStrictArgumentRefKinds = false)
834public BoundCall Call(BoundExpression? receiver, MethodSymbol method, BoundExpression arg0, BoundExpression arg1, bool useStrictArgumentRefKinds = false)
839public BoundCall Call(BoundExpression? receiver, MethodSymbol method, params BoundExpression[] args)
847public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<BoundExpression> args, bool useStrictArgumentRefKinds = false)
858static ImmutableArray<RefKind> getArgumentRefKinds(MethodSymbol method, bool useStrictArgumentRefKinds)
884public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<RefKind> refKinds, ImmutableArray<BoundExpression> args)
1188var ctor = baseType.InstanceConstructors.Single(c => c.ParameterCount == 0);
1253MethodSymbol getTypeFromHandle;
1295internal BoundExpression ConstructorInfo(MethodSymbol ctor)
1313public BoundExpression MethodDefIndex(MethodSymbol method)
1395public BoundExpression MethodInfo(MethodSymbol method, TypeSymbol systemReflectionMethodInfo)
1430private MethodSymbol GetMethodFromHandleMethod(NamedTypeSymbol methodContainer, TypeSymbol systemReflectionMethodOrConstructorInfo)
1454private MethodSymbol GetFieldFromHandleMethod(NamedTypeSymbol fieldContainer)
1535MethodSymbol? arrayEmpty = SpecialMethod(CodeAnalysis.SpecialMember.System_Array__Empty, isOptional: true);
1644MethodSymbol? containingMethod = this.CurrentFunction;
Symbols\Compilation_WellKnownMembers.cs (13)
75/// <see cref="MethodSymbol.AsMember"/> to construct an instantiation.
245internal static Symbol? GetRuntimeMember(NamedTypeSymbol declaringType, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
251internal static Symbol? GetRuntimeMember(ImmutableArray<Symbol> members, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
305MethodSymbol method = (MethodSymbol)member;
394var ctorSymbol = (MethodSymbol)Binder.GetWellKnownTypeMember(this, constructor, useSiteInfo: out _, isOptional: true);
441var ctorSymbol = (MethodSymbol)this.GetSpecialTypeMember(constructor);
1061internal class SpecialMembersSignatureComparer : SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol>
1131protected override ImmutableArray<ParameterSymbol> GetParameters(MethodSymbol method)
1151protected override TypeSymbol GetReturnType(MethodSymbol method)
1175protected override bool IsByRefMethod(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 (9)
1234else if (this.ContainingSymbol is MethodSymbol method &&
1351if (!ContainingSymbol.RequiresInstanceReceiver() || ContainingSymbol is MethodSymbol { MethodKind: MethodKind.Constructor or MethodKind.DelegateInvoke or MethodKind.LambdaMethod })
1584if (!binder.HasCollectionExpressionApplicableConstructor(syntax, Type, out MethodSymbol? constructor, isExpanded: out _, diagnostics, isParamsModifierValidation: true))
1594if (!binder.HasCollectionExpressionApplicableAddMethod(syntax, Type, out ImmutableArray<MethodSymbol> addMethods, diagnostics))
1608MethodSymbol? reportAsLessVisible = null;
1610foreach (var addMethod in addMethods)
1643MethodSymbol? collectionBuilderMethod = binder.GetAndValidateCollectionBuilderMethod(syntax, (NamedTypeSymbol)Type, diagnostics, elementType: out _);
1665bool isAtLeastAsVisible(ParameterSyntax syntax, Binder binder, MethodSymbol method, BindingDiagnosticBag diagnostics)
1676void checkIsAtLeastAsVisible(ParameterSyntax syntax, Binder binder, MethodSymbol method, BindingDiagnosticBag diagnostics)
Symbols\Source\SourceMemberContainerSymbol.cs (71)
1592WhereAsArray(s => !s.IsIndexer() && (!s.IsAccessor() || ((MethodSymbol)s).AssociatedSymbol?.IsIndexer() != true)));
2448if (member.Kind != SymbolKind.Method || ((MethodSymbol)member).MethodKind != MethodKind.Destructor)
2497var ops1 = ArrayBuilder<MethodSymbol>.GetInstance();
2502var ops2 = ArrayBuilder<MethodSymbol>.GetInstance();
2510var ops2 = ArrayBuilder<MethodSymbol>.GetInstance();
2520static void reportOperatorNeedsMatch(BindingDiagnosticBag diagnostics, string operatorName2, MethodSymbol op1)
2527static void reportCheckedOperatorNeedsMatch(BindingDiagnosticBag diagnostics, string operatorName2, MethodSymbol op1)
2535ArrayBuilder<MethodSymbol> ops1,
2536ArrayBuilder<MethodSymbol> ops2,
2538Action<BindingDiagnosticBag, string, MethodSymbol> reportMatchNotFoundError)
2559internal static bool DoOperatorsPair(MethodSymbol op1, MethodSymbol op2)
2597var ops = ArrayBuilder<MethodSymbol>.GetInstance();
2652if (member is not MethodSymbol method || !method.ShouldCheckRequiredMembers())
2679foreach (var method in this.GetMembers(name).OfType<MethodSymbol>())
3399!(member is MethodSymbol method && MethodCompiler.GetMethodToCompile(method) is SourceMemberMethodSymbol sourceMethod))
3699(prevMethod.IsPartialImplementation || (prevMethod.OtherPartOfPartial is MethodSymbol otherImplementation && (object)otherImplementation != currentMethod)))
3705(prevMethod.IsPartialDefinition || (prevMethod.OtherPartOfPartial is MethodSymbol otherDefinition && (object)otherDefinition != currentMethod)))
3853MethodSymbol accessor = getNotSet ? propertySymbol.GetMethod : propertySymbol.SetMethod;
3878var methodSymbol = (MethodSymbol)symbol;
3914var methodSymbol = (MethodSymbol)symbol;
4067var meth = (MethodSymbol)member;
4113var m = s as MethodSymbol;
4158if (hasInitializers && !builder.NonTypeMembers.Any(member => member is MethodSymbol { MethodKind: MethodKind.Constructor }))
4210case MethodSymbol { MethodKind: not (MethodKind.Ordinary or MethodKind.Constructor) }:
4261var thisEquals = addThisEquals(equalityContract);
4269var getHashCode = addGetHashCode(equalityContract);
4277var printMembers = addPrintMembersMethod(membersSoFar);
4315ImmutableArray<MethodSymbol>.Empty);
4323var deconstruct = (MethodSymbol)existingDeconstructMethod;
4363ImmutableArray<MethodSymbol>.Empty);
4377var constructor = (MethodSymbol)existingConstructor;
4392MethodSymbol addPrintMembersMethod(IEnumerable<Symbol> userDefinedMembers)
4411explicitInterfaceImplementations: ImmutableArray<MethodSymbol>.Empty);
4413MethodSymbol printMembersMethod;
4421printMembersMethod = (MethodSymbol)existingPrintMembersMethod;
4452void addToStringMethod(MethodSymbol printMethod)
4466explicitInterfaceImplementations: ImmutableArray<MethodSymbol>.Empty);
4468var baseToStringMethod = getBaseToStringMethod();
4495var toStringMethod = (MethodSymbol)existingToStringMethod;
4506MethodSymbol? getBaseToStringMethod()
4514if (member is not MethodSymbol method)
4621void addObjectEquals(MethodSymbol thisEquals)
4626MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
4640ImmutableArray<MethodSymbol>.Empty);
4642MethodSymbol getHashCode;
4651getHashCode = (MethodSymbol)existingHashCodeMethod;
4719MethodSymbol addThisEquals(PropertySymbol? equalityContract)
4739ImmutableArray<MethodSymbol>.Empty);
4741MethodSymbol thisEquals;
4750thisEquals = (MethodSymbol)existingEqualsMethod;
4813var method = (MethodSymbol)member;
5269private void AddAccessorIfAvailable(ArrayBuilder<Symbol> symbols, MethodSymbol? accessorOpt)
5425if (member is MethodSymbol { MethodKind: MethodKind.Ordinary })
5441ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)>.Empty);
5444public readonly ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> MethodImpls;
5448ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> methodImpls)
5456ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> methodImpls)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (60)
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;
535var method = (MethodSymbol)member;
536if (MethodSymbol.CanOverrideOrHide(method.MethodKind) && !method.IsAccessor())
557MethodSymbol overridden = method.GetFirstRuntimeOverriddenMethodIgnoringNewSlot(out _);
571var getMethod = property.GetMethod;
572var setMethod = property.SetMethod;
612var addMethod = @event.AddMethod;
613var removeMethod = @event.RemoveMethod;
703if (hiddenMember.Kind == SymbolKind.Method && !((MethodSymbol)hiddenMember).CanBeHiddenByMemberKind(symbol.Kind))
781associatedPropertyOrEvent = ((MethodSymbol)overridingMember).AssociatedSymbol;
790? ((MethodSymbol)overridingMember).ParameterTypesWithAnnotations
854if (!this.ContainingAssembly.RuntimeSupportsCovariantReturnsOfClasses && overridingMember is MethodSymbol overridingMethod)
859var ambiguousMethod = overridingMethod.OverriddenMethod;
891!(overridingMemberIsMethod && ((MethodSymbol)overriddenMember).MethodKind == MethodKind.Destructor)) //destructors are metadata virtual
978var overridingMethod = (MethodSymbol)overridingMember;
979var overriddenMethod = (MethodSymbol)overriddenMember;
1097MethodSymbol overriddenGetMethod = overriddenProperty.GetOwnOrInheritedGetMethod();
1107var ownOrInheritedOverriddenSetMethod = overriddenProperty.GetOwnOrInheritedSetMethod();
1128MethodSymbol ownOrInheritedGetMethod = overridingProperty.GetOwnOrInheritedGetMethod();
1135MethodSymbol ownOrInheritedSetMethod = overridingProperty.GetOwnOrInheritedSetMethod();
1148MethodSymbol overriddenMethod,
1149MethodSymbol overridingMethod,
1217(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, bool topLevel, Location location)
1224(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, ParameterSymbol overridingParameter, bool topLevel, Location location)
1235MethodSymbol baseMethod,
1236MethodSymbol overrideMethod,
1376internal static bool RequiresValidScopedOverrideForRefSafety(MethodSymbol? method)
1422internal static bool ReportInvalidScopedOverrideAsError(MethodSymbol baseMethod, MethodSymbol overrideMethod)
1433MethodSymbol? baseMethod,
1434MethodSymbol? overrideMethod,
1486MethodSymbol? baseMethod,
1487MethodSymbol? overrideMethod,
1614if (hidingMember is MethodSymbol hidingMethod && hiddenMembers[0] is MethodSymbol hiddenMethod)
1674var associatedPropertyOrEvent = ((MethodSymbol)hidingMember).AssociatedSymbol;
1792private (SynthesizedExplicitImplementationForwardingMethod? ForwardingMethod, (MethodSymbol Body, MethodSymbol Implemented)? MethodImpl)
1811MethodSymbol interfaceMethod = (MethodSymbol)interfaceMember;
1812MethodSymbol implementingMethod = (MethodSymbol)implementingMember;
1822MethodSymbol implementingMethodOriginalDefinition = implementingMethod.OriginalDefinition;
1841else if (implementingMethod.IsMetadataVirtual(MethodSymbol.IsMetadataVirtualOption.IgnoreInterfaceImplementationChanges))
1894private static bool IsPossibleImplementationUnderRuntimeRules(MethodSymbol implementingMethod, NamedTypeSymbol @interface)
1918private static bool IsOverrideOfPossibleImplementationUnderRuntimeRules(MethodSymbol implementingMethod, NamedTypeSymbol @interface)
1920MethodSymbol curr = implementingMethod;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (62)
321(MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerable__GetEnumerator),
341(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__CopyTo)!,
346(PropertySymbol)((MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__get_Item)!).AssociatedSymbol,
362(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Add)!,
367(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Clear)!,
372(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Contains)!,
377(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IndexOf)!,
382(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Insert)!,
387(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Remove)!,
392(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__RemoveAt)!,
397((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerable_T__GetEnumerator)!).AsMember(iEnumerableT),
409((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyList_T__get_Item)!).AssociatedSymbol).AsMember(iReadOnlyListT),
425((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Add)!).AsMember(iCollectionT),
430((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Clear)!).AsMember(iCollectionT),
435((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Contains)!).AsMember(iCollectionT),
440((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__CopyTo)!).AsMember(iCollectionT),
445((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Remove)!).AsMember(iCollectionT),
450((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__get_Item)!).AssociatedSymbol).AsMember(iListT),
456((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__IndexOf)!).AsMember(iListT),
461((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__Insert)!).AsMember(iListT),
466((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__RemoveAt)!).AsMember(iListT),
471static BoundStatement generateGetEnumerator(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
496static BoundStatement generateCount(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
524static BoundStatement generateIsSynchronized(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
531static BoundStatement generateSyncRoot(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
541static BoundStatement generateIsFixedSize(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
548static BoundStatement generateIsReadOnly(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
555static BoundStatement generateContains(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
581var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__Contains);
591static BoundStatement generateCopyTo(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
603var arraySetValueMethod = (MethodSymbol)method.DeclaringCompilation.GetSpecialTypeMember(SpecialMember.System_Array__SetValue)!;
636var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__CopyTo);
648static BoundStatement generateIndexer(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
659var constructor = (MethodSymbol)method.DeclaringCompilation.GetWellKnownTypeMember(WellKnownMember.System_IndexOutOfRangeException__ctor)!;
675var listMember = (PropertySymbol)((MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__get_Item)).AssociatedSymbol;
682static BoundStatement generateIndexOf(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
712var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__IndexOf);
721static BoundStatement generateNotSupportedException(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
723var constructor = (MethodSymbol)method.DeclaringCompilation.GetWellKnownTypeMember(WellKnownMember.System_NotSupportedException__ctor)!;
743var equalityComparer_get_Default = f.WellKnownMethod(
745var equalityComparer_Equals = f.WellKnownMethod(
949internal override IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls() => SpecializedCollections.EmptyEnumerable<(MethodSymbol Body, MethodSymbol Implemented)>();
Symbols\TypeSymbol.cs (60)
85internal ImmutableDictionary<MethodSymbol, MethodSymbol>? synthesizedMethodImplMap;
865if (checkPendingExplicitImplementations && interfaceMember is MethodSymbol interfaceMethod &&
869MethodSymbol bodyOfSynthesizedMethodImpl = currType.GetBodyOfSynthesizedInterfaceMethodImpl(interfaceMethod);
949CheckForImplementationOfCorrespondingPropertyOrEvent((MethodSymbol)interfaceMember, implementingType, implementingTypeIsFromSomeCompilation, ref implicitImpl);
1056(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1081static bool stopLookup(MethodSymbol interfaceAccessor, TypeSymbol implementingType)
1108(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1164(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1396private static (MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) GetImplementableAccessors(Symbol interfaceMember)
1398MethodSymbol interfaceAccessor1;
1399MethodSymbol interfaceAccessor2;
1459(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1494private static bool TryGetExplicitImplementationAssociatedPropertyOrEvent(bool checkPendingExplicitImplementations, MethodSymbol interfaceAccessor, TypeSymbol currType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out Symbol associated)
1505? ((MethodSymbol)implementation).AssociatedSymbol
1514MethodSymbol bodyOfSynthesizedMethodImpl = currType.GetBodyOfSynthesizedInterfaceMethodImpl(interfaceAccessor);
1538private static void CheckForImplementationOfCorrespondingPropertyOrEvent(MethodSymbol interfaceMethod, TypeSymbol implementingType, bool implementingTypeIsFromSomeCompilation,
1558MethodSymbol correspondingImplementingAccessor = null;
1599MethodSymbol interfaceAccessorWithImplementationName = new SignatureOnlyMethodSymbol(
1675var interfaceMethod = (MethodSymbol)interfaceMember;
1689var implicitImplMethod = (MethodSymbol)implicitImpl;
1796MethodSymbol implementedMethod,
1797MethodSymbol implementingMethod,
1914var implementingGetMethod = implementedProperty.GetMethod.IsImplementable() ?
1917var implementingSetMethod = implementedProperty.SetMethod.IsImplementable() ?
1941var implementingMethod = (MethodSymbol)implementingMember;
1942var implementedMethod = (MethodSymbol)interfaceMember;
2007var method = (MethodSymbol)interfaceMember;
2027hasRefReturnMismatch = ((MethodSymbol)closestMismatch).RefKind != interfaceMemberRefKind;
2055if (!(one is MethodSymbol oneMethod))
2060if (!(other is MethodSymbol otherMethod))
2085private static bool ReportAnyMismatchedConstraints(MethodSymbol interfaceMethod, TypeSymbol implementingType, MethodSymbol implicitImpl, BindingDiagnosticBag diagnostics)
2171if (interfaceMember is MethodSymbol interfaceMethod)
2181(((MethodSymbol)member).MethodKind is MethodKind.UserDefinedOperator or MethodKind.Conversion) != isOperator.GetValueOrDefault())
2285Debug.Assert(interfaceMember.Kind != SymbolKind.Method || (object)interfaceMember == ((MethodSymbol)interfaceMember).ConstructedFrom);
2296/// <see cref="MethodSymbol.ExplicitInterfaceImplementations"/> API, this method returns the "Body" part
2304protected MethodSymbol? GetBodyOfSynthesizedInterfaceMethodImpl(MethodSymbol interfaceMethod)
2317if (info.synthesizedMethodImplMap.TryGetValue(interfaceMethod, out MethodSymbol? result))
2324ImmutableDictionary<MethodSymbol, MethodSymbol> makeSynthesizedMethodImplMap()
2326var map = ImmutableDictionary.CreateBuilder<MethodSymbol, MethodSymbol>(ExplicitInterfaceImplementationTargetMemberEqualityComparer.Instance);
2327foreach ((MethodSymbol body, MethodSymbol implemented) in this.SynthesizedInterfaceMethodImpls())
2339/// <see cref="MethodSymbol.ExplicitInterfaceImplementations"/> API. The "Body" is the method that
2346internal abstract IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls();
2402overriddenMember = ((MethodSymbol)member).OverriddenMethod;