Binder\Binder.cs (7)
449return ((MethodSymbol)containingMember).IsScriptInitializer;
490internal virtual MethodSymbol? ParamsCollectionConstructorInProgress => null;
653symbol = ((MethodSymbol)symbol).ConstructedFrom;
752internal static bool IsDisallowedExtensionInOlderLangVer(MethodSymbol symbol)
757internal static void ReportDiagnosticsIfDisallowedExtension(BindingDiagnosticBag diagnostics, MethodSymbol method, SyntaxNode syntax)
765internal static void ReportDiagnosticsIfUnmanagedCallersOnly(BindingDiagnosticBag diagnostics, MethodSymbol symbol, SyntaxNodeOrToken syntax, bool isDelegateConversion)
909return new BoundBlock(statement.Syntax, locals, ImmutableArray<MethodSymbol>.CastUp(localFunctions), hasUnsafeModifier: false, instrumentation: null,
Binder\Binder_Await.cs (18)
60out MethodSymbol? getResult,
111var containingMethod = this.ContainingMemberOrLambda as MethodSymbol;
174var method = (MethodSymbol)containingMemberOrLambda;
262out MethodSymbol? getResult,
348if (!isApplicableMethod(exprType, member, node, diagnostics, this, out MethodSymbol? method, out Conversion argumentConversion))
403[NotNullWhen(true)] out MethodSymbol? awaitMethod,
408if (member is not MethodSymbol method
435var substitutedMethod = method.Construct(exprType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics);
457static bool isValidConversion(TypeSymbol exprType, MethodSymbol method, SyntaxNode node, BindingDiagnosticBag diagnostics, Binder @this, out Conversion conversion)
485var awaitMethod = (MethodSymbol?)GetSpecialTypeMember(
501var runtimeAwaitAwaiterMethod = awaitMethod.Construct(awaiterType);
532static void reportObsoleteDiagnostics(Binder @this, BindingDiagnosticBag diagnostics, MethodSymbol method, SyntaxNode syntax)
597var getAwaiterMethod = call.Method;
684private bool GetGetResultMethod(BoundExpression awaiterExpression, SyntaxNode node, TypeSymbol awaitedExpressionType, BindingDiagnosticBag diagnostics, out MethodSymbol? getResultMethod, [NotNullWhen(true)] out BoundExpression? getAwaiterGetResultCall)
728private static bool HasOptionalParameters(MethodSymbol method)
Binder\Binder_Conversions.cs (50)
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;
1077internal BoundExpression BindCollectionExpressionConstructor(SyntaxNode syntax, TypeSymbol targetType, MethodSymbol? constructor, BindingDiagnosticBag diagnostics)
1107internal bool HasCollectionExpressionApplicableConstructor(SyntaxNode syntax, TypeSymbol targetType, out MethodSymbol? constructor, out bool isExpanded, BindingDiagnosticBag diagnostics, bool isParamsModifierValidation = false)
1143out MemberResolutionResult<MethodSymbol> memberResolutionResult,
1177MemberResolutionResult<MethodSymbol> memberResolutionResult,
1184var method = memberResolutionResult.Member;
1218out MethodSymbol? constructor)
1239internal bool HasCollectionExpressionApplicableAddMethod(SyntaxNode syntax, TypeSymbol targetType, out ImmutableArray<MethodSymbol> addMethods, BindingDiagnosticBag diagnostics)
1281out ImmutableArray<MethodSymbol> addMethods)
1299out ImmutableArray<MethodSymbol> addMethods)
1340out ImmutableArray<MethodSymbol> addMethods)
1355out ImmutableArray<MethodSymbol> addMethods)
1444resolution.MethodGroup, diagnostics: diagnostics, out var addMethod);
1459static ImmutableArray<MethodSymbol> filterOutBadGenericMethods(
1461ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1464var resultBuilder = ArrayBuilder<MethodSymbol>.GetInstance(finalApplicableCandidates.Length);
1469var member = candidate.Member;
1495MethodSymbol? constructed = null;
1581OverloadResolutionResult<MethodSymbol> result,
1585out MethodSymbol? addMethod)
1831private MethodSymbol? GetCollectionBuilderMethod(
1855if (candidate is not MethodSymbol { IsStatic: true } method)
1881MethodSymbol methodWithTargetTypeParameters; // builder method substituted with type parameters from target type
2260private static void CheckParameterModifierMismatchMethodConversion(SyntaxNode syntax, MethodSymbol lambdaOrMethod, TypeSymbol targetType, bool invokedAsExtensionMethod, BindingDiagnosticBag diagnostics)
2262MethodSymbol? delegateMethod;
2577private bool MemberGroupFinalValidation(BoundExpression? receiverOpt, MethodSymbol methodSymbol, SyntaxNode node, BindingDiagnosticBag diagnostics, bool invokedAsExtensionMethod)
2656Debug.Assert(memberSymbol is not MethodSymbol { MethodKind: not MethodKind.Constructor } ||
2661if (receiverOpt != null || memberSymbol is not MethodSymbol { MethodKind: MethodKind.Constructor })
2808internal bool MethodIsCompatibleWithDelegateOrFunctionPointer(BoundExpression? receiverOpt, bool isExtensionMethod, MethodSymbol method, TypeSymbol delegateType, Location errorLocation, BindingDiagnosticBag diagnostics)
2814MethodSymbol delegateOrFuncPtrMethod = delegateType switch
2970internal static ParameterSymbol? GetReceiverParameter(MethodSymbol method)
3003MethodSymbol selectedMethod = conversion.Method;
Binder\Binder_Expressions.cs (110)
1320MethodSymbol method = this.ContainingMember() as MethodSymbol;
1461case MethodSymbol { AssociatedSymbol: SourcePropertySymbol property }:
1464case MethodSymbol { AssociatedSymbol.OriginalDefinition: PEPropertySymbol property } method when
1474if (contextualAttributeBinder is { AttributeTarget: MethodSymbol { AssociatedSymbol: SourcePropertySymbol property } })
1536ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: PropertySymbol { IsIndexer: false } })
1999var containingMethod = this.ContainingMemberOrLambda as MethodSymbol;
2144(this.ContainingMember() is MethodSymbol { MethodKind: MethodKind.Constructor } containingMember && (object)containingMember != primaryCtor)) && // We are in a non-primary instance constructor
2186bool capture = (this.ContainingMember() is MethodSymbol containingMethod && (object)primaryCtor != containingMethod);
2207this.ContainingMemberOrLambda is MethodSymbol { MethodKind: MethodKind.AnonymousFunction or MethodKind.LocalFunction } &&
2663MethodSymbol symbolOpt = GetWellKnownTypeMember(WellKnownMember.System_Index__ctor, diagnostics, syntax: node) as MethodSymbol;
2673MethodSymbol symbolOpt = null;
2698symbolOpt = (MethodSymbol)GetWellKnownTypeMember(
2707symbolOpt = (MethodSymbol)GetWellKnownTypeMember(
2828ImmutableArray<MethodSymbol> originalUserDefinedConversions = conversion.OriginalUserDefinedConversions;
3320&& ((MethodSymbol)containingSymbol).IsAsync
4809MethodSymbol constructor,
4833MethodSymbol constructor,
4969MemberResolutionResult<MethodSymbol> memberResolutionResult;
4970ImmutableArray<MethodSymbol> candidateConstructors;
4995MethodSymbol constructor,
5003MemberResolutionResult<MethodSymbol> memberResolutionResult,
5004ImmutableArray<MethodSymbol> candidateConstructors,
5014this.CheckAndCoerceArguments<MethodSymbol>(nonNullSyntax, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, out argsToParamsOpt);
5023MethodSymbol resultMember = memberResolutionResult.Member;
5141static void validateRecordCopyConstructor(MethodSymbol constructor, NamedTypeSymbol baseType, MethodSymbol resultMember, Location errorLocation, BindingDiagnosticBag diagnostics)
5192internal static bool IsUserDefinedRecordCopyConstructor(MethodSymbol constructor)
6172private static ImmutableSegmentedDictionary<string, Symbol> GetMembersRequiringInitialization(MethodSymbol constructor)
6184MethodSymbol constructor,
6519applicableMethods: ImmutableArray<MethodSymbol>.Empty,
6643internal ImmutableArray<MethodSymbol> FilterInaccessibleConstructors(ImmutableArray<MethodSymbol> constructors, bool allowProtectedConstructorsOfBaseType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
6645ArrayBuilder<MethodSymbol> builder = null;
6649MethodSymbol constructor = constructors[i];
6655builder = ArrayBuilder<MethodSymbol>.GetInstance();
6668private bool IsConstructorAccessible(MethodSymbol constructor, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool allowProtectedConstructorsOfBaseType = false)
6738OverloadResolutionResult<MethodSymbol> overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
6739ImmutableArray<MethodSymbol> accessibleConstructors = GetAccessibleConstructorsForOverloadResolution(type, ref useSiteInfo);
6788out MemberResolutionResult<MethodSymbol> memberResolutionResult,
6789out ImmutableArray<MethodSymbol> candidateConstructors,
6808MemberResolutionResult<MethodSymbol> memberResolutionResult,
6809ImmutableArray<MethodSymbol> candidateConstructors,
6828this.CheckAndCoerceArguments<MethodSymbol>(node, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, out argToParams);
6835var method = memberResolutionResult.Member;
6893MemberResolutionResult<MethodSymbol> memberResolutionResult,
6894ImmutableArray<MethodSymbol> candidateConstructors,
6910this.CheckAndCoerceArguments<MethodSymbol>(node, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, argsToParamsOpt: out _);
7193out MemberResolutionResult<MethodSymbol> memberResolutionResult,
7194out ImmutableArray<MethodSymbol> candidateConstructors,
7200ImmutableArray<MethodSymbol> allInstanceConstructors;
7204OverloadResolutionResult<MethodSymbol> result = OverloadResolutionResult<MethodSymbol>.GetInstance();
7225OverloadResolutionResult<MethodSymbol> inaccessibleResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
7243default(MemberResolutionResult<MethodSymbol>); // Invalid results are not interesting - we have enough info in candidateConstructors.
7314private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
7316ImmutableArray<MethodSymbol> allInstanceConstructors;
7320private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, bool allowProtectedConstructorsOfBaseType, out ImmutableArray<MethodSymbol> allInstanceConstructors, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
8012var method = resolution.MethodGroup.Methods[0];
8182lookupResult.Symbols.All(s => s.Kind == SymbolKind.Method) ? lookupResult.Symbols.SelectAsArray(s_toMethodSymbolFunc) : ImmutableArray<MethodSymbol>.Empty,
8321var builder = ArrayBuilder<MethodSymbol>.GetInstance();
8324var m = s as MethodSymbol;
8765MethodSymbol method = methodGroup.Methods[i];
8806var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
9619else if (convertedIndex is BoundObjectCreationExpression { Constructor: MethodSymbol constructor, Arguments: { Length: 2 } arguments, ArgsToParamsOpt: { IsDefaultOrEmpty: true }, InitializerExpressionOpt: null } &&
10431var substring = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_String__Substring, diagnostics, syntax);
10462candidate is MethodSymbol method &&
10479void makeCall(SyntaxNode syntax, BoundExpression receiver, MethodSymbol method,
10505internal static bool MethodHasValidSliceSignature(MethodSymbol method)
10572property.GetOwnOrInheritedGetMethod()?.OriginalDefinition is MethodSymbol getMethod &&
10760var method = node.LookupSymbolOpt as MethodSymbol;
10798var result = OverloadResolutionResult<MethodSymbol>.GetInstance();
10824var method = GetUniqueSignatureFromMethodGroup(node, out bool useParams);
10841private MethodSymbol? GetUniqueSignatureFromMethodGroup_CSharp10(BoundMethodGroup node, out bool useParams)
10843MethodSymbol? method = null;
10844var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: node.Methods.Length);
10845foreach (var m in node.Methods)
10870foreach (var m in methods)
10907if (extensionMember is MethodSymbol m)
10912var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true);
10952foreach (var reduced in methods)
10986static bool isCandidateUnique(ref MethodSymbol? method, MethodSymbol candidate)
11004bool memberCountsAsStatic = extensionMember is MethodSymbol { IsExtensionMethod: true } ? false : extensionMember.IsStatic;
11021private MethodSymbol? GetUniqueSignatureFromMethodGroup(BoundMethodGroup node, out bool useParams)
11029MethodSymbol? foundMethod = null;
11036var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: node.Methods.Length);
11037foreach (var memberMethod in node.Methods)
11061var substituted = typeArguments.IsDefaultOrEmpty ? memberMethod : memberMethod.Construct(typeArguments);
11076foreach (var substituted in methods)
11109var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: singleLookupResults.Count);
11120if (extensionMember is MethodSymbol)
11122var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true);
11137foreach (var method in methods)
11163static bool isCandidateUnique(ref MethodSymbol? foundMethod, MethodSymbol candidate)
11178bool satisfiesConstraintChecks(MethodSymbol method)
11205MethodSymbol methodSymbol,
11325MethodSymbol invoke = possibleDelegateType.DelegateInvokeMethod();
11456return symbol is MethodSymbol method &&
Binder\Binder_Invocation.cs (36)
42private static ImmutableArray<MethodSymbol> GetOriginalMethods(OverloadResolutionResult<MethodSymbol> overloadResolutionResult)
52return ImmutableArray<MethodSymbol>.Empty;
55var builder = ArrayBuilder<MethodSymbol>.GetInstance();
356result = BindDynamicInvocation(node, boundExpression, analyzedArguments, ImmutableArray<MethodSymbol>.Empty, diagnostics, queryClause);
403ImmutableArray<MethodSymbol> applicableMethods,
642var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
673private static bool HasApplicableConditionalMethod(ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates)
749ImmutableArray<MethodSymbol> originalMethods;
768Debug.Assert(methodGroup.LookupSymbolOpt is not MethodSymbol);
884private void ReportDynamicInvocationWarnings(SyntaxNode syntax, BoundMethodGroup methodGroup, BindingDiagnosticBag diagnostics, ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates)
924MemberResolutionResult<MethodSymbol> methodResolutionResult,
925MethodSymbol singleCandidate)
980MemberResolutionResult<MethodSymbol> methodResolutionResult)
982MethodSymbol singleCandidate = methodResolutionResult.LeastOverriddenMember;
989var resultWithSingleCandidate = OverloadResolutionResult<MethodSymbol>.GetInstance();
1037(typeArgumentsOpt.IsDefault || ((MethodSymbol)(object)result.Member).CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, syntax.Location, candidateDiagnostics))))
1141OverloadResolutionResult<MethodSymbol> result,
1225var method = methodResult.Member;
1403var method = property.GetMethod ?? property.SetMethod;
1414internal ThreeState ReceiverIsSubjectToCloning(BoundExpression? receiver, MethodSymbol method)
1473if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_UnknownWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1482if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_DispatchWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1913internal bool CheckImplicitThisCopyInReadOnlyMember(BoundExpression receiver, MethodSymbol method, BindingDiagnosticBag diagnostics)
1919ContainingMemberOrLambda is MethodSymbol containingMethod &&
2049ImmutableArray<MethodSymbol> methods,
2056MethodSymbol method;
2060var constructedMethods = ArrayBuilder<MethodSymbol>.GetInstance();
2061foreach (var m in methods)
2063MethodSymbol constructedMethod;
2103private static bool IsUnboundGeneric(MethodSymbol method)
2123private ImmutableArray<BoundExpression> BuildArgumentsForErrorRecovery(AnalyzedArguments analyzedArguments, ImmutableArray<MethodSymbol> methods)
2126foreach (var m in methods)
2332MethodSymbol method = new ErrorMethodSymbol(methodContainer, returnType, string.Empty);
2337var originalMethods = (expr.Kind == BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty;
2561BuildArgumentsForErrorRecovery(analyzedArguments, StaticCast<MethodSymbol>.From(methods)),
Binder\Binder_Operators.cs (87)
119return createBadCompoundAssignmentOperator(node, kind, left, right, LookupResultKind.OverloadResolutionFailure, default(ImmutableArray<MethodSymbol>), diagnostics);
149ImmutableArray<MethodSymbol> originalUserDefinedOperators;
164ImmutableArray<MethodSymbol> staticExtensionOriginalUserDefinedOperators;
321ImmutableArray<MethodSymbol> originalUserDefinedOperators,
385ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceOperators(
418ArrayBuilder<MethodSymbol> methods,
423var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
465var method = overloadResolutionResult.ValidResult.Member;
513originalUserDefinedOperatorsOpt: ImmutableArray<MethodSymbol>.Empty,
520ImmutableArray<MethodSymbol> methodsArray = methods.ToImmutableAndFree();
569out ImmutableArray<MethodSymbol> staticOriginalUserDefinedOperators)
638ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
690MethodSymbol method = isAddition ? eventSymbol.AddMethod : eventSymbol.RemoveMethod;
794MethodSymbol userDefinedOperator = null;
984ImmutableArray<MethodSymbol> originalUserDefinedOperators;
1106out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators,
1112originalUserDefinedOperators = default(ImmutableArray<MethodSymbol>);
1131ref ImmutableArray<MethodSymbol> originalUserDefinedOperators,
1195ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
1424ImmutableArray<MethodSymbol> originalUserDefinedOperators;
1430originalUserDefinedOperators = default(ImmutableArray<MethodSymbol>);
1467MethodSymbol trueOperator = null, falseOperator = null;
1547private bool IsValidDynamicCondition(BoundExpression left, bool isNegative, BindingDiagnosticBag diagnostics, out MethodSymbol userDefinedOperator)
1626out MethodSymbol trueOperator,
1627out MethodSymbol falseOperator)
1645out MethodSymbol trueOperator,
1646out MethodSymbol falseOperator)
1698MethodSymbol definition;
1812out MethodSymbol? trueOperator,
1813out MethodSymbol? falseOperator)
1919private bool HasApplicableBooleanOperator(NamedTypeSymbol containingType, string name, TypeSymbol argumentType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out MethodSymbol @operator)
1921var operators = ArrayBuilder<MethodSymbol>.GetInstance();
1929var op = operators[i];
1972out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
1989out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2003ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
2029out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2077out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2094private static BinaryOperatorAnalysisResult BinaryOperatorAnalyzeOverloadResolutionResult(BinaryOperatorOverloadResolutionResult result, out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2100var builder = ArrayBuilder<MethodSymbol>.GetInstance();
2103MethodSymbol method = analysisResult.Signature.Method;
2126originalUserDefinedOperators = ImmutableArray<MethodSymbol>.Empty;
2133private void ReportObsoleteAndFeatureAvailabilityDiagnostics(MethodSymbol operatorMethod, CSharpSyntaxNode node, BindingDiagnosticBag diagnostics)
2175out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2192ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
2215out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2240out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2246var builder = ArrayBuilder<MethodSymbol>.GetInstance();
2249MethodSymbol method = analysisResult.Signature.Method;
2288originalUserDefinedOperators = ImmutableArray<MethodSymbol>.Empty;
2318out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
3182originalUserDefinedOperatorsOpt: default(ImmutableArray<MethodSymbol>),
3206ImmutableArray<MethodSymbol> originalUserDefinedOperators;
3220ImmutableArray<MethodSymbol> staticExtensionOriginalUserDefinedOperators;
3367ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceOperators(
3399ArrayBuilder<MethodSymbol> methods,
3407var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
3445var method = overloadResolutionResult.ValidResult.Member;
3489ImmutableArray<MethodSymbol>.Empty,
3496ImmutableArray<MethodSymbol> methodsArray = methods.ToImmutableAndFree();
3548out ImmutableArray<MethodSymbol> staticOriginalUserDefinedOperators)
3622ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
3638private ArrayBuilder<MethodSymbol>? LookupUserDefinedInstanceOperators(TypeSymbol lookupInType, string? checkedName, string ordinaryName, int parameterCount, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3643ArrayBuilder<MethodSymbol>? methods = null;
3651methods = ArrayBuilder<MethodSymbol>.GetInstance(lookupResult.Symbols.Count);
3664methods = ArrayBuilder<MethodSymbol>.GetInstance(lookupResult.Symbols.Count);
3669var existing = new HashSet<MethodSymbol>(PairedOperatorComparer.Instance);
3671foreach (var method in methods)
3676foreach (MethodSymbol method in lookupResult.Symbols)
3690static void appendViableMethods(LookupResult lookupResult, int parameterCount, ArrayBuilder<MethodSymbol> methods)
3692foreach (MethodSymbol method in lookupResult.Symbols)
3702private static bool IsViableInstanceOperator(MethodSymbol method, int parameterCount)
3709private ArrayBuilder<MethodSymbol>? LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
3716ArrayBuilder<MethodSymbol>? checkedMethods = null;
3724ArrayBuilder<MethodSymbol>? ordinaryMethods = null;
3735var existing = new HashSet<MethodSymbol>(OverloadResolution.PairedExtensionOperatorSignatureComparer.Instance);
3738foreach (MethodSymbol method in ordinaryMethods)
3754ref ArrayBuilder<MethodSymbol>? methods)
3761var typeOperators = ArrayBuilder<MethodSymbol>.GetInstance();
3764foreach (MethodSymbol op in typeOperators)
3786methods ??= ArrayBuilder<MethodSymbol>.GetInstance();
3795private class PairedOperatorComparer : IEqualityComparer<MethodSymbol>
3801public bool Equals(MethodSymbol x, MethodSymbol y)
3814public int GetHashCode([DisallowNull] MethodSymbol method)
3835private bool CheckConstraintLanguageVersionAndRuntimeSupportForOperator(SyntaxNode node, MethodSymbol? methodOpt, bool isUnsignedRightShift, TypeSymbol? constrainedToTypeOpt, BindingDiagnosticBag diagnostics)
4227ImmutableArray<MethodSymbol> originalUserDefinedOperators;
Binder\Binder_Patterns.cs (16)
977MethodSymbol? deconstructMethod = null;
1006ShouldUseITupleForRecursivePattern(node, declType, diagnostics, out var iTupleType, out var iTupleGetLength, out var iTupleGetItem))
1049private MethodSymbol? BindDeconstructSubpatterns(
1058var deconstructMethod = deconstruct.ExpressionSymbol as MethodSymbol;
1201[NotNullWhen(true)] out MethodSymbol? iTupleGetLength,
1202[NotNullWhen(true)] out MethodSymbol? iTupleGetItem)
1239[NotNullWhen(true)] out MethodSymbol? iTupleGetLength,
1240[NotNullWhen(true)] out MethodSymbol? iTupleGetItem)
1270iTupleGetLength = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Length);
1271iTupleGetItem = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Item);
1377MethodSymbol? deconstructMethod = null;
1402ShouldUseITuple(node, strippedInputType, diagnostics, out var iTupleType, out var iTupleGetLength, out var iTupleGetItem))
1415deconstructMethod = deconstruct.ExpressionSymbol as MethodSymbol;
Binder\Binder_Statements.cs (39)
219var method = (MethodSymbol)this.ContainingMemberOrLambda;
482new SourceLabelSymbol((MethodSymbol)ContainingMemberOrLambda, node.Identifier);
639private bool ImplicitReturnIsOkay(MethodSymbol method)
750/// Checks for a Dispose method on <paramref name="expr"/> and returns its <see cref="MethodSymbol"/> if found.
755/// <returns>The <see cref="MethodSymbol"/> of the Dispose method if one is found, otherwise null.</returns>
756internal MethodSymbol TryFindDisposePatternMethod(BoundExpression expr, SyntaxNode syntaxNode, bool hasAwait, BindingDiagnosticBag diagnostics, out bool isExpanded)
766out 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,
1832return (member as MethodSymbol)?.MethodKind == (isStatic ?
1937ImmutableArray<MethodSymbol>.CastUp(GetDeclaredLocalFunctionsForScope(node)),
2309ImmutableArray<MethodSymbol> originalUserDefinedConversions = conversion.OriginalUserDefinedConversions;
2745var best = this.UnaryOperatorOverloadResolution(UnaryOperatorKind.True, expr, node, diagnostics, out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators);
2969protected static bool IsInAsyncMethod(MethodSymbol method)
2976return IsInAsyncMethod(this.ContainingMemberOrLambda as MethodSymbol);
2982return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningTask(this.Compilation);
2988return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningGenericTask(this.Compilation);
2996var method = (MethodSymbol)symbol;
3005var symbol = this.ContainingMemberOrLambda as MethodSymbol;
3562var inferringLambda = this.ContainingMemberOrLambda is MethodSymbol method && (object)method.ReturnType == LambdaSymbol.ReturnTypeIsBeingInferred;
3745BoundExpression initializerInvocation = GetBinder(initializer).BindConstructorInitializer(initializer.ArgumentList, (MethodSymbol)this.ContainingMember(), diagnostics);
3766if (isInstanceConstructor(out MethodSymbol constructorSymbol) &&
3797bool isInstanceConstructor(out MethodSymbol constructorSymbol)
3799if (this.ContainingMember() is MethodSymbol { IsStatic: false } method)
3811BoundExpression initializerInvocation = GetBinder(initializer).BindConstructorInitializer(initializer.ArgumentList, (MethodSymbol)this.ContainingMember(), diagnostics);
3823initializerInvocation = BindImplicitConstructorInitializer((MethodSymbol)this.ContainingMember(), diagnostics, Compilation);
3831var constructorInitializer = new BoundExpressionStatement(ctorSyntax, initializerInvocation) { WasCompilerGenerated = ((MethodSymbol)ContainingMember()).IsImplicitlyDeclared };
3844MethodSymbol constructor, BindingDiagnosticBag diagnostics, CSharpCompilation compilation)
3951internal static BoundCall? GenerateBaseParameterlessConstructorInitializer(MethodSymbol constructor, BindingDiagnosticBag diagnostics)
3954MethodSymbol? baseConstructor = null;
3958foreach (MethodSymbol ctor in baseType.InstanceConstructors)
4020MethodSymbol? baseConstructor = SynthesizedRecordCopyCtor.FindCopyConstructor(baseType, containingType, ref useSiteInfo);
4134SyntaxNode syntaxNode, BindingDiagnosticBag diagnostics, out MethodSymbol result, out bool isExpanded)
4198var patternMethodSymbol = call.Method;
Binder\ForEachLoopBinder.cs (35)
89(MethodSymbol)this.ContainingMemberOrLambda,
234MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo?.Method;
495ImmutableArray<MethodSymbol> originalUserDefinedConversions = elementConversionClassification.OriginalUserDefinedConversions;
726MethodSymbol nullableValueGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Nullable_T_get_Value, diagnostics, exprSyntax);
1068MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo.Method;
1111MethodSymbol getEnumeratorMethod;
1116getEnumeratorMethod = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerable_T__GetAsyncEnumerator,
1132getEnumeratorMethod = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerable_T__GetEnumerator, diagnostics, errorLocationSyntax);
1135MethodSymbol moveNextMethod = null;
1138MethodSymbol specificGetEnumeratorMethod = getEnumeratorMethod.AsMember(collectionType);
1149MethodSymbol currentPropertyGetter;
1154MethodSymbol moveNextAsync = (MethodSymbol)GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__MoveNextAsync,
1162currentPropertyGetter = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__get_Current, diagnostics, errorLocationSyntax.Location, isOptional: false);
1166currentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerator_T__get_Current, diagnostics, errorLocationSyntax);
1178moveNextMethod = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__MoveNext, diagnostics, errorLocationSyntax);
1193builder.CurrentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__get_Current, diagnostics, errorLocationSyntax);
1230MethodSymbol patternDisposeMethod = TryFindDisposePatternMethod(receiver, syntax, isAsync, patternDiagnostics, out bool expanded);
1336builder.CurrentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__get_Current, diagnostics, syntax);
1413ArrayBuilder<MethodSymbol> candidateMethods = ArrayBuilder<MethodSymbol>.GetInstance();
1428MethodSymbol method = (MethodSymbol)member;
1439candidateMethods.Add((MethodSymbol)member);
1454private MethodArgumentInfo PerformForEachPatternOverloadResolution(SyntaxNode syntax, SyntaxNode collectionSyntax, TypeSymbol patternType, ArrayBuilder<MethodSymbol> candidateMethods, bool warningsOnly, BindingDiagnosticBag diagnostics, bool isAsync)
1458var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
1473MethodSymbol result = null;
1558var result = overloadResolutionResult.ValidResult.Member;
1658MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo.Method;
1717MethodSymbol currentPropertyGetterCandidate = ((PropertySymbol)lookupSymbol).GetOwnOrInheritedGetMethod();
1760private bool IsInvalidMoveNextMethod(MethodSymbol moveNextMethodCandidate, bool isAsync)
1961var resolvedMember = (MethodSymbol)GetSpecialTypeMember(member, diagnostics, syntax);
1969private MethodArgumentInfo BindDefaultArguments(MethodSymbol method, BoundExpression extensionReceiverOpt, bool expanded, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
Binder\InMethodBinder.cs (5)
26private readonly MethodSymbol _methodSymbol;
31/// This map is used by <see cref="MethodCompiler.BindMethodBody(MethodSymbol, TypeCompilationState, BindingDiagnosticBag, bool, BoundNode?, bool, out ImportChain?, out bool, out bool, out MethodBodySemanticModel.InitialState)"/>
41public InMethodBinder(MethodSymbol owner, Binder enclosing)
273if (((MethodSymbol)newSymbol).MethodKind == MethodKind.LocalFunction)
309if (((MethodSymbol)newSymbol).MethodKind == MethodKind.LocalFunction)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (39)
101public void ObjectCreationOverloadResolution(ImmutableArray<MethodSymbol> constructors, AnalyzedArguments arguments, OverloadResolutionResult<MethodSymbol> result, bool dynamicResolution, bool isEarlyAttributeBinding, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
138ArrayBuilder<MethodSymbol> methods,
142OverloadResolutionResult<MethodSymbol> result,
226internal bool FilterMethodsForUniqueSignature(ArrayBuilder<MethodSymbol> methods, out bool useParams)
235var result = OverloadResolutionResult<MethodSymbol>.GetInstance();
249unreducedMethods = ArrayBuilder<MethodSymbol>.GetInstance(methods.Count);
250foreach (var method in methods)
295var applicableMethods = ArrayBuilder<MethodSymbol>.GetInstance(methods.Count);
544case MethodSymbol method:
614if (member is MethodSymbol { IsExtensionMethod: true })
665if (typeof(TMember) != typeof(MethodSymbol))
686var member = (MethodSymbol)(Symbol)result.Member;
806if (member is MethodSymbol method)
858Debug.Assert(typeof(TMember) == typeof(MethodSymbol));
868var method = (MethodSymbol)(Symbol)result.Member;
930private void AddConstructorToCandidateSet(MethodSymbol constructor, ArrayBuilder<MemberResolutionResult<MethodSymbol>> results,
939results.Add(new MemberResolutionResult<MethodSymbol>(constructor, constructor, MemberAnalysisResult.UnsupportedMetadata(), hasTypeArgumentInferredFromFunctionType: false));
961results.Add(new MemberResolutionResult<MethodSymbol>(constructor, constructor, result, hasTypeArgumentInferredFromFunctionType: false));
966MethodSymbol constructor,
1009MethodSymbol constructor,
1462return ((MethodSymbol)member).HidesBaseMethodsByName;
1738ArrayBuilder<MemberResolutionResult<MethodSymbol>> results,
1739ImmutableArray<MethodSymbol> constructors,
1752foreach (MethodSymbol constructor in constructors)
1768RemoveLowerPriorityMembers<MemberResolutionResult<MethodSymbol>, MethodSymbol>(results);
3281MethodSymbol invoke;
3568MethodSymbol invoke1 = d1.DelegateInvokeMethod;
3569MethodSymbol invoke2 = d2.DelegateInvokeMethod;
3696MethodSymbol invoke1 = d1.DelegateInvokeMethod;
3697MethodSymbol invoke2 = d2.DelegateInvokeMethod;
4388if (member is MethodSymbol method)
4463(MethodSymbol)(Symbol)member,
4585Debug.Assert(candidate is MethodSymbol { MethodKind: MethodKind.UserDefinedOperator });
4781return (TMember)(Symbol)(member as MethodSymbol).ConstructedFrom;
BoundTree\BoundObjectCreationExpression.cs (6)
12public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt,
15: this(syntax, constructor, ImmutableArray<MethodSymbol>.Empty, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, defaultArguments, constantValueOpt, initializerExpressionOpt, wasTargetTyped: false, type, hasErrors)
18public BoundObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded,
21return this.Update(constructor, ImmutableArray<MethodSymbol>.Empty, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, defaultArguments, constantValueOpt, initializerExpressionOpt, this.WasTargetTyped, type);
24public BoundObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<MethodSymbol> constructorsGroup, ImmutableArray<BoundExpression> arguments,
BoundTree\Constructors.cs (21)
90MethodSymbol method,
108MethodSymbol method,
124MethodSymbol method,
130ImmutableArray<MethodSymbol> originalMethods,
170public BoundCall Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments)
175public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method)
180public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, BoundExpression arg0)
185public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, BoundExpression arg0, BoundExpression arg1)
190public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt = default)
237static ImmutableArray<RefKind> getArgumentRefKinds(MethodSymbol method)
260public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, params BoundExpression[] arguments)
264public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments)
413MethodSymbol? methodOpt,
416ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt,
434MethodSymbol? methodOpt,
447MethodSymbol? methodOpt,
592: this(syntax, locals, ImmutableArray<MethodSymbol>.Empty, hasUnsafeModifier: false, instrumentation: null, statements, hasErrors)
683MethodSymbol? methodOpt,
695MethodSymbol? methodOpt,
708MethodSymbol? methodOpt,
721public BoundIncrementOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, BoundValuePlaceholder? operandPlaceholder, BoundExpression? operandConversion, BoundValuePlaceholder? resultPlaceholder, BoundExpression? resultConversion, LookupResultKind resultKind, TypeSymbol type)
CodeGen\EmitArrayInitializer.cs (8)
462var rosPointerCtor = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_ReadOnlySpan_T__ctor_Pointer, _diagnostics, syntax: wrappedExpression.Syntax, isOptional: true);
608MethodSymbol? createSpan = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__CreateSpanRuntimeFieldHandle, _diagnostics, syntax: wrappedExpression.Syntax, isOptional: true);
632if (!tryGetReadOnlySpanArrayCtor(wrappedExpression.Syntax, out var rosArrayCtor))
696if (!tryGetReadOnlySpanArrayCtor(arrayCreation.Syntax, out var rosArrayCtor))
775bool tryGetReadOnlySpanArrayCtor(SyntaxNode syntax, [NotNullWhen(true)] out MethodSymbol? rosArrayCtor)
777rosArrayCtor = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_ReadOnlySpan_T__ctor_Array, _diagnostics, syntax: syntax, isOptional: true);
CodeGen\EmitStatement.cs (18)
1566var sequenceEqualsTMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1572var sequenceEqualsCharMethod = sequenceEqualsTMethod.Construct(Binder.GetSpecialType(_module.Compilation, SpecialType.System_Char, syntaxNode, _diagnostics));
1575var asSpanMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_MemoryExtensions__AsSpan_String, _diagnostics, syntax: syntaxNode);
1581var stringEqualityMethod = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__op_Equality) as MethodSymbol;
1662var spanTLengthMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1667var spanCharLengthMethod = spanTLengthMethod.AsMember((NamedTypeSymbol)keyType);
1672var stringLengthMethod = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__Length) as MethodSymbol;
1686var spanTIndexerMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1692var spanCharLengthMethod = spanTIndexerMethod.AsMember((NamedTypeSymbol)keyType);
1698var stringCharsIndexer = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__Chars) as MethodSymbol;
1728Debug.Assert(stringEqualityMethodRef == _module.Translate((MethodSymbol)_module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__op_Equality), (CSharpSyntaxNode)syntaxNode, assertDiagnostics));
Compilation\CSharpCompilation.cs (34)
270internal bool IsNullableAnalysisEnabledIn(MethodSymbol method)
326if (symbol is not MethodSymbol method)
563var methodSymbol = (debugEntryPoint as Symbols.PublicModel.MethodSymbol)?.UnderlyingMethodSymbol;
1896internal new MethodSymbol? GetEntryPoint(CancellationToken cancellationToken)
1935var entryPointMethod = FindEntryPoint(simpleProgramEntryPointSymbol, cancellationToken, out diagnostics);
1946private MethodSymbol? FindEntryPoint(MethodSymbol? simpleProgramEntryPointSymbol, CancellationToken cancellationToken, out ReadOnlyBindingDiagnostic<AssemblySymbol> sealedDiagnostics)
1950var entryPointCandidates = ArrayBuilder<MethodSymbol>.GetInstance();
2004foreach (var main in entryPointCandidates)
2025var taskEntryPoints = ArrayBuilder<(bool IsValid, MethodSymbol Candidate, BindingDiagnosticBag SpecificDiagnostics)>.GetInstance();
2032bool checkValid(MethodSymbol candidate, bool isCandidate, BindingDiagnosticBag specificDiagnostics)
2050var viableEntryPoints = ArrayBuilder<MethodSymbol>.GetInstance();
2052foreach (var candidate in entryPointCandidates)
2137MethodSymbol? entryPoint = null;
2151foreach (var viableEntryPoint in viableEntryPoints)
2191ArrayBuilder<MethodSymbol> entryPointCandidates, IEnumerable<Symbol> members)
2199if (member is MethodSymbol method && method.TryGetCorrespondingExtensionImplementationMethod() is { } implementationMethod)
2210static void addIfCandidate(ArrayBuilder<MethodSymbol> entryPointCandidates, Symbol member)
2212if (member is MethodSymbol method &&
2220internal bool ReturnsAwaitableToVoidOrInt(MethodSymbol method, BindingDiagnosticBag diagnostics)
2263internal (bool IsCandidate, bool IsTaskLike) HasEntryPointSignature(MethodSymbol method, BindingDiagnosticBag bag)
2317public readonly MethodSymbol? MethodSymbol;
2322public EntryPoint(MethodSymbol? methodSymbol, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics)
2476private ConcurrentSet<MethodSymbol>? _moduleInitializerMethods;
2478internal void AddModuleInitializerMethod(MethodSymbol method)
2506private ConcurrentDictionary<(ImmutableArray<byte> ContentHash, int Position), OneOrMany<(Location AttributeLocation, MethodSymbol Interceptor)>>? _interceptions;
2508internal void AddInterception(ImmutableArray<byte> contentHash, int position, Location attributeLocation, MethodSymbol interceptor)
2514() => new ConcurrentDictionary<(ImmutableArray<byte> ContentHash, int Position), OneOrMany<(Location AttributeLocation, MethodSymbol Interceptor)>>(comparer: InterceptorKeyComparer.Instance));
2535internal (Location AttributeLocation, MethodSymbol Interceptor)? TryGetInterceptor(SimpleNameSyntax? node)
3134if (symbol.Kind == SymbolKind.Method && symbol.IsImplicitlyDeclared && ((MethodSymbol)symbol).MethodKind == MethodKind.Constructor)
3566var entryPoint = MethodCompiler.GetEntryPoint(
3729foreach ((_, OneOrMany<(Location, MethodSymbol)> interceptionsOfAGivenLocation) in _interceptions)
3755foreach (MethodSymbol method in _moduleInitializerMethods.OrderBy<MethodSymbol>(LexicalOrderSymbolComparer.Instance))
Compilation\CSharpSemanticModel.cs (32)
1674if (symbol is MethodSymbol { IsExtensionMethod: true } extensionMethod)
1798case MethodSymbol { MethodKind: MethodKind.LambdaMethod }:
3514var methodSymbol = eventAssignment.IsAddition ? eventSymbol.AddMethod : eventSymbol.RemoveMethod;
3545var symbol = conversion.SymbolOpt;
3643memberGroup = dynamicInvocation.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3651memberGroup = collectionInit.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3671memberGroup = objectCreation.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3690memberGroup = boundObjectCreation.ConstructorsGroup.Cast<MethodSymbol, Symbol>();
3751return new ThisParameterSymbol(containingMember as MethodSymbol, typeOfThis);
3770thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, containingType);
3777thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, containingType);
3805thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, typeOfThis);
3959private static void GetSymbolsAndResultKind(BoundExpression node, Symbol symbolOpt, ImmutableArray<MethodSymbol> originalCandidates, out OneOrMany<Symbol> symbols, out LookupResultKind resultKind)
3990MethodSymbol constructor = null;
4036MethodSymbol constructorOpt,
4053ImmutableArray<MethodSymbol> candidateConstructors;
4074candidateConstructors = ImmutableArray<MethodSymbol>.Empty;
4089memberGroup = candidateConstructors.Cast<MethodSymbol, Symbol>();
4215private static ImmutableArray<MethodSymbol> FilterOverriddenOrHiddenMethods(ImmutableArray<MethodSymbol> methods)
4224foreach (MethodSymbol method in methods)
4317MethodSymbol method = null;
4346symbols = OneOrMany.Create(dynamicInvocation.ApplicableMethods.Cast<MethodSymbol, Symbol>());
4594ImmutableArray<MethodSymbol> nonHiddenMethods = FilterOverriddenOrHiddenMethods(node.Methods);
4597foreach (var method in nonHiddenMethods)
4656if (singleLookupResult.Symbol is not (MethodSymbol or PropertySymbol))
4783foreach (var method in FilterOverriddenOrHiddenMethods(methods))
4798var method = call.Method;
4805MethodSymbol reduced = method.ReduceExtensionMethod(receiver.Type, Compilation);
4815var method = delegateCreation.MethodOpt;
4820MethodSymbol reduced = method.ReduceExtensionMethod(receiverOpt.Type, Compilation);
5224if (node.GetInterceptableNameSyntax() is { } nameSyntax && Compilation.TryGetInterceptor(nameSyntax) is (_, MethodSymbol interceptor))
Compilation\MemberSemanticModel.SpeculativeMemberSemanticModel.cs (2)
52return NullableWalker.AnalyzeAndRewrite(Compilation, MemberSymbol as MethodSymbol, boundRoot, binder, initialState: null, diagnostics, createSnapshots: false, out snapshotManager, ref remappedSymbols);
57NullableWalker.AnalyzeWithoutRewrite(Compilation, MemberSymbol as MethodSymbol, boundRoot, binder, diagnostics, createSnapshots);
Compilation\MethodBodySemanticModel.cs (15)
44MethodSymbol owner,
61internal static MethodBodySemanticModel Create(SyntaxTreeSemanticModel containingSemanticModel, MethodSymbol owner, InitialState initialState)
112MethodSymbol owner,
124MethodSymbol owner,
137internal static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, ArrowExpressionClauseSyntax syntax, Binder rootBinder, int position)
145internal static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, ConstructorInitializerSyntax syntax, Binder rootBinder, int position)
153internal static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, PrimaryConstructorBaseTypeSyntax syntax, Binder rootBinder, int position)
168var methodSymbol = (MethodSymbol)this.MemberSymbol;
212var methodSymbol = (MethodSymbol)this.MemberSymbol;
230var methodSymbol = (MethodSymbol)this.MemberSymbol;
240if (MemberSymbol is MethodSymbol methodSymbol && methodSymbol.MethodKind == MethodKind.Constructor &&
305return Compilation.IsNullableAnalysisEnabledIn((MethodSymbol)MemberSymbol);
Compiler\MethodCompiler.cs (28)
136MethodSymbol? entryPoint = null;
226internal static MethodSymbol GetEntryPoint(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuilt, bool hasDeclarationErrors, bool emitMethodBodies, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken)
234var entryPoint = entryPointAndDiagnostics.MethodSymbol;
527MethodSymbol method = (MethodSymbol)member;
609foreach (var method in AnonymousTypeManager.GetAnonymousTypeHiddenMethods(containingType))
625MethodSymbol method = new SynthesizedStaticConstructor(sourceTypeSymbol);
680internal static MethodSymbol GetMethodToCompile(MethodSymbol method)
698var method = (MethodSymbol)definition.GetInternalSymbol();
717foreach (var method in additionalType.GetMethodsToEmit())
756var method = methodWithBody.Method;
900public override object VisitMethod(MethodSymbol symbol, TypeCompilationState arg)
921MethodSymbol methodSymbol,
1409private void EmitSkeletonMethodInExtension(MethodSymbol methodSymbol)
1421var ctor = (MethodSymbol)Binder.GetWellKnownTypeMember(_compilation, WellKnownMember.System_NotSupportedException__ctor, _diagnostics, syntax: syntax, isOptional: false);
1467private static MethodSymbol GetSymbolForEmittedBody(MethodSymbol methodSymbol)
1474MethodSymbol method,
1624MethodSymbol method,
1665MethodSymbol kickoffMethod;
1748MethodSymbol methodBodyParentSymbol = GetSymbolForEmittedBody(method);
1858internal static BoundBlock? BindSynthesizedMethodBody(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
1875MethodSymbol method,
2474private static BoundStatement BindImplicitConstructorInitializerIfAny(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
2498private static void ReportCtorInitializerCycles(MethodSymbol method, BoundExpression initializerInvocation, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
Compiler\TypeCompilationState.cs (19)
29public readonly MethodSymbol Method;
33internal MethodWithBody(MethodSymbol method, BoundStatement body, ImportChain? importChain)
52private Dictionary<MethodSymbol, MethodSymbol>? _wrappers;
80private SmallDictionary<MethodSymbol, MethodSymbol>? _constructorInitializers;
133public void AddSynthesizedMethod(MethodSymbol method, BoundStatement body)
150public void AddMethodWrapper(MethodSymbol method, MethodSymbol wrapper, BoundStatement body)
156_wrappers = new Dictionary<MethodSymbol, MethodSymbol>();
175public MethodSymbol? GetMethodWrapper(MethodSymbol method)
177MethodSymbol? wrapper = null;
202internal void ReportCtorInitializerCycles(MethodSymbol method1, MethodSymbol method2, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
217_constructorInitializers = new SmallDictionary<MethodSymbol, MethodSymbol>();
222MethodSymbol? next = method2;
Emitter\Model\PEModuleBuilder.cs (29)
28internal abstract class PEModuleBuilder : PEModuleBuilder<CSharpCompilation, SourceModuleSymbol, AssemblySymbol, TypeSymbol, NamedTypeSymbol, MethodSymbol, SyntaxNode, NoPia.EmbeddedTypesManager, ModuleCompilationState>
399var method = (MethodSymbol)member;
508internal virtual VariableSlotAllocator TryCreateVariableSlotAllocator(MethodSymbol method, MethodSymbol topLevelMethod, DiagnosticBag diagnostics)
513internal virtual MethodInstrumentation GetMethodBodyInstrumentations(MethodSymbol method)
991return ((MethodSymbol)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__InitializeArrayArrayRuntimeFieldHandle))?.GetCciAdapter();
1353internal sealed override Cci.IMethodReference Translate(MethodSymbol symbol, DiagnosticBag diagnostics, bool needDeclaration)
1359MethodSymbol methodSymbol,
1393MethodSymbol methodSymbol,
1453else if (methodSymbol is NativeIntegerMethodSymbol { UnderlyingMethod: MethodSymbol underlyingMethod })
1469MethodSymbol methodSymbol,
1581return container.Kind == SymbolKind.Method && ((MethodSymbol)container).IsGenericMethod ||
1994internal MethodSymbol EnsureThrowSwitchExpressionExceptionExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
2007private MethodSymbol EnsurePrivateImplClassMethodExists<TArg>(SyntaxNode syntaxNode, string methodName, Func<SynthesizedPrivateImplementationDetailsType, TArg, MethodSymbol> createMethodSymbol, TArg arg, DiagnosticBag diagnostics)
2014return (MethodSymbol)methodAdapter.GetInternalSymbol()!;
2017MethodSymbol methodSymbol = createMethodSymbol(privateImplClass, arg);
2022return (MethodSymbol)privateImplClass.PrivateImplementationDetails.GetMethod(methodName)!.GetInternalSymbol()!;
2041internal MethodSymbol EnsureThrowSwitchExpressionExceptionParameterlessExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
2061internal MethodSymbol EnsureThrowInvalidOperationExceptionExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
2078internal MethodSymbol EnsureInlineArrayAsSpanExists(SyntaxNode syntaxNode, NamedTypeSymbol spanType, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2106var attributeConstructor = (MethodSymbol)factory.SpecialMember(SpecialMember.System_Runtime_CompilerServices_InlineArrayAttribute__ctor);
2147internal MethodSymbol EnsureInlineArrayAsReadOnlySpanExists(SyntaxNode syntaxNode, NamedTypeSymbol spanType, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2164internal MethodSymbol EnsureInlineArrayElementRefExists(SyntaxNode syntaxNode, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2180internal MethodSymbol EnsureInlineArrayElementRefReadOnlyExists(SyntaxNode syntaxNode, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2196internal MethodSymbol EnsureInlineArrayFirstElementRefExists(SyntaxNode syntaxNode, DiagnosticBag diagnostics)
2209internal MethodSymbol EnsureInlineArrayFirstElementRefReadOnlyExists(SyntaxNode syntaxNode, DiagnosticBag diagnostics)
FlowAnalysis\AbstractFlowPass.cs (25)
469var method = _symbol as MethodSymbol;
483(_symbol as MethodSymbol)?.TryGetThisParameter(out thisParameter);
495var 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, ImmutableArray<int> argsToParamsOpt, bool expanded)
1544private void VisitArgumentsAfterCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol? method, ImmutableArray<int> argsToParamsOpt, bool expanded)
1578protected virtual void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method)
1642static bool ignoreReceiver(MethodSymbol method)
2121protected virtual void PropertySetter(BoundExpression node, BoundExpression receiver, MethodSymbol setter, BoundExpression value = null)
2148var method = GetWriteMethod(property);
2203var readMethod = GetReadMethod(property);
2222var writeMethod = GetWriteMethod(property);
2282var method = GetReadMethod(property);
2839var readMethod = GetReadMethod(property);
2840var writeMethod = GetWriteMethod(property);
3043var method = conversion.Method;
3620MethodSymbol method = null;
3721private static MethodSymbol GetReadMethod(PropertySymbol property) =>
3724private static MethodSymbol GetWriteMethod(PropertySymbol property) =>
3748var readMethod = property.GetOwnOrInheritedGetMethod();
3806var writeMethod = symbol.GetOwnOrInheritedSetMethod();
FlowAnalysis\FlowAnalysisPass.cs (6)
32MethodSymbol method,
113private static BoundBlock PrependImplicitInitializations(BoundBlock body, MethodSymbol method, ImmutableArray<FieldSymbol> implicitlyInitializedFields, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
168private static BoundBlock AppendImplicitReturn(BoundBlock body, MethodSymbol method, bool originalBodyNested)
179return body.Update(body.Locals, ImmutableArray<MethodSymbol>.Empty, body.HasUnsafeModifier, body.Instrumentation, builder.ToImmutableAndFree());
190internal static BoundBlock AppendImplicitReturn(BoundBlock body, MethodSymbol method)
212MethodSymbol method,
FlowAnalysis\NullableWalker.cs (175)
224private MethodSymbol? _delegateInvokeMethod;
263private PooledDictionary<MethodSymbol, Variables>? _nestedFunctionVariables;
288private readonly MethodSymbol? _baseOrThisInitializer;
485MethodSymbol? delegateInvokeMethodOpt,
490MethodSymbol? baseOrThisInitializer,
640if ((_symbol as MethodSymbol)?.IsConstructor() != true || _useConstructorExitWarnings)
668var method = _symbol as MethodSymbol;
740void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member, LocalState state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis)
833if (_symbol is MethodSymbol method)
911var baseOrThisInitializer = GetBaseOrThisInitializer();
1077private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt, LocalState state, MethodSymbol method, string memberName)
1111if (_symbol is MethodSymbol method)
1141if (_symbol is MethodSymbol method)
1189private void MakeMembersMaybeNull(MethodSymbol method, ImmutableArray<string> members)
1197void makeMemberMaybeNull(MethodSymbol method, string memberName)
1231containingSlot = GetReceiverSlotForMemberPostConditions(_symbol as MethodSymbol);
1247private MethodSymbol? GetBaseOrThisInitializer()
1254if (_symbol is not MethodSymbol method)
1302if (_symbol is not MethodSymbol method)
1420else if (CurrentSymbol is MethodSymbol { IsAsync: false })
1432if (CurrentSymbol is MethodSymbol method &&
1446MethodSymbol method,
1452MethodSymbol? baseOrThisInitializer,
1473MethodSymbol method,
1479MethodSymbol? baseOrThisInitializer,
1516if (symbol is MethodSymbol method
1532internal static VariableState? GetAfterInitializersState(CSharpCompilation compilation, MethodSymbol method, BoundNode nodeToAnalyze, BoundNode? constructorBody, BindingDiagnosticBag diagnostics)
1549MethodSymbol? baseOrThisInitializer = GetConstructorThisOrBaseSymbol(constructorBody);
1570private static MethodSymbol? GetConstructorThisOrBaseSymbol(BoundNode? constructorBody)
1799MethodSymbol? delegateInvokeMethodOpt,
1804var symbol = lambda.Symbol;
1845MethodSymbol? delegateInvokeMethodOpt,
1847MethodSymbol? baseOrThisInitializer,
2146var method = getTopLevelMethod(_symbol as MethodSymbol);
2225static MethodSymbol? getTopLevelMethod(MethodSymbol? method)
2234method = container as MethodSymbol;
2252var enclosingMemberMethod = _symbol as MethodSymbol;
2256enclosingMemberMethod = enclosingMemberMethod.ContainingSymbol as MethodSymbol;
2269if (this._symbol is MethodSymbol constructor
2804if (_symbol is not MethodSymbol method)
2959if (!(CurrentSymbol is MethodSymbol methodSymbol))
3122if (CurrentSymbol is MethodSymbol method)
3157var method = CurrentSymbol as MethodSymbol;
3165var delegateOrMethod = _useDelegateInvokeReturnType ? _delegateInvokeMethod! : method;
3398private Variables GetOrCreateNestedFunctionVariables(Variables container, MethodSymbol lambdaOrLocalFunction)
3400_nestedFunctionVariables ??= PooledDictionary<MethodSymbol, Variables>.GetInstance();
3412MethodSymbol lambdaOrFunctionSymbol,
3414MethodSymbol? delegateInvokeMethod,
3426var oldDelegateInvokeMethod = _delegateInvokeMethod;
3792var invokeMethod = n.DelegateInvokeMethod;
3924var addMethod = initializer.AddMethod;
3925MethodSymbol reinferredAddMethod;
3928reinferredAddMethod = (MethodSymbol)AsMemberOfType(targetCollectionType, addMethod);
4026var createMethod = node.CollectionBuilderMethod;
4042var createMethod = node.CollectionBuilderMethod;
4090MethodSymbol? constructor = getConstructor(node, node.Type);
4093(_, ImmutableArray<VisitResult> argumentResults, _, ArgumentsCompletionDelegate<MethodSymbol>? argumentsCompletion) =
4102(int slot, NullableFlowState resultState, Func<TypeSymbol, MethodSymbol?, int>? initialStateInferenceCompletion) =
4119ArgumentsCompletionDelegate<MethodSymbol>? argumentsCompletion,
4120Func<TypeSymbol, MethodSymbol?, int>? initialStateInferenceCompletion,
4148ArgumentsCompletionDelegate<MethodSymbol> argumentsCompletion,
4149Func<TypeSymbol, MethodSymbol?, int> initialStateInferenceCompletion,
4161MethodSymbol? constructor = getConstructor(node, type);
4173static MethodSymbol? getConstructor(BoundObjectCreationExpressionBase node, TypeSymbol type)
4175var constructor = node.Constructor;
4179constructor = (MethodSymbol)AsMemberOfType(type, constructor);
4185(int slot, NullableFlowState resultState, Func<TypeSymbol, MethodSymbol?, int>? completion) inferInitialObjectState(
4186BoundExpression node, TypeSymbol type, MethodSymbol? constructor,
4256Func<TypeSymbol, MethodSymbol?, int> inferInitialObjectStateAsContinuation(
4262return (TypeSymbol type, MethodSymbol? constructor) =>
4578MethodSymbol addMethod = addMethodAsMemberOfContainingType(node, containingType, ref argumentResults);
4581(MethodSymbol? reinferredMethod,
4584ArgumentsCompletionDelegate<MethodSymbol>? visitArgumentsCompletion) =
4611MethodSymbol? reinferredMethod,
4613ArgumentsCompletionDelegate<MethodSymbol>? visitArgumentsCompletion,
4638ArgumentsCompletionDelegate<MethodSymbol> visitArgumentsCompletion)
4642MethodSymbol addMethod = addMethodAsMemberOfContainingType(node, containingType, ref argumentResults);
4650static MethodSymbol addMethodAsMemberOfContainingType(BoundCollectionElementInitializer node, TypeSymbol containingType, ref ImmutableArray<VisitResult> argumentResults)
4652var method = node.AddMethod;
4676method = (MethodSymbol)AsMemberOfType(containingType, method);
5111private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType)
5350MethodSymbol? method,
5373MethodSymbol reinferredMethod = ReInferBinaryOperator(binary.Syntax, method, leftOperand, rightOperand, leftUnderlyingType, rightUnderlyingType);
5430private MethodSymbol ReInferBinaryOperator(
5432MethodSymbol method,
5439MethodSymbol reinferredMethod;
5445reinferredMethod = (MethodSymbol)AsMemberOfType(asMemberOfType, method);
6661(MethodSymbol method, ImmutableArray<VisitResult> results, bool returnNotNull) = ReInferMethodAndVisitArguments(
6687private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method)
6701private (MethodSymbol method, ImmutableArray<VisitResult> results, bool returnNotNull) ReInferMethodAndVisitArguments(
6705MethodSymbol method,
6721method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
6730(var newMethod, results, returnNotNull) = VisitArguments(node, arguments, refKindsOpt, parameters, argsToParamsOpt, defaultArguments,
6749static ImmutableArray<ParameterSymbol> getParameters(ImmutableArray<ParameterSymbol> parameters, bool isNewExtension, MethodSymbol method)
6764MethodSymbol method, int argumentCount)
6789private static RefKind GetExtensionReceiverRefKind(MethodSymbol method)
6821private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results)
6859static bool anyOverriddenMethodHasExplicitImplementation(MethodSymbol method)
6861for (var overriddenMethod = method; overriddenMethod is object; overriddenMethod = overriddenMethod.OverriddenMethod)
6872static bool isWellKnownEqualityMethodOrImplementation(CSharpCompilation compilation, MethodSymbol method, TypeSymbol? receiverType, WellKnownMember wellKnownMember)
6874var wellKnownMethod = (MethodSymbol?)compilation.GetWellKnownTypeMember(wellKnownMember);
6883var constructedMethod = wellKnownMethod.AsMember(constructedType);
6908for (var overriddenMethod = method; overriddenMethod is object; overriddenMethod = overriddenMethod.OverriddenMethod)
6986private bool IsCompareExchangeMethod(MethodSymbol? method)
7058private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method)
7091private TypeWithState GetReturnTypeWithState(MethodSymbol method)
7229protected override void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method, ImmutableArray<int> argsToParamsOpt, bool expanded)
7235private (MethodSymbol? method, ImmutableArray<VisitResult> results, bool returnNotNull) VisitArguments(
7239MethodSymbol? method,
7362if (member is MethodSymbol reinferredMethod)
7382var method = member as MethodSymbol;
7630private void ApplyMemberPostConditions(BoundExpression? receiverOpt, MethodSymbol? method)
7654private int GetReceiverSlotForMemberPostConditions(MethodSymbol? method)
7666MethodSymbol? current = method;
7667while (current.ContainingSymbol is MethodSymbol container)
7684private void ApplyMemberPostConditions(int receiverSlot, MethodSymbol method)
8516internal override TypeWithAnnotations GetMethodGroupResultType(BoundMethodGroup group, MethodSymbol method)
8522method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
8606private void CheckMethodConstraints(SyntaxNode syntax, MethodSymbol method)
8817if (((MethodSymbol)symbol).MethodKind == MethodKind.LocalFunction)
8890if (result is MethodSymbol resultMethod && resultMethod.IsGenericMethod)
8892result = resultMethod.Construct(((MethodSymbol)symbol).TypeArgumentsWithAnnotations);
9271private void ReportNullabilityMismatchWithTargetDelegate(Location location, TypeSymbol targetType, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool invokedAsExtensionMethod)
9289void reportBadDelegateReturn(BindingDiagnosticBag bag, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool topLevel, (TypeSymbol targetType, Location location) arg)
9296void reportBadDelegateParameter(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameter, bool topLevel, (TypeSymbol targetType, Location location) arg)
9307MethodSymbol? targetInvokeMethod = delegateType.DelegateInvokeMethod;
9360void reportBadDelegateReturn(BindingDiagnosticBag bag, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool topLevel, Location location)
9367void reportBadDelegateParameter(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameterSymbol, bool topLevel, Location location)
9481var method = conversion.Method;
9498static (MethodSymbol invokeSignature, ImmutableArray<ParameterSymbol>) getDelegateOrFunctionPointerInfo(TypeSymbol targetType)
10021var method = conversion.Method;
10321var method = node.MethodOpt;
10451private MethodSymbol CheckMethodGroupReceiverNullability(BoundMethodGroup group, ImmutableArray<ParameterSymbol> parameters, MethodSymbol method, bool invokedAsExtensionMethod)
10461method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
10525var delegateInvokeMethod = delegateTypeOpt?.DelegateInvokeMethod;
10541private static void UseDelegateInvokeParameterAndReturnTypes(BoundLambda lambda, MethodSymbol? delegateInvokeMethod, out bool useDelegateInvokeParameterTypes, out bool useDelegateInvokeReturnType)
10843deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.Type, deconstructMethod);
11159MethodSymbol? incrementOperator = (node.OperatorKind.IsUserDefined() && node.MethodOpt?.ParameterCount == 1) ? node.MethodOpt : null;
11652var getMethod = ((PropertySymbol)member.OriginalDefinition).GetMethod;
11673var getValue = (MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Nullable_T_get_Value);
11738MethodSymbol? reinferredGetEnumeratorMethod = null;
11856reinferredGetEnumeratorMethod = (MethodSymbol)AsMemberOfType(getEnumeratorType, enumeratorInfoOpt.GetEnumeratorInfo.Method);
11869var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.Type, enumeratorInfoOpt.CurrentPropertyGetter);
11878var moveNextAsyncMethod = (MethodSymbol)AsMemberOfType(reinferredGetEnumeratorMethod.ReturnType, enumeratorInfoOpt.MoveNextInfo.Method);
11894var disposeAsyncMethod = (MethodSymbol)AsMemberOfType(reinferredGetEnumeratorMethod.ReturnType, originalDisposeMethod);
12107node.MethodOpt is MethodSymbol method &&
12152private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType)
12156method = (MethodSymbol)AsMemberOfType(operandType.Type!.StrippedType(), method);
12329MethodSymbol logicalOperator = binary.LogicalOperator;
12332MethodSymbol reInferredMethod = ReInferBinaryOperator(binary.Syntax, logicalOperator, leftOperand, rightOperand, leftUnderlyingType, rightUnderlyingType);
12345MethodSymbol trueFalseOperator = isAnd ? binary.FalseOperator : binary.TrueOperator;
12348var updatedTrueFalseOperator = ReInferUnaryOperator(leftOperand.Syntax, trueFalseOperator, binary.Left, leftType);
12400var getResult = awaitableInfo.GetResult;
12401var reinferredGetResult = _visitResult.RValueType.Type is NamedTypeSymbol taskAwaiterType
12953var method = (MethodSymbol)CurrentSymbol;
13605var variables = (symbol.ContainingSymbol is MethodSymbol containingMethod ? _variables.GetVariablesForMethodScope(containingMethod) : null) ??
Generated\BoundNodes.xml.Generated.cs (232)
1164public BoundUnaryOperator(SyntaxNode syntax, UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1184public MethodSymbol? MethodOpt { get; }
1187public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1192public BoundUnaryOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
1206public 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)
1228public MethodSymbol? MethodOpt { get; }
1235public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1240public 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)
1315public BoundFunctionPointerLoad(SyntaxNode syntax, MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type, bool hasErrors)
1326public BoundFunctionPointerLoad(SyntaxNode syntax, MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type)
1337public MethodSymbol TargetMethod { get; }
1344public BoundFunctionPointerLoad Update(MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type)
1464public BoundRefTypeOperator(SyntaxNode syntax, BoundExpression operand, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors = false)
1477public MethodSymbol? GetTypeFromHandle { get; }
1482public BoundRefTypeOperator Update(BoundExpression operand, MethodSymbol? getTypeFromHandle, TypeSymbol type)
1558public BoundFromEndIndexExpression(SyntaxNode syntax, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
1571public MethodSymbol? MethodOpt { get; }
1576public BoundFromEndIndexExpression Update(BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol type)
1590public BoundRangeExpression(SyntaxNode syntax, BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
1604public MethodSymbol? MethodOpt { get; }
1609public BoundRangeExpression Update(BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type)
1714public BoundUserDefinedConditionalLogicalOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, BoundValuePlaceholder? trueFalseOperandPlaceholder, BoundExpression? trueFalseOperandConversion, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type, bool hasErrors = false)
1741public MethodSymbol LogicalOperator { get; }
1742public MethodSymbol TrueOperator { get; }
1743public MethodSymbol FalseOperator { get; }
1748public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1753public BoundUserDefinedConditionalLogicalOperator Update(BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, BoundValuePlaceholder? trueFalseOperandPlaceholder, BoundExpression? trueFalseOperandConversion, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type)
1767public 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)
1795public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1800public BoundCompoundAssignmentOperator Update(BinaryOperatorSignature @operator, BoundExpression left, BoundExpression right, BoundValuePlaceholder? leftPlaceholder, BoundExpression? leftConversion, BoundValuePlaceholder? finalPlaceholder, BoundExpression? finalConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
2130public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder, bool hasErrors = false)
2150public MethodSymbol? GetResult { get; }
2157public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder)
2206protected BoundTypeOf(BoundKind kind, SyntaxNode syntax, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors)
2215protected BoundTypeOf(BoundKind kind, SyntaxNode syntax, MethodSymbol? getTypeFromHandle, TypeSymbol type)
2225public MethodSymbol? GetTypeFromHandle { get; }
2230public BoundTypeOfOperator(SyntaxNode syntax, BoundTypeExpression sourceType, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors = false)
2245public BoundTypeOfOperator Update(BoundTypeExpression sourceType, MethodSymbol? getTypeFromHandle, TypeSymbol type)
2291public BoundMethodDefIndex(SyntaxNode syntax, MethodSymbol method, TypeSymbol type, bool hasErrors)
2305public BoundMethodDefIndex(SyntaxNode syntax, MethodSymbol method, TypeSymbol type)
2316public MethodSymbol Method { get; }
2321public BoundMethodDefIndex Update(MethodSymbol method, TypeSymbol type)
2709public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type, bool hasErrors)
2720public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
2732public MethodSymbol Method { get; }
2733public MethodSymbol? GetMethodFromHandle { get; }
2738public BoundMethodInfo Update(MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
2752public BoundFieldInfo(SyntaxNode syntax, FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type, bool hasErrors)
2763public BoundFieldInfo(SyntaxNode syntax, FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type)
2776public MethodSymbol? GetFieldFromHandle { get; }
2781public BoundFieldInfo Update(FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type)
2995public BoundReadOnlySpanFromArray(SyntaxNode syntax, BoundExpression operand, MethodSymbol conversionMethod, TypeSymbol type, bool hasErrors = false)
3009public MethodSymbol ConversionMethod { get; }
3014public BoundReadOnlySpanFromArray Update(BoundExpression operand, MethodSymbol conversionMethod, TypeSymbol type)
3094public BoundFixedLocalCollectionInitializer(SyntaxNode syntax, TypeSymbol elementPointerType, BoundValuePlaceholder? elementPointerPlaceholder, BoundExpression? elementPointerConversion, BoundExpression expression, MethodSymbol? getPinnableOpt, TypeSymbol type, bool hasErrors = false)
3114public MethodSymbol? GetPinnableOpt { get; }
3119public BoundFixedLocalCollectionInitializer Update(TypeSymbol elementPointerType, BoundValuePlaceholder? elementPointerPlaceholder, BoundExpression? elementPointerConversion, BoundExpression expression, MethodSymbol? getPinnableOpt, TypeSymbol type)
3304public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3319public ImmutableArray<MethodSymbol> LocalFunctions { get; }
3326public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements)
3506public BoundLocalFunctionStatement(SyntaxNode syntax, MethodSymbol symbol, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false)
3517public MethodSymbol Symbol { get; }
3524public BoundLocalFunctionStatement Update(MethodSymbol symbol, BoundBlock? blockBody, BoundBlock? expressionBody)
3770public BoundSwitchStatement(SyntaxNode syntax, BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<MethodSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, LabelSymbol breakLabel, bool hasErrors = false)
3792public ImmutableArray<MethodSymbol> InnerLocalFunctions { get; }
3801public BoundSwitchStatement Update(BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<MethodSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, LabelSymbol breakLabel)
5382public BoundDagDeconstructEvaluation(SyntaxNode syntax, MethodSymbol deconstructMethod, BoundDagTemp input, bool hasErrors = false)
5392public MethodSymbol DeconstructMethod { get; }
5397public BoundDagDeconstructEvaluation Update(MethodSymbol deconstructMethod, BoundDagTemp input)
5891public BoundDynamicInvocation(SyntaxNode syntax, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false)
5908public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
5913public BoundDynamicInvocation Update(ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type)
5960public BoundLoweredConditionalAccess(SyntaxNode syntax, BoundExpression receiver, MethodSymbol? hasValueMethodOpt, BoundExpression whenNotNull, BoundExpression? whenNullOpt, int id, bool forceCopyOfNullableValueType, TypeSymbol type, bool hasErrors = false)
5978public MethodSymbol? HasValueMethodOpt { get; }
5987public BoundLoweredConditionalAccess Update(BoundExpression receiver, MethodSymbol? hasValueMethodOpt, BoundExpression whenNotNull, BoundExpression? whenNullOpt, int id, bool forceCopyOfNullableValueType, TypeSymbol type)
6072public 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)
6090public ImmutableArray<MethodSymbol> Methods { get; }
6099public BoundMethodGroup Update(ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, string name, ImmutableArray<MethodSymbol> methods, Symbol? lookupSymbolOpt, DiagnosticInfo? lookupError, BoundMethodGroupFlags? flags, FunctionTypeSymbol? functionType, BoundExpression? receiverOpt, LookupResultKind resultKind)
6141public 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)
6171public MethodSymbol Method { get; }
6181public ImmutableArray<MethodSymbol> OriginalMethodsOpt { get; }
6186public 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)
6239public 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)
6258public MethodSymbol? Constructor { get; }
6270public BoundAttribute Update(MethodSymbol? constructor, ImmutableArray<BoundExpression> constructorArguments, ImmutableArray<string?> constructorArgumentNamesOpt, ImmutableArray<int> constructorArgumentsToParamsOpt, bool constructorExpanded, BitVector constructorDefaultArguments, ImmutableArray<BoundAssignmentOperator> namedArguments, LookupResultKind resultKind, TypeSymbol type)
6343public 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)
6365public override MethodSymbol Constructor { get; }
6366public ImmutableArray<MethodSymbol> ConstructorsGroup { get; }
6380public 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)
6435public 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)
6457public MethodSymbol? CollectionBuilderMethod { get; }
6466public BoundCollectionExpression Update(CollectionExpressionTypeKind collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundValuePlaceholder? collectionBuilderInvocationPlaceholder, BoundExpression? collectionBuilderInvocationConversion, bool wasTargetTyped, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type)
6623public 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)
6646public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
6652public BoundDynamicObjectCreationExpression Update(string name, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, ImmutableArray<MethodSymbol> applicableMethods, bool wasTargetTyped, TypeSymbol type)
6867public 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)
6886public MethodSymbol AddMethod { get; }
6898public BoundCollectionElementInitializer Update(MethodSymbol addMethod, ImmutableArray<BoundExpression> arguments, BoundExpression? implicitReceiverOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, bool invokedAsExtensionMethod, LookupResultKind resultKind, TypeSymbol type)
6912public BoundDynamicCollectionElementInitializer(SyntaxNode syntax, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false)
6925public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
6930public BoundDynamicCollectionElementInitializer Update(ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type)
6979public BoundAnonymousObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<BoundAnonymousPropertyDeclaration> declarations, TypeSymbol type, bool hasErrors = false)
6994public MethodSymbol Constructor { get; }
7001public BoundAnonymousObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<BoundAnonymousPropertyDeclaration> declarations, TypeSymbol type)
7085public BoundDelegateCreationExpression(SyntaxNode syntax, BoundExpression argument, MethodSymbol? methodOpt, bool isExtensionMethod, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false)
7100public MethodSymbol? MethodOpt { get; }
7107public BoundDelegateCreationExpression Update(BoundExpression argument, MethodSymbol? methodOpt, bool isExtensionMethod, bool wasTargetTyped, TypeSymbol type)
7594public BoundLambda(SyntaxNode syntax, UnboundLambda unboundLambda, MethodSymbol symbol, BoundBlock body, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics, Binder binder, TypeSymbol? type, bool hasErrors = false)
7611public MethodSymbol Symbol { get; }
7620public BoundLambda Update(UnboundLambda unboundLambda, MethodSymbol symbol, BoundBlock body, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics, Binder binder, TypeSymbol? type)
8149public 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)
8168public MethodSymbol? DeconstructMethod { get; }
8176public BoundRecursivePattern Update(BoundTypeExpression? declaredType, MethodSymbol? deconstructMethod, ImmutableArray<BoundPositionalSubpattern> deconstruction, ImmutableArray<BoundPropertySubpattern> properties, bool isExplicitNotNullTest, Symbol? variable, BoundExpression? variableAccess, TypeSymbol inputType, TypeSymbol narrowedType)
8273public BoundITuplePattern(SyntaxNode syntax, MethodSymbol getLengthMethod, MethodSymbol getItemMethod, ImmutableArray<BoundPositionalSubpattern> subpatterns, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false)
8292public MethodSymbol GetLengthMethod { get; }
8293public MethodSymbol GetItemMethod { get; }
8299public BoundITuplePattern Update(MethodSymbol getLengthMethod, MethodSymbol getItemMethod, ImmutableArray<BoundPositionalSubpattern> subpatterns, TypeSymbol inputType, TypeSymbol narrowedType)
8829public BoundWithExpression(SyntaxNode syntax, BoundExpression receiver, MethodSymbol? cloneMethod, BoundObjectInitializerExpressionBase initializerExpression, TypeSymbol type, bool hasErrors = false)
8844public MethodSymbol? CloneMethod { get; }
8850public BoundWithExpression Update(BoundExpression receiver, MethodSymbol? cloneMethod, BoundObjectInitializerExpressionBase initializerExpression, TypeSymbol type)
10981MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
10982ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
10990MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
10991ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11015MethodSymbol targetMethod = this.VisitMethodSymbol(node.TargetMethod);
11042MethodSymbol? getTypeFromHandle = this.VisitMethodSymbol(node.GetTypeFromHandle);
11061MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11068MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11090MethodSymbol logicalOperator = this.VisitMethodSymbol(node.LogicalOperator);
11091MethodSymbol trueOperator = this.VisitMethodSymbol(node.TrueOperator);
11092MethodSymbol falseOperator = this.VisitMethodSymbol(node.FalseOperator);
11093ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11104ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11183MethodSymbol? getResult = this.VisitMethodSymbol(node.GetResult);
11199MethodSymbol? getTypeFromHandle = this.VisitMethodSymbol(node.GetTypeFromHandle);
11213MethodSymbol method = this.VisitMethodSymbol(node.Method);
11273MethodSymbol method = this.VisitMethodSymbol(node.Method);
11274MethodSymbol? getMethodFromHandle = this.VisitMethodSymbol(node.GetMethodFromHandle);
11281MethodSymbol? getFieldFromHandle = this.VisitMethodSymbol(node.GetFieldFromHandle);
11326MethodSymbol conversionMethod = this.VisitMethodSymbol(node.ConversionMethod);
11344MethodSymbol? getPinnableOpt = this.VisitMethodSymbol(node.GetPinnableOpt);
11368ImmutableArray<MethodSymbol> localFunctions = this.VisitDeclaredLocalFunctions(node.LocalFunctions);
11406MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
11446ImmutableArray<MethodSymbol> innerLocalFunctions = this.VisitDeclaredLocalFunctions(node.InnerLocalFunctions);
11739MethodSymbol deconstructMethod = this.VisitMethodSymbol(node.DeconstructMethod);
11837ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
11852MethodSymbol? hasValueMethodOpt = this.VisitMethodSymbol(node.HasValueMethodOpt);
11873ImmutableArray<MethodSymbol> methods = this.VisitSymbols<MethodSymbol>(node.Methods);
11889MethodSymbol method = this.VisitMethodSymbol(node.Method);
11890ImmutableArray<MethodSymbol> originalMethodsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalMethodsOpt);
11906MethodSymbol? constructor = this.VisitMethodSymbol(node.Constructor);
11920MethodSymbol constructor = this.VisitMethodSymbol(node.Constructor);
11921ImmutableArray<MethodSymbol> constructorsGroup = this.VisitSymbols<MethodSymbol>(node.ConstructorsGroup);
11935MethodSymbol? collectionBuilderMethod = this.VisitMethodSymbol(node.CollectionBuilderMethod);
11975ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
12017MethodSymbol addMethod = this.VisitMethodSymbol(node.AddMethod);
12025ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
12038MethodSymbol constructor = this.VisitMethodSymbol(node.Constructor);
12058MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
12156MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
12253MethodSymbol? deconstructMethod = this.VisitMethodSymbol(node.DeconstructMethod);
12288MethodSymbol getLengthMethod = this.VisitMethodSymbol(node.GetLengthMethod);
12289MethodSymbol getItemMethod = this.VisitMethodSymbol(node.GetItemMethod);
12396MethodSymbol? cloneMethod = this.VisitMethodSymbol(node.CloneMethod);
12698MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12700ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12718MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12720ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12776MethodSymbol targetMethod = GetUpdatedSymbol(node, node.TargetMethod);
12847MethodSymbol? getTypeFromHandle = GetUpdatedSymbol(node, node.GetTypeFromHandle);
12899MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12917MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
13120MethodSymbol? getResult = GetUpdatedSymbol(node, node.GetResult);
13148MethodSymbol? getTypeFromHandle = GetUpdatedSymbol(node, node.GetTypeFromHandle);
13174MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13323MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13324MethodSymbol? getMethodFromHandle = GetUpdatedSymbol(node, node.GetMethodFromHandle);
13342MethodSymbol? getFieldFromHandle = GetUpdatedSymbol(node, node.GetFieldFromHandle);
13460MethodSymbol conversionMethod = GetUpdatedSymbol(node, node.ConversionMethod);
13508MethodSymbol? getPinnableOpt = GetUpdatedSymbol(node, node.GetPinnableOpt);
13529ImmutableArray<MethodSymbol> localFunctions = GetUpdatedArray(node, node.LocalFunctions);
13560MethodSymbol symbol = GetUpdatedSymbol(node, node.Symbol);
13569ImmutableArray<MethodSymbol> innerLocalFunctions = GetUpdatedArray(node, node.InnerLocalFunctions);
13849MethodSymbol deconstructMethod = GetUpdatedSymbol(node, node.DeconstructMethod);
13979ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14016MethodSymbol? hasValueMethodOpt = GetUpdatedSymbol(node, node.HasValueMethodOpt);
14066ImmutableArray<MethodSymbol> methods = GetUpdatedArray(node, node.Methods);
14104MethodSymbol method = GetUpdatedSymbol(node, node.Method);
14105ImmutableArray<MethodSymbol> originalMethodsOpt = GetUpdatedArray(node, node.OriginalMethodsOpt);
14143MethodSymbol? constructor = GetUpdatedSymbol(node, node.Constructor);
14179MethodSymbol constructor = GetUpdatedSymbol(node, node.Constructor);
14180ImmutableArray<MethodSymbol> constructorsGroup = GetUpdatedArray(node, node.ConstructorsGroup);
14216MethodSymbol? collectionBuilderMethod = GetUpdatedSymbol(node, node.CollectionBuilderMethod);
14286ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14394MethodSymbol addMethod = GetUpdatedSymbol(node, node.AddMethod);
14413ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14444MethodSymbol constructor = GetUpdatedSymbol(node, node.Constructor);
14497MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
14716MethodSymbol symbol = GetUpdatedSymbol(node, node.Symbol);
14911MethodSymbol? deconstructMethod = GetUpdatedSymbol(node, node.DeconstructMethod);
14949MethodSymbol getLengthMethod = GetUpdatedSymbol(node, node.GetLengthMethod);
14950MethodSymbol getItemMethod = GetUpdatedSymbol(node, node.GetItemMethod);
15114MethodSymbol? cloneMethod = GetUpdatedSymbol(node, node.CloneMethod);
Lowering\AsyncRewriter\AsyncMethodBuilderMemberCollection.cs (33)
44internal readonly MethodSymbol CreateBuilder;
49internal readonly MethodSymbol SetException;
54internal readonly MethodSymbol SetResult;
59internal readonly MethodSymbol AwaitOnCompleted;
64internal readonly MethodSymbol AwaitUnsafeOnCompleted;
69internal readonly MethodSymbol Start;
74internal readonly MethodSymbol SetStateMachine;
89MethodSymbol createBuilder,
90MethodSymbol setException,
91MethodSymbol setResult,
92MethodSymbol awaitOnCompleted,
93MethodSymbol awaitUnsafeOnCompleted,
94MethodSymbol start,
95MethodSymbol setStateMachine,
112internal static bool TryCreate(SyntheticBoundNodeFactory F, MethodSymbol method, TypeMap typeMap, out AsyncMethodBuilderMemberCollection collection)
119TryGetBuilderMember<MethodSymbol>(
124out MethodSymbol createBuilderMethod);
152MethodSymbol createBuilderMethod;
154TryGetBuilderMember<MethodSymbol>(
186MethodSymbol createBuilderMethod = null;
215TryGetBuilderMember<MethodSymbol>(
267MethodSymbol createBuilderMethod = null;
298TryGetBuilderMember<MethodSymbol>(
376MethodSymbol createBuilderMethod,
386MethodSymbol setExceptionMethod;
387MethodSymbol setResultMethod;
388MethodSymbol awaitOnCompletedMethod;
389MethodSymbol awaitUnsafeOnCompletedMethod;
390MethodSymbol startMethod;
391MethodSymbol setStateMachineMethod;
469private static MethodSymbol GetCustomCreateMethod(
483var method = (MethodSymbol)member;
Lowering\ClosureConversion\ClosureConversion.cs (26)
63/// a (<see cref="MethodSymbol"/>, <see cref="BoundStatement"/>) pair for each generated method.
67/// (<see cref="MethodSymbol"/>, <see cref="BoundStatement"/>) pairs for additional methods that the lambda rewriter produced.
76private readonly MethodSymbol _topLevelMethod;
77private readonly MethodSymbol _substitutedSourceMethod;
100private MethodSymbol _currentMethod;
165MethodSymbol method,
167MethodSymbol substitutedSourceMethod,
208(localOrParameter as MethodSymbol)?.MethodKind == MethodKind.LocalFunction);
235MethodSymbol method,
237MethodSymbol substitutedSourceMethod,
323protected override MethodSymbol CurrentMethod
378var containingMethod = scope.ContainingFunctionOpt?.OriginalMethodSymbol ?? _topLevelMethod;
414var originalMethod = nestedFunction.OriginalMethodSymbol;
532var containingMethod = isNonGeneric ? null : (_substitutedSourceMethod ?? _topLevelMethod);
681MethodSymbol constructor = frame.Constructor.AsMember(frameType);
863var loweredSymbol = (node.Method.MethodKind is MethodKind.LambdaMethod or MethodKind.LocalFunction) ?
875MethodSymbol localFunc,
877out MethodSymbol method,
1017MethodSymbol originalMethod,
1020ref MethodSymbol synthesizedMethod,
1088out var method,
1350out var method,
1377out MethodSymbol remappedMethod,
1560var oldMethod = _currentMethod;
1607private void AddSynthesizedMethod(MethodSymbol method, BoundStatement body)
1651MethodSymbol 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 (13)
26private readonly MethodSymbol _containingSymbol;
31public static void IssueDiagnostics(CSharpCompilation compilation, BoundNode node, BindingDiagnosticBag diagnostics, MethodSymbol containingSymbol)
49private DiagnosticsPass(CSharpCompilation compilation, BindingDiagnosticBag diagnostics, MethodSymbol containingSymbol)
221private void CheckReferenceToMethodIfLocalFunction(BoundExpression node, MethodSymbol method)
305MethodSymbol method,
566var method = indexer.GetOwnOrInheritedGetMethod() ?? indexer.GetOwnOrInheritedSetMethod();
608var lambda = node.Symbol;
751var binary = node.LogicalOperator;
752var unary = node.OperatorKind.Operator() == BinaryOperatorKind.And ? node.FalseOperator : node.TrueOperator;
801if (_inExpressionLambda && node.MethodOpt is MethodSymbol method && (method.IsAbstract || method.IsVirtual) && method.IsStatic)
898if (_inExpressionLambda && node.Conversion.Method is MethodSymbol method && (method.IsAbstract || method.IsVirtual) && method.IsStatic)
931private void CheckMethodGroup(BoundMethodGroup node, MethodSymbol method, bool isExtensionMethod, bool parentIsConversion, TypeSymbol convertedToType)
940if ((node.LookupSymbolOpt as MethodSymbol)?.MethodKind == MethodKind.LocalFunction)
Lowering\ExtensionMethodBodyRewriter.cs (14)
32public ExtensionMethodBodyRewriter(MethodSymbol sourceMethod, SourceExtensionImplementationMethodSymbol implementationMethod)
51private (RewrittenMethodSymbol, ImmutableDictionary<Symbol, Symbol>) EnterMethod(MethodSymbol symbol, RewrittenMethodSymbol rewritten, ReadOnlySpan<ParameterSymbol> rewrittenParameters)
73private (RewrittenMethodSymbol, ImmutableDictionary<Symbol, Symbol>) EnterMethod(MethodSymbol symbol, RewrittenLambdaOrLocalFunctionSymbol rewritten)
78protected override MethodSymbol CurrentMethod => _rewrittenContainingMethod;
110MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
129foreach (var localFunction in node.LocalFunctions)
143protected override ImmutableArray<MethodSymbol> VisitDeclaredLocalFunctions(ImmutableArray<MethodSymbol> localFunctions)
145return localFunctions.SelectAsArray(static (l, map) => (MethodSymbol)map[l], _symbolMap);
149public override MethodSymbol? VisitMethodSymbol(MethodSymbol? symbol)
154return (MethodSymbol)_symbolMap[symbol];
159return (MethodSymbol)_symbolMap[symbol];
162return ((MethodSymbol)_symbolMap[symbol.OriginalDefinition]).ConstructIfGeneric(TypeMap.SubstituteTypes(symbol.TypeArgumentsWithAnnotations));
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (16)
26private readonly MethodSymbol _method;
28private readonly MethodSymbol _createPayloadForMethodsSpanningSingleFile;
29private readonly MethodSymbol _createPayloadForMethodsSpanningMultipleFiles;
40MethodSymbol method,
63MethodSymbol createPayloadForMethodsSpanningSingleFile = GetCreatePayloadOverload(
69MethodSymbol createPayloadForMethodsSpanningMultipleFiles = GetCreatePayloadOverload(
102MethodSymbol method,
105MethodSymbol createPayloadForMethodsSpanningSingleFile,
106MethodSymbol createPayloadForMethodsSpanningMultipleFiles,
123var oldMethod = methodBodyFactory.CurrentFunction;
141private static bool IsExcludedFromCodeCoverage(MethodSymbol method)
169MethodSymbol createPayloadForMethodsSpanningSingleFile,
170MethodSymbol createPayloadForMethodsSpanningMultipleFiles,
177MethodSymbol createPayloadOverload;
564private static MethodSymbol GetCreatePayloadOverload(CSharpCompilation compilation, WellKnownMember overload, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
566return (MethodSymbol)Binder.GetWellKnownTypeMember(compilation, overload, diagnostics, syntax: syntax);
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (15)
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);
347var entryLogger = GetWellKnownMethodSymbol(entryOverload, _factory.Syntax);
351var returnLogger = GetWellKnownMethodSymbol(WellKnownMember.Microsoft_CodeAnalysis_Runtime_LocalStoreTracker__LogReturn, _factory.Syntax);
398var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal, original.Syntax);
469var toStringMethod = GetSpecialMethodSymbol(SpecialMember.System_Object__ToString, value.Syntax);
530var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, original.Syntax);
551MethodSymbol method = original.Method;
608var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, invocation.Syntax);
Lowering\LocalRewriter\DelegateCacheContainer.cs (8)
19private readonly Dictionary<(TypeSymbol?, TypeSymbol, MethodSymbol), FieldSymbol> _delegateFields = new(CLRSignatureComparer.Instance);
36TypeMap.ConcatMethodTypeParameters((MethodSymbol)owner, stopAt: null)))
40Debug.Assert(owner is NamedTypeSymbol { Arity: > 0 } or MethodSymbol { Arity: > 0 });
62var targetMethod = boundDelegateCreation.MethodOpt;
93private sealed class CLRSignatureComparer : IEqualityComparer<(TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod)>
97public bool Equals((TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) x, (TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) y)
106public int GetHashCode((TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) conversion)
Lowering\LocalRewriter\LocalRewriter.cs (18)
57MethodSymbol containingMethod,
86MethodSymbol method,
333delegateType.DelegateInvokeMethod() is MethodSymbol delegateInvoke &&
351var lambda = node.Symbol;
354var oldContainingSymbol = _factory.CurrentFunction;
384var localFunction = node.Symbol;
415static bool hasReturnTypeOrParameter(MethodSymbol localFunction, Func<TypeWithAnnotations, bool> predicate) =>
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;
1130private void CheckRefReadOnlySymbols(MethodSymbol symbol)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (23)
187MethodSymbol? method,
203MethodSymbol? method,
544private BoundExpression RewriteLiftedBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt)
607MethodSymbol? leftTruthOperator,
732private BoundExpression MakeTruthTestForDynamicLogicalOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, TypeSymbol boolean, MethodSymbol? leftTruthOperator, TypeSymbol? constrainedToTypeOpt, bool negative)
756return new BoundUnaryOperator(syntax, UnaryOperatorKind.BoolLogicalNegation, converted, ConstantValue.NotAvailable, MethodSymbol.None, constrainedToTypeOpt: null, LookupResultKind.Viable, boolean)
791MethodSymbol? method,
818MethodSymbol? method,
1148MethodSymbol? method,
1317MethodSymbol? method,
1357MethodSymbol? method,
1426MethodSymbol? method,
1528MethodSymbol? method,
1854MethodSymbol getValueOrDefaultX = UnsafeGetNullableMethod(syntax, boundTempX.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1855MethodSymbol getValueOrDefaultY = UnsafeGetNullableMethod(syntax, boundTempY.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1912private MethodSymbol UnsafeGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member)
1922internal static MethodSymbol UnsafeGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member, CSharpCompilation compilation, BindingDiagnosticBag diagnostics)
1929private bool TryGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member, out MethodSymbol result, bool isOptional = false)
2020var method = UnsafeGetSpecialTypeMethod(syntax, member);
2028MethodSymbol method;
2031method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member);
2034(object)(method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member)) == null)
2081var method = UnsafeGetSpecialTypeMethod(syntax, member);
Lowering\LocalRewriter\LocalRewriter_Call.cs (13)
98private void EmbedIfNeedTo(BoundExpression receiver, ImmutableArray<MethodSymbol> methods, SyntaxNode syntaxNode)
109foreach (var m in methods)
137ref MethodSymbol method,
200var containingMethod = this._factory.CurrentFunction;
216var symbolForCompare = needToReduce ? ReducedExtensionMethodSymbol.Create(interceptor, receiverOpt!.Type, _compilation, out _) : interceptor;
379MethodSymbol method = node.Method;
459MethodSymbol method,
540private BoundExpression MakeCall(SyntaxNode syntax, BoundExpression? rewrittenReceiver, MethodSymbol method, ImmutableArray<BoundExpression> rewrittenArguments)
673var requiresInstanceReceiver = methodOrIndexer.RequiresInstanceReceiver() && methodOrIndexer is not MethodSymbol { MethodKind: MethodKind.Constructor } and not FunctionPointerMethodSymbol;
958(isReceiverTakenByValue && methodOrIndexer is MethodSymbol)) // Extension methods with by-value receivers capture by value as classic extension methods do.
1327return ((MethodSymbol)methodOrIndexer).Parameters[0].Type as NamedTypeSymbol;
1510MethodSymbol? arrayEmpty = _compilation.GetSpecialTypeMember(SpecialMember.System_Array__Empty) as MethodSymbol;
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (49)
78if (_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_ImmutableCollectionsMarshal__AsImmutableArray_T) is MethodSymbol asImmutableArray &&
105var addMethod = (MethodSymbol?)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__Add);
113static bool canOptimizeListElement(BoundNode element, MethodSymbol addMethod)
168if (!TryGetWellKnownTypeMember(node.Syntax, WellKnownMember.System_Linq_Enumerable__ToList, out MethodSymbol? toListGeneric, isOptional: true))
173var toListOfElementType = toListGeneric.Construct([listElementType]);
190private bool ShouldUseIEnumerableBulkAddMethod(TypeSymbol spreadType, TypeSymbol targetEnumerableType, MethodSymbol? getEnumeratorMethod)
234private BoundExpression VisitImmutableArrayCollectionExpression(BoundCollectionExpression node, TypeWithAnnotations elementType, MethodSymbol asImmutableArray)
254MethodSymbol? spanConstructor = null;
278var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_ReadOnlySpan_T__ctor_Array)).AsMember(spanType);
296spanConstructor = ((MethodSymbol)_factory.WellKnownMember(
318var listToArray = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ToArray)).AsMember((NamedTypeSymbol)list.Type);
477var constructMethod = node.CollectionBuilderMethod;
556: WellKnownMember.System_Span_T__ctor_ref_T, isOptional: true) is MethodSymbol spanRefConstructor)
562var constructor = spanRefConstructor.AsMember(spanType);
574MethodSymbol elementRef = _factory.ModuleBuilderOpt.EnsureInlineArrayElementRefExists(syntax, intType, _diagnostics.DiagnosticBag).
601MethodSymbol inlineArrayAsSpan = asReadOnlySpan ?
667&& tryGetToArrayMethod(spreadTypeOriginalDefinition, WellKnownType.System_Collections_Generic_List_T, WellKnownMember.System_Collections_Generic_List_T__ToArray, out MethodSymbol? listToArrayMethod))
678var linqToArrayMethod = linqToArrayMethodGeneric.Construct([arrayType.ElementTypeWithAnnotations]);
687&& TryGetSpanConversion(spreadExpression.Type, writableOnly: false, out var asSpanMethod))
690if (tryGetToArrayMethod(spanType, WellKnownType.System_ReadOnlySpan_T, WellKnownMember.System_ReadOnlySpan_T__ToArray, out var toArrayMethod)
698bool tryGetToArrayMethod(TypeSymbol spreadTypeOriginalDefinition, WellKnownType wellKnownType, WellKnownMember wellKnownMember, [NotNullWhen(true)] out MethodSymbol? toArrayMethod)
855private bool TryGetSpanConversion(TypeSymbol type, bool writableOnly, out MethodSymbol? asSpanMethod)
905if (!TryGetSpanConversion(type, writableOnly, out var asSpanMethod))
915private BoundExpression CallAsSpanMethod(BoundExpression spreadExpression, MethodSymbol? asSpanMethod)
921if (asSpanMethod is MethodSymbol { MethodKind: MethodKind.Constructor } constructor)
925else if (asSpanMethod is MethodSymbol { IsStatic: true, ParameterCount: 1 })
939private (MethodSymbol spanSliceMethod, BoundExpression spreadElementAsSpan, MethodSymbol getLengthMethod, MethodSymbol copyToMethod)? PrepareCopyToOptimization(
964(MethodSymbol getLengthMethod, MethodSymbol copyToMethod)? getSpanMethodsForSpread(
986MethodSymbol spanSliceMethod,
988MethodSymbol getLengthMethod,
989MethodSymbol copyToMethod)
1035MethodSymbol? setCount = null;
1036MethodSymbol? asSpan = null;
1041setCount = ((MethodSymbol?)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_CollectionsMarshal__SetCount_T))?.Construct(typeArguments);
1042asSpan = ((MethodSymbol?)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_CollectionsMarshal__AsSpan_T))?.Construct(typeArguments);
1057var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ctorInt32)).AsMember(collectionType);
1081var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ctor)).AsMember(collectionType);
1107var spanGetItem = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Span_T__get_Item)).AsMember((NamedTypeSymbol)spanTemp.Type);
1161var addMethod = _factory.WellKnownMethod(WellKnownMember.System_Collections_Generic_List_T__Add).AsMember(collectionType);
1162var addRangeMethod = _factory.WellKnownMethod(WellKnownMember.System_Collections_Generic_List_T__AddRange, isOptional: true)?.AsMember(collectionType);
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (24)
109if (!TryGetWellKnownTypeMember<MethodSymbol>(node.Syntax, WellKnownMember.System_ReadOnlySpan_T__ctor_Array_Start_Length, out MethodSymbol? ctor))
551MethodSymbol? symbolOpt = oldNodeOpt.SymbolOpt;
564var method = oldNodeOpt.SymbolOpt;
597MethodSymbol createSpan;
631MethodSymbol method = methodDefinition.AsMember(destinationType);
654MethodSymbol implicitOperator = implicitOperatorDefinition.AsMember((NamedTypeSymbol)sourceType);
667MethodSymbol castUpMethod = castUpMethodDefinition.AsMember(destinationType).Construct([sourceElementType]);
688MethodSymbol method = methodDefinition.AsMember(destinationType).Construct([sourceElementType]);
743delegateType.DelegateInvokeMethod() is MethodSymbol delegateInvoke &&
1066MethodSymbol ctor = UnsafeGetNullableMethod(syntax, rewrittenType, SpecialMember.System_Nullable_T__ctor);
1082MethodSymbol get_Value = UnsafeGetNullableMethod(syntax, rewrittenOperandType, SpecialMember.System_Nullable_T_get_Value);
1128if (!TryGetSpecialTypeMethod(syntax, DecimalConversionMethod(typeFromUnderlying, typeToUnderlying), out MethodSymbol method))
1169MethodSymbol getValueOrDefault;
1386MethodSymbol ctor = UnsafeGetNullableMethod(call.Syntax, resultType, SpecialMember.System_Nullable_T__ctor);
1437MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, boundTemp.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1499MethodSymbol method;
1732if (!TryGetSpecialTypeMethod(syntax, member, out MethodSymbol method))
1762var meth = conversion.Method;
1794MethodSymbol method;
1808MethodSymbol method;
1825MethodSymbol method;
1838MethodSymbol method;
1866private Conversion TryMakeUserDefinedConversion(SyntaxNode syntax, MethodSymbol meth, TypeSymbol fromType, TypeSymbol toType, bool @checked, bool isImplicit)
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (23)
61else if (node.EnumeratorInfoOpt?.MoveNextAwaitableInfo is null && CanRewriteForEachAsFor(node.Syntax, nodeExpressionType, out var indexerGet, out var lengthGetter))
71private bool CanRewriteForEachAsFor(SyntaxNode forEachSyntax, TypeSymbol nodeExpressionType, [NotNullWhen(true)] out MethodSymbol? indexerGet, [NotNullWhen(true)] out MethodSymbol? lengthGet)
76internal static bool CanRewriteForEachAsFor(CSharpCompilation compilation, SyntaxNode forEachSyntax, TypeSymbol nodeExpressionType, [NotNullWhen(true)] out MethodSymbol? indexerGet, [NotNullWhen(true)] out MethodSymbol? lengthGet, BindingDiagnosticBag diagnostics)
89lengthGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_Span_T__get_Length, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
90indexerGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_Span_T__get_Item, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
95lengthGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_ReadOnlySpan_T__get_Length, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
96indexerGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_ReadOnlySpan_T__get_Item, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
294private bool TryGetDisposeMethod(SyntaxNode forEachSyntax, ForEachEnumeratorInfo enumeratorInfo, out MethodSymbol disposeMethod)
298disposeMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_compilation, WellKnownMember.System_IAsyncDisposable__DisposeAsync, _diagnostics, syntax: forEachSyntax);
328MethodSymbol? disposeMethod = enumeratorInfo.PatternDisposeInfo?.Method; // pattern-based
499private BoundExpression ConvertReceiverForInvocation(CSharpSyntaxNode syntax, BoundExpression receiver, MethodSymbol method, Conversion receiverConversion, TypeSymbol convertedReceiverType)
702private BoundStatement RewriteForEachStatementAsFor(BoundForEachStatement node, MethodSymbol indexerGet, MethodSymbol lengthGet)
706getItem: static (LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, BoundLocal boundArrayVar, BoundLocal boundPositionVar, (MethodSymbol indexerGet, MethodSymbol lengthGet) arg) =>
715getLength: static (LocalRewriter rewriter, SyntaxNode syntax, BoundLocal boundArrayVar, (MethodSymbol indexerGet, MethodSymbol lengthGet) arg) =>
760MethodSymbol elementRef;
1058MethodSymbol getLowerBoundMethod = UnsafeGetSpecialTypeMethod(forEachSyntax, SpecialMember.System_Array__GetLowerBound);
1059MethodSymbol getUpperBoundMethod = UnsafeGetSpecialTypeMethod(forEachSyntax, SpecialMember.System_Array__GetUpperBound);
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (11)
158var getMethod = indexer.GetOwnOrInheritedGetMethod();
254var getItemOrSliceHelper = (MethodSymbol?)_compilation.GetWellKnownTypeMember(node.GetItemOrSliceHelper);
282MethodSymbol createSpan = getCreateSpanHelper(node, spanType: getItemOrSliceHelper.ContainingType, intType: (NamedTypeSymbol)getItemOrSliceHelper.Parameters[0].Type);
360MethodSymbol getCreateSpanHelper(BoundInlineArrayAccess node, NamedTypeSymbol spanType, NamedTypeSymbol intType)
364MethodSymbol createSpan;
377BoundExpression getElementRef(BoundInlineArrayAccess node, BoundExpression rewrittenReceiver, BoundExpression index, MethodSymbol getItemOrSliceHelper, int length)
389MethodSymbol elementRef;
408MethodSymbol elementRef;
431MethodSymbol createSpan = getCreateSpanHelper(node, spanType, intType);
769else if (unloweredExpr is BoundObjectCreationExpression { Constructor: MethodSymbol constructor, Arguments: { Length: 2 } arguments, ArgsToParamsOpt: { IsDefaultOrEmpty: true }, InitializerExpressionOpt: null } &&
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (4)
140TryGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeft.Type, SpecialMember.System_Nullable_T_GetValueOrDefault, out MethodSymbol? getValueOrDefault, isOptional: true))
147TryGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeft.Type, SpecialMember.System_Nullable_T_GetValueOrDefaultDefaultValue, out MethodSymbol? getValueOrDefaultDefaultValue, isOptional: true))
199var method = boundCall.Method;
257MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeftType, SpecialMember.System_Nullable_T_GetValueOrDefault);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (22)
156if (!TryGetSpecialTypeMethod(originalSyntax, concatMember, out var spanConcat, isOptional: true)
157|| !TryGetNeededToSpanMembers(this, originalSyntax, needsImplicitConversionFromStringToSpan, charType, out var readOnlySpanCtorRefParamChar, out var stringImplicitConversionToReadOnlySpan))
194var method = UnsafeGetSpecialTypeMethod(originalSyntax, concatMember);
360private MethodSymbol? _concatStringString = ErrorMethodSymbol.UnknownMethod;
361private MethodSymbol? _concatStringStringString = ErrorMethodSymbol.UnknownMethod;
362private MethodSymbol? _concatStringStringStringString = ErrorMethodSymbol.UnknownMethod;
363private MethodSymbol? _concatStringArray = ErrorMethodSymbol.UnknownMethod;
364private MethodSymbol? _objectToString = ErrorMethodSymbol.UnknownMethod;
408private readonly void InitializeField(ref MethodSymbol? member, SpecialMember specialMember)
412member = _compilation.GetSpecialTypeMember(specialMember) as MethodSymbol;
416private readonly bool IsConcatNonArray(BoundCall call, ref MethodSymbol? concatMethod, SpecialMember concatSpecialMember, out ImmutableArray<BoundExpression> arguments)
436[NotNullWhen(true)] out MethodSymbol? readOnlySpanCtorRefParamChar,
437out MethodSymbol? stringImplicitConversionToReadOnlySpan)
442if (self.TryGetSpecialTypeMethod(syntax, SpecialMember.System_ReadOnlySpan_T__ctor_Reference, out MethodSymbol? readOnlySpanCtorRefParamGeneric, isOptional: true) &&
464MethodSymbol spanConcat,
465MethodSymbol? stringImplicitConversionToReadOnlySpan,
466MethodSymbol readOnlySpanCtorRefParamChar,
560var method = UnsafeGetSpecialTypeMethod(current.Syntax, member);
615var objectToStringMethod = UnsafeGetSpecialTypeMethod(syntax, SpecialMember.System_Object__ToString);
619MethodSymbol? structToStringMethod = null;
626if (member is MethodSymbol toStringMethod &&
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (20)
66MethodSymbol? method,
78MethodSymbol? method,
167method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(SpecialMember.System_Decimal__op_UnaryNegation);
182MethodSymbol? method,
205MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, boundTemp.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
246MethodSymbol? method,
354private BoundExpression GetLiftedUnaryOperatorConsequence(UnaryOperatorKind kind, SyntaxNode syntax, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt, TypeSymbol type, BoundExpression nonNullOperand)
356MethodSymbol ctor = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T__ctor);
456private BoundExpression MakeInstanceCompoundAssignmentOperatorResult(SyntaxNode syntax, BoundExpression left, BoundExpression? rightOpt, MethodSymbol operatorMethod, bool isChecked, AssignmentKind assignmentKind)
523static BoundCall makeIncrementCall(SyntaxNode syntax, BoundLocal boundTemp, BoundExpression? rightOpt, MethodSymbol operatorMethod)
830MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T_GetValueOrDefault);
831MethodSymbol ctor = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T__ctor);
914MethodSymbol ctor = UnsafeGetNullableMethod(node.Syntax, binaryOperandType, SpecialMember.System_Nullable_T__ctor);
966private MethodSymbol GetDecimalIncDecOperator(BinaryOperatorKind oper)
977var method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member);
986MethodSymbol method = GetDecimalIncDecOperator(oper);
995MethodSymbol method = GetDecimalIncDecOperator(oper);
996MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
997MethodSymbol ctor = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T__ctor);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (4)
46private IteratorAndAsyncCaptureWalker(CSharpCompilation compilation, MethodSymbol method, BoundNode node, HashSet<Symbol> initiallyAssignedVariables, bool isRuntimeAsync)
58public static OrderedSet<Symbol> Analyze(CSharpCompilation compilation, MethodSymbol method, BoundNode node, bool isRuntimeAsync, DiagnosticBag diagnostics)
371private readonly MethodSymbol _topLevelMethod;
374public OutsideVariablesUsedInside(IteratorAndAsyncCaptureWalker analyzer, MethodSymbol topLevelMethod, IteratorAndAsyncCaptureWalker parent)
Lowering\SyntheticBoundNodeFactory.cs (47)
64private MethodSymbol? _currentFunction;
65public MethodSymbol? CurrentFunction
83private MethodSymbol? _topLevelMethod;
84public MethodSymbol? TopLevelMethod
103public SyntheticBoundNodeFactory(MethodSymbol topLevelMethod, SyntaxNode node, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, InstrumentationState? instrumentationState = null)
114public SyntheticBoundNodeFactory(MethodSymbol? topLevelMethodOpt, NamedTypeSymbol? currentClassOpt, SyntaxNode node, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, InstrumentationState? instrumentationState = null)
283var accessor = property.GetOwnOrInheritedGetMethod();
291var accessor = property.GetOwnOrInheritedGetMethod();
341public MethodSymbol? WellKnownMethod(WellKnownMember wm, bool isOptional)
343return (MethodSymbol?)WellKnownMember(wm, isOptional);
346public MethodSymbol WellKnownMethod(WellKnownMember wm)
348return (MethodSymbol)WellKnownMember(wm, isOptional: false)!;
399public MethodSymbol SpecialMethod(SpecialMember sm)
401var result = (MethodSymbol?)SpecialMember(sm, isOptional: false);
406public MethodSymbol? SpecialMethod(SpecialMember sm, bool isOptional)
408return (MethodSymbol?)SpecialMember(sm, isOptional);
483return Block(locals, ImmutableArray<MethodSymbol>.CastUp(localFunctions), statements);
486public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
637public ParameterSymbol SynthesizedParameter(TypeSymbol type, string name, MethodSymbol? container = null, int ordinal = 0)
746var ctor = type.InstanceConstructors.Single(c => c.ParameterCount == args.Length);
750public BoundObjectCreationExpression New(MethodSymbol ctor, params BoundExpression[] args)
755var ctor = type.InstanceConstructors.Single(c => c.ParameterCount == args.Length);
759public BoundObjectCreationExpression New(MethodSymbol ctor, ImmutableArray<BoundExpression> args)
762public BoundObjectCreationExpression New(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKinds)
779var ctor = WellKnownMethod(wm);
798public BoundExpression StaticCall(TypeSymbol receiver, MethodSymbol method, params BoundExpression[] args)
808public BoundExpression StaticCall(MethodSymbol method, ImmutableArray<BoundExpression> args)
813MethodSymbol methodSymbol = WellKnownMethod(method);
821MethodSymbol methodSymbol = WellKnownMethod(method);
832MethodSymbol methodSymbol = SpecialMethod(method);
837public BoundCall Call(BoundExpression? receiver, MethodSymbol method)
842public BoundCall Call(BoundExpression? receiver, MethodSymbol method, BoundExpression arg0, bool useStrictArgumentRefKinds = false)
847public BoundCall Call(BoundExpression? receiver, MethodSymbol method, BoundExpression arg0, BoundExpression arg1, bool useStrictArgumentRefKinds = false)
852public BoundCall Call(BoundExpression? receiver, MethodSymbol method, params BoundExpression[] args)
860public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<BoundExpression> args, bool useStrictArgumentRefKinds = false)
872public static ImmutableArray<RefKind> ArgumentRefKindsFromParameterRefKinds(MethodSymbol method, bool useStrictArgumentRefKinds)
902public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<RefKind> refKinds, ImmutableArray<BoundExpression> args)
1206var ctor = baseType.InstanceConstructors.Single(c => c.ParameterCount == 0);
1271MethodSymbol getTypeFromHandle;
1313internal BoundExpression ConstructorInfo(MethodSymbol ctor)
1331public BoundExpression MethodDefIndex(MethodSymbol method)
1413public BoundExpression MethodInfo(MethodSymbol method, TypeSymbol systemReflectionMethodInfo)
1448private MethodSymbol GetMethodFromHandleMethod(NamedTypeSymbol methodContainer, TypeSymbol systemReflectionMethodOrConstructorInfo)
1472private MethodSymbol GetFieldFromHandleMethod(NamedTypeSymbol fieldContainer)
1553MethodSymbol? arrayEmpty = SpecialMethod(CodeAnalysis.SpecialMember.System_Array__Empty, isOptional: true);
1662MethodSymbol? containingMethod = this.CurrentFunction;
Symbols\Compilation_WellKnownMembers.cs (13)
75/// <see cref="MethodSymbol.AsMember"/> to construct an instantiation.
247internal static Symbol? GetRuntimeMember(NamedTypeSymbol declaringType, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
253internal static Symbol? GetRuntimeMember(ImmutableArray<Symbol> members, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
307MethodSymbol method = (MethodSymbol)member;
396var ctorSymbol = (MethodSymbol)Binder.GetWellKnownTypeMember(this, constructor, useSiteInfo: out _, isOptional: true);
443var ctorSymbol = (MethodSymbol)this.GetSpecialTypeMember(constructor);
1075internal class SpecialMembersSignatureComparer : SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol>
1145protected override ImmutableArray<ParameterSymbol> GetParameters(MethodSymbol method)
1165protected override TypeSymbol GetReturnType(MethodSymbol method)
1189protected override bool IsByRefMethod(MethodSymbol method)
Symbols\NamedTypeSymbol.cs (24)
175public MethodSymbol? DelegateInvokeMethod
190var method = methods[0] as MethodSymbol;
209internal void AddOperators(string name, ArrayBuilder<MethodSymbol> operators)
218internal static void AddOperators(ArrayBuilder<MethodSymbol> operators, ImmutableArray<Symbol> candidates)
222if (candidate is MethodSymbol { MethodKind: MethodKind.UserDefinedOperator or MethodKind.Conversion } method)
229internal static void AddOperators(ArrayBuilder<MethodSymbol> operators, ArrayBuilder<Symbol> candidates)
233if (candidate is MethodSymbol { MethodKind: MethodKind.UserDefinedOperator or MethodKind.Conversion } method)
243public ImmutableArray<MethodSymbol> InstanceConstructors
254public ImmutableArray<MethodSymbol> StaticConstructors
265public ImmutableArray<MethodSymbol> Constructors
273private ImmutableArray<MethodSymbol> GetConstructors(bool includeInstance, bool includeStatic)
286return ImmutableArray<MethodSymbol>.Empty;
289ArrayBuilder<MethodSymbol> constructors = ArrayBuilder<MethodSymbol>.GetInstance();
292if (candidate is MethodSymbol method)
300if (candidate is MethodSymbol method)
351internal void GetExtensionMethods(ArrayBuilder<MethodSymbol> methods, string nameOpt, int arity, LookupOptions options)
360internal void DoGetExtensionMethods(ArrayBuilder<MethodSymbol> methods, string nameOpt, int arity, LookupOptions options)
370var method = (MethodSymbol)member;
458if ((options & LookupOptions.MustBeOperator) != 0 && member is not MethodSymbol { MethodKind: MethodKind.UserDefinedOperator })
489public virtual MethodSymbol? TryGetCorrespondingExtensionImplementationMethod(MethodSymbol method)
Symbols\Retargeting\RetargetingSymbolTranslator.cs (25)
45return new RetargetingMethodSymbol(this, (MethodSymbol)symbol);
874public MethodSymbol Retarget(MethodSymbol method)
879return (MethodSymbol)this.SymbolMap.GetOrAdd(method, _retargetingModule._createRetargetingMethod);
882public MethodSymbol Retarget(MethodSymbol method, IEqualityComparer<MethodSymbol> retargetedMethodComparer)
903var retargetedDefinition = Retarget(method.OriginalDefinition, retargetedMethodComparer);
964private MethodSymbol FindMethodInRetargetedType(MethodSymbol method, NamedTypeSymbol retargetedType, IEqualityComparer<MethodSymbol> retargetedMethodComparer)
972private readonly MethodSymbol _toFind;
974private RetargetedTypeMethodFinder(RetargetingModuleSymbol retargetingModule, NamedTypeSymbol retargetedType, MethodSymbol toFind) :
981public static MethodSymbol Find(RetargetingSymbolTranslator translator, MethodSymbol method, NamedTypeSymbol retargetedType, IEqualityComparer<MethodSymbol> retargetedMethodComparer)
994private static MethodSymbol FindWorker
997MethodSymbol method,
999IEqualityComparer<MethodSymbol> retargetedMethodComparer
1027ImmutableArray<MethodSymbol>.Empty);
1033var retargetedMethod = (MethodSymbol)retargetedMember;
1158MethodSymbol oldAttributeCtor = oldAttributeData.AttributeConstructor;
1159MethodSymbol newAttributeCtor = (object)oldAttributeCtor == null ?
1349public override Symbol VisitMethod(MethodSymbol symbol, RetargetOptions options)
Symbols\Source\SourceComplexParameterSymbol.cs (9)
1273else if (this.ContainingSymbol is MethodSymbol method &&
1394|| ContainingSymbol is MethodSymbol { MethodKind: MethodKind.Constructor or MethodKind.DelegateInvoke or MethodKind.LambdaMethod }
1640if (!binder.HasCollectionExpressionApplicableConstructor(syntax, Type, out MethodSymbol? constructor, isExpanded: out _, diagnostics, isParamsModifierValidation: true))
1650if (!binder.HasCollectionExpressionApplicableAddMethod(syntax, Type, out ImmutableArray<MethodSymbol> addMethods, diagnostics))
1663MethodSymbol? reportAsLessVisible = null;
1665foreach (var addMethod in addMethods)
1698MethodSymbol? collectionBuilderMethod = binder.GetAndValidateCollectionBuilderMethod(syntax, (NamedTypeSymbol)Type, diagnostics, elementType: out _);
1720bool isAtLeastAsVisible(ParameterSyntax syntax, Binder binder, MethodSymbol method, BindingDiagnosticBag diagnostics)
1731void checkIsAtLeastAsVisible(ParameterSyntax syntax, Binder binder, MethodSymbol method, BindingDiagnosticBag diagnostics)
Symbols\Source\SourceMemberContainerSymbol.cs (89)
1643WhereAsArray(s => !s.IsIndexer() && (!s.IsAccessor() || ((MethodSymbol)s).AssociatedSymbol?.IsIndexer() != true)));
2018var methodsBySignature = new Dictionary<MethodSymbol, MethodSymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2019var conversionsAsMethods = new Dictionary<MethodSymbol, MethodSymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2020var conversionsAsConversions = new HashSet<MethodSymbol>(ConversionSignatureComparer.Comparer);
2134if (symbol is MethodSymbol { MethodKind: MethodKind.Conversion } conversion)
2157if (methodsBySignature.TryGetValue(conversion, out var previousMethod))
2164else if (symbol is MethodSymbol method)
2169if (conversionsAsMethods.TryGetValue(method, out var previousConversion))
2178if (methodsBySignature.TryGetValue(method, out var previousMethod))
2195private static void ReportMethodSignatureCollision(SourceMemberContainerTypeSymbol containerForDiagnostics, BindingDiagnosticBag diagnostics, MethodSymbol method1, MethodSymbol method2)
2706if (member.Kind != SymbolKind.Method || ((MethodSymbol)member).MethodKind != MethodKind.Destructor)
2761var ops1 = ArrayBuilder<MethodSymbol>.GetInstance();
2766var ops2 = ArrayBuilder<MethodSymbol>.GetInstance();
2774var ops2 = ArrayBuilder<MethodSymbol>.GetInstance();
2784static void reportOperatorNeedsMatch(BindingDiagnosticBag diagnostics, string operatorName2, MethodSymbol op1)
2791static void reportCheckedOperatorNeedsMatch(BindingDiagnosticBag diagnostics, string operatorName2, MethodSymbol op1)
2798string operatorName1, ArrayBuilder<MethodSymbol> ops1)
2809ArrayBuilder<MethodSymbol> ops1,
2810ArrayBuilder<MethodSymbol> ops2,
2812Action<BindingDiagnosticBag, string, MethodSymbol> reportMatchNotFoundError)
2814foreach (var op1 in ops1)
2822foreach (var op2 in ops2)
2838internal static bool DoOperatorsPair(MethodSymbol op1, MethodSymbol op2)
2878var ops = ArrayBuilder<MethodSymbol>.GetInstance();
2933if (member is not MethodSymbol method || !method.ShouldCheckRequiredMembers())
2960foreach (var method in this.GetMembers(name).OfType<MethodSymbol>())
3728!(member is MethodSymbol method && MethodCompiler.GetMethodToCompile(method) is SourceMemberMethodSymbol sourceMethod))
3858if (member is MethodSymbol { IsImplicitlyDeclared: false, MethodKind: not (MethodKind.Constructor or MethodKind.StaticConstructor or MethodKind.Destructor or MethodKind.ExplicitInterfaceImplementation) } method &&
4113(prevMethod.IsPartialImplementation || (prevMethod.OtherPartOfPartial is MethodSymbol otherImplementation && (object)otherImplementation != currentMethod)))
4119(prevMethod.IsPartialDefinition || (prevMethod.OtherPartOfPartial is MethodSymbol otherDefinition && (object)otherDefinition != currentMethod)))
4357MethodSymbol accessor = getNotSet ? propertySymbol.GetMethod : propertySymbol.SetMethod;
4382var methodSymbol = (MethodSymbol)symbol;
4421var methodSymbol = (MethodSymbol)symbol;
4574var meth = (MethodSymbol)member;
4636var meth = (MethodSymbol)member;
4683var m = s as MethodSymbol;
4728if (hasInitializers && !builder.NonTypeMembersWithPartialImplementations.Any(member => member is MethodSymbol { MethodKind: MethodKind.Constructor }))
4780case MethodSymbol { MethodKind: not (MethodKind.Ordinary or MethodKind.Constructor) }:
4836var thisEquals = addThisEquals(equalityContract);
4844var getHashCode = addGetHashCode(equalityContract);
4852var printMembers = addPrintMembersMethod(membersSoFar);
4890ImmutableArray<MethodSymbol>.Empty);
4898var deconstruct = (MethodSymbol)existingDeconstructMethod;
4938ImmutableArray<MethodSymbol>.Empty);
4952var constructor = (MethodSymbol)existingConstructor;
4971MethodSymbol addPrintMembersMethod(IEnumerable<Symbol> userDefinedMembers)
4990explicitInterfaceImplementations: ImmutableArray<MethodSymbol>.Empty);
4992MethodSymbol printMembersMethod;
5000printMembersMethod = (MethodSymbol)existingPrintMembersMethod;
5031void addToStringMethod(MethodSymbol printMethod)
5045explicitInterfaceImplementations: ImmutableArray<MethodSymbol>.Empty);
5047var baseToStringMethod = getBaseToStringMethod();
5074var toStringMethod = (MethodSymbol)existingToStringMethod;
5085MethodSymbol? getBaseToStringMethod()
5093if (member is not MethodSymbol method)
5200void addObjectEquals(MethodSymbol thisEquals)
5205MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5219ImmutableArray<MethodSymbol>.Empty);
5221MethodSymbol getHashCode;
5230getHashCode = (MethodSymbol)existingHashCodeMethod;
5298MethodSymbol addThisEquals(PropertySymbol? equalityContract)
5318ImmutableArray<MethodSymbol>.Empty);
5320MethodSymbol thisEquals;
5329thisEquals = (MethodSymbol)existingEqualsMethod;
5392var method = (MethodSymbol)member;
5848private void AddAccessorIfAvailable(ArrayBuilder<Symbol> symbols, MethodSymbol? accessorOpt)
6013if (member is MethodSymbol { MethodKind: MethodKind.Ordinary })
6041ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)>.Empty);
6044public readonly ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> MethodImpls;
6048ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> methodImpls)
6056ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> methodImpls)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (62)
18internal delegate void ReportMismatchInReturnType<TArg>(BindingDiagnosticBag bag, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, bool topLevel, TArg arg);
19internal delegate void ReportMismatchInParameterType<TArg>(BindingDiagnosticBag bag, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, ParameterSymbol parameter, bool topLevel, TArg arg);
73internal sealed override IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls()
115var methodImpls = ArrayBuilder<(MethodSymbol Body, MethodSymbol Implemented)>.GetInstance();
237var associatedPropertyOrEvent = interfaceMemberKind == SymbolKind.Method ? ((MethodSymbol)interfaceMember).AssociatedSymbol : null;
536var method = (MethodSymbol)member;
537if (MethodSymbol.CanOverrideOrHide(method.MethodKind) && !method.IsAccessor())
558MethodSymbol overridden = method.GetFirstRuntimeOverriddenMethodIgnoringNewSlot(out _);
572var getMethod = property.GetMethod;
573var setMethod = property.SetMethod;
613var addMethod = @event.AddMethod;
614var removeMethod = @event.RemoveMethod;
704if (hiddenMember.Kind == SymbolKind.Method && !((MethodSymbol)hiddenMember).CanBeHiddenByMember(symbol))
782associatedPropertyOrEvent = ((MethodSymbol)overridingMember).AssociatedSymbol;
791? ((MethodSymbol)overridingMember).ParameterTypesWithAnnotations
855if (!this.ContainingAssembly.RuntimeSupportsCovariantReturnsOfClasses && overridingMember is MethodSymbol overridingMethod)
860var ambiguousMethod = overridingMethod.OverriddenMethod;
892!(overridingMemberIsMethod && ((MethodSymbol)overriddenMember).MethodKind == MethodKind.Destructor)) //destructors are metadata virtual
921else if (overriddenMember is MethodSymbol overridden && overridden.IsOperator() != ((MethodSymbol)overridingMember).IsOperator())
983var overridingMethod = (MethodSymbol)overridingMember;
984var overriddenMethod = (MethodSymbol)overriddenMember;
1102MethodSymbol overriddenGetMethod = overriddenProperty.GetOwnOrInheritedGetMethod();
1112var ownOrInheritedOverriddenSetMethod = overriddenProperty.GetOwnOrInheritedSetMethod();
1133MethodSymbol ownOrInheritedGetMethod = overridingProperty.GetOwnOrInheritedGetMethod();
1140MethodSymbol ownOrInheritedSetMethod = overridingProperty.GetOwnOrInheritedSetMethod();
1153MethodSymbol overriddenMethod,
1154MethodSymbol overridingMethod,
1222(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, bool topLevel, Location location)
1229(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, ParameterSymbol overridingParameter, bool topLevel, Location location)
1240MethodSymbol baseMethod,
1241MethodSymbol overrideMethod,
1381internal static bool RequiresValidScopedOverrideForRefSafety(MethodSymbol? method, ParameterSymbol? overrideThisParameter)
1440internal static bool ReportInvalidScopedOverrideAsError(MethodSymbol baseMethod, MethodSymbol overrideMethod)
1451MethodSymbol? baseMethod,
1452MethodSymbol? overrideMethod,
1504MethodSymbol? baseMethod,
1505MethodSymbol? overrideMethod,
1633if (hidingMember is MethodSymbol hidingMethod && hiddenMembers[0] is MethodSymbol hiddenMethod)
1693var associatedPropertyOrEvent = ((MethodSymbol)hidingMember).AssociatedSymbol;
1811private (SynthesizedExplicitImplementationForwardingMethod? ForwardingMethod, (MethodSymbol Body, MethodSymbol Implemented)? MethodImpl)
1830MethodSymbol interfaceMethod = (MethodSymbol)interfaceMember;
1831MethodSymbol implementingMethod = (MethodSymbol)implementingMember;
1841MethodSymbol implementingMethodOriginalDefinition = implementingMethod.OriginalDefinition;
1860else if (implementingMethod.IsMetadataVirtual(MethodSymbol.IsMetadataVirtualOption.IgnoreInterfaceImplementationChanges))
1913private static bool IsPossibleImplementationUnderRuntimeRules(MethodSymbol implementingMethod, NamedTypeSymbol @interface)
1937private static bool IsOverrideOfPossibleImplementationUnderRuntimeRules(MethodSymbol implementingMethod, NamedTypeSymbol @interface)
1939MethodSymbol curr = implementingMethod;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (62)
322(MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerable__GetEnumerator),
342(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__CopyTo)!,
347(PropertySymbol)((MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__get_Item)!).AssociatedSymbol,
363(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Add)!,
368(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Clear)!,
373(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Contains)!,
378(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IndexOf)!,
383(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Insert)!,
388(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Remove)!,
393(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__RemoveAt)!,
398((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerable_T__GetEnumerator)!).AsMember(iEnumerableT),
410((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyList_T__get_Item)!).AssociatedSymbol).AsMember(iReadOnlyListT),
426((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Add)!).AsMember(iCollectionT),
431((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Clear)!).AsMember(iCollectionT),
436((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Contains)!).AsMember(iCollectionT),
441((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__CopyTo)!).AsMember(iCollectionT),
446((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Remove)!).AsMember(iCollectionT),
451((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__get_Item)!).AssociatedSymbol).AsMember(iListT),
457((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__IndexOf)!).AsMember(iListT),
462((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__Insert)!).AsMember(iListT),
467((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__RemoveAt)!).AsMember(iListT),
472static BoundStatement generateGetEnumerator(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
497static BoundStatement generateCount(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
525static BoundStatement generateIsSynchronized(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
532static BoundStatement generateSyncRoot(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
542static BoundStatement generateIsFixedSize(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
549static BoundStatement generateIsReadOnly(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
556static BoundStatement generateContains(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
582var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__Contains);
592static BoundStatement generateCopyTo(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
604var arraySetValueMethod = (MethodSymbol)method.DeclaringCompilation.GetSpecialTypeMember(SpecialMember.System_Array__SetValue)!;
637var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__CopyTo);
649static BoundStatement generateIndexer(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
660var constructor = (MethodSymbol)method.DeclaringCompilation.GetWellKnownTypeMember(WellKnownMember.System_IndexOutOfRangeException__ctor)!;
676var listMember = (PropertySymbol)((MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__get_Item)).AssociatedSymbol;
683static BoundStatement generateIndexOf(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
713var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__IndexOf);
722static BoundStatement generateNotSupportedException(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
724var constructor = (MethodSymbol)method.DeclaringCompilation.GetWellKnownTypeMember(WellKnownMember.System_NotSupportedException__ctor)!;
744var equalityComparer_get_Default = f.WellKnownMethod(
746var equalityComparer_Equals = f.WellKnownMethod(
958internal override IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls() => SpecializedCollections.EmptyEnumerable<(MethodSymbol Body, MethodSymbol Implemented)>();
Symbols\TypeSymbol.cs (64)
85internal ImmutableDictionary<MethodSymbol, MethodSymbol>? synthesizedMethodImplMap;
865if (checkPendingExplicitImplementations && interfaceMember is MethodSymbol interfaceMethod &&
869MethodSymbol bodyOfSynthesizedMethodImpl = currType.GetBodyOfSynthesizedInterfaceMethodImpl(interfaceMethod);
943if (implementingTypeIsFromSomeCompilation && implicitImpl is MethodSymbol implicitImplMethod && implicitImplMethod.IsOperator() != ((MethodSymbol)interfaceMember).IsOperator())
955CheckForImplementationOfCorrespondingPropertyOrEvent((MethodSymbol)interfaceMember, implementingType, implementingTypeIsFromSomeCompilation, ref implicitImpl);
1062(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1087static bool stopLookup(MethodSymbol interfaceAccessor, TypeSymbol implementingType)
1114(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1170(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1402private static (MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) GetImplementableAccessors(Symbol interfaceMember)
1404MethodSymbol interfaceAccessor1;
1405MethodSymbol interfaceAccessor2;
1465(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1500private static bool TryGetExplicitImplementationAssociatedPropertyOrEvent(bool checkPendingExplicitImplementations, MethodSymbol interfaceAccessor, TypeSymbol currType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out Symbol associated)
1511? ((MethodSymbol)implementation).AssociatedSymbol
1520MethodSymbol bodyOfSynthesizedMethodImpl = currType.GetBodyOfSynthesizedInterfaceMethodImpl(interfaceAccessor);
1544private static void CheckForImplementationOfCorrespondingPropertyOrEvent(MethodSymbol interfaceMethod, TypeSymbol implementingType, bool implementingTypeIsFromSomeCompilation,
1564MethodSymbol correspondingImplementingAccessor = null;
1605MethodSymbol interfaceAccessorWithImplementationName = new SignatureOnlyMethodSymbol(
1681var interfaceMethod = (MethodSymbol)interfaceMember;
1695var implicitImplMethod = (MethodSymbol)implicitImpl;
1802MethodSymbol implementedMethod,
1803MethodSymbol implementingMethod,
1920var implementingGetMethod = implementedProperty.GetMethod.IsImplementable() ?
1923var implementingSetMethod = implementedProperty.SetMethod.IsImplementable() ?
1947var implementingMethod = (MethodSymbol)implementingMember;
1948var implementedMethod = (MethodSymbol)interfaceMember;
2013var method = (MethodSymbol)interfaceMember;
2033hasRefReturnMismatch = ((MethodSymbol)closestMismatch).RefKind != interfaceMemberRefKind;
2052else if (interfaceMember is MethodSymbol interfaceMethod &&
2053interfaceMethod.IsOperator() != ((MethodSymbol)closestMismatch).IsOperator())
2066if (!(one is MethodSymbol oneMethod))
2071if (!(other is MethodSymbol otherMethod))
2096private static bool ReportAnyMismatchedConstraints(MethodSymbol interfaceMethod, TypeSymbol implementingType, MethodSymbol implicitImpl, BindingDiagnosticBag diagnostics)
2183if (interfaceMember is MethodSymbol { IsStatic: true } interfaceMethod)
2193(((MethodSymbol)member).MethodKind is MethodKind.UserDefinedOperator or MethodKind.Conversion) != isOperator.GetValueOrDefault())
2297Debug.Assert(interfaceMember.Kind != SymbolKind.Method || (object)interfaceMember == ((MethodSymbol)interfaceMember).ConstructedFrom);
2308/// <see cref="MethodSymbol.ExplicitInterfaceImplementations"/> API, this method returns the "Body" part
2316protected MethodSymbol? GetBodyOfSynthesizedInterfaceMethodImpl(MethodSymbol interfaceMethod)
2329if (info.synthesizedMethodImplMap.TryGetValue(interfaceMethod, out MethodSymbol? result))
2336ImmutableDictionary<MethodSymbol, MethodSymbol> makeSynthesizedMethodImplMap()
2338var map = ImmutableDictionary.CreateBuilder<MethodSymbol, MethodSymbol>(ExplicitInterfaceImplementationTargetMemberEqualityComparer.Instance);
2339foreach ((MethodSymbol body, MethodSymbol implemented) in this.SynthesizedInterfaceMethodImpls())
2351/// <see cref="MethodSymbol.ExplicitInterfaceImplementations"/> API. The "Body" is the method that
2358internal abstract IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls();
2414overriddenMember = ((MethodSymbol)member).OverriddenMethod;