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.OperatorResolutionForReporting.cs (16)
28Debug.Assert(_nonExtensionResult is null or OverloadResolutionResult<MethodSymbol> or BinaryOperatorOverloadResolutionResult or UnaryOperatorOverloadResolutionResult);
29Debug.Assert(_extensionResult is null or OverloadResolutionResult<MethodSymbol> or BinaryOperatorOverloadResolutionResult or UnaryOperatorOverloadResolutionResult);
46public bool SaveResult(OverloadResolutionResult<MethodSymbol> result, bool isExtension)
89var results = ArrayBuilder<(MethodSymbol?, OperatorAnalysisResultKind)>.GetInstance();
100ArrayBuilder<(MethodSymbol? member, OperatorAnalysisResultKind resultKind)> results,
171case OverloadResolutionResult<MethodSymbol> r1:
221static bool hadAmbiguousBestMethods(ArrayBuilder<(MethodSymbol?, OperatorAnalysisResultKind)> results, SyntaxNode node, Binder binder, BindingDiagnosticBag diagnostics)
223if (!tryGetTwoBest(results, out var first, out var second))
245static void assertNone(ArrayBuilder<(MethodSymbol? member, OperatorAnalysisResultKind resultKind)> results, OperatorAnalysisResultKind kind)
250static bool tryGetTwoBest(ArrayBuilder<(MethodSymbol?, OperatorAnalysisResultKind)> results, [NotNullWhen(true)] out MethodSymbol? first, [NotNullWhen(true)] out MethodSymbol? second)
282static void populateResults(ArrayBuilder<(MethodSymbol?, OperatorAnalysisResultKind)> results, object? result)
286case OverloadResolutionResult<MethodSymbol> result1:
338case OverloadResolutionResult<MethodSymbol> result1:
Binder\Binder_Await.cs (18)
60out MethodSymbol? getResult,
111var containingMethod = this.ContainingMemberOrLambda as MethodSymbol;
174var method = (MethodSymbol)containingMemberOrLambda;
274out MethodSymbol? getResult,
360if (!isApplicableMethod(exprType, member, node, diagnostics, this, out MethodSymbol? method, out Conversion argumentConversion))
415[NotNullWhen(true)] out MethodSymbol? awaitMethod,
420if (member is not MethodSymbol method
447var substitutedMethod = method.Construct(exprType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics);
469static bool isValidConversion(TypeSymbol exprType, MethodSymbol method, SyntaxNode node, BindingDiagnosticBag diagnostics, Binder @this, out Conversion conversion)
497var awaitMethod = (MethodSymbol?)GetSpecialTypeMember(
513var runtimeAwaitAwaiterMethod = awaitMethod.Construct(awaiterType);
544static void reportObsoleteDiagnostics(Binder @this, BindingDiagnosticBag diagnostics, MethodSymbol method, SyntaxNode syntax)
609var getAwaiterMethod = call.Method;
696private bool GetGetResultMethod(BoundExpression awaiterExpression, SyntaxNode node, TypeSymbol awaitedExpressionType, BindingDiagnosticBag diagnostics, out MethodSymbol? getResultMethod, [NotNullWhen(true)] out BoundExpression? getAwaiterGetResultCall)
740private static bool HasOptionalParameters(MethodSymbol method)
Binder\Binder_Conversions.cs (50)
419if (conversion.Method is MethodSymbol method && method.IsStatic)
535MethodSymbol? castUpMethod = TryFindCastUpMethod(sourceForCastUp, destination.OriginalDefinition);
562static void reportUseSiteOrMissing(MethodSymbol? method, object containingType, string methodName, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
580internal static MethodSymbol? TryFindImplicitOperatorFromArray(TypeSymbol type)
590internal static MethodSymbol? TryFindImplicitOperatorFromSpan(TypeSymbol spanType, TypeSymbol readonlySpanType)
600private static MethodSymbol? TryFindImplicitOperator<TArg>(TypeSymbol type, TArg arg,
601Func<TArg, MethodSymbol, bool> predicate)
630internal static MethodSymbol? TryFindCastUpMethod(TypeSymbol source, TypeSymbol destination)
658internal static MethodSymbol? TryFindAsSpanCharMethod(CSharpCompilation compilation, TypeSymbol readOnlySpanType)
664MethodSymbol? result = null;
692private static MethodSymbol? TryFindSingleMethod<TArg>(TypeSymbol type, string name, TArg arg, Func<TArg, MethodSymbol, bool> predicate)
695MethodSymbol? result = null;
698if (member is MethodSymbol method && predicate(arg, method))
826var collectionTypeKind = conversion.GetCollectionExpressionTypeKind(out var elementType, out MethodSymbol? constructor, out bool isExpanded);
843MethodSymbol? collectionBuilderMethod = null;
892HasParamsCollectionTypeInProgress(namedType, out NamedTypeSymbol? inProgress, out MethodSymbol? inProgressConstructor))
1038internal MethodSymbol? GetAndValidateCollectionBuilderMethod(
1044MethodSymbol? collectionBuilderMethod;
1083internal BoundExpression BindCollectionExpressionConstructor(SyntaxNode syntax, TypeSymbol targetType, MethodSymbol? constructor, BindingDiagnosticBag diagnostics)
1113internal bool HasCollectionExpressionApplicableConstructor(SyntaxNode syntax, TypeSymbol targetType, out MethodSymbol? constructor, out bool isExpanded, BindingDiagnosticBag diagnostics, bool isParamsModifierValidation = false)
1149out MemberResolutionResult<MethodSymbol> memberResolutionResult,
1183MemberResolutionResult<MethodSymbol> memberResolutionResult,
1190var method = memberResolutionResult.Member;
1224out MethodSymbol? constructor)
1245internal bool HasCollectionExpressionApplicableAddMethod(SyntaxNode syntax, TypeSymbol targetType, out ImmutableArray<MethodSymbol> addMethods, BindingDiagnosticBag diagnostics)
1287out ImmutableArray<MethodSymbol> addMethods)
1305out ImmutableArray<MethodSymbol> addMethods)
1346out ImmutableArray<MethodSymbol> addMethods)
1361out ImmutableArray<MethodSymbol> addMethods)
1450resolution.MethodGroup, diagnostics: diagnostics, out var addMethod);
1465static ImmutableArray<MethodSymbol> filterOutBadGenericMethods(
1467ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1470var resultBuilder = ArrayBuilder<MethodSymbol>.GetInstance(finalApplicableCandidates.Length);
1475var member = candidate.Member;
1501MethodSymbol? constructed = null;
1587OverloadResolutionResult<MethodSymbol> result,
1591out MethodSymbol? addMethod)
1837private MethodSymbol? GetCollectionBuilderMethod(
1861if (candidate is not MethodSymbol { IsStatic: true } method)
1887MethodSymbol methodWithTargetTypeParameters; // builder method substituted with type parameters from target type
2266private static void CheckParameterModifierMismatchMethodConversion(SyntaxNode syntax, MethodSymbol lambdaOrMethod, TypeSymbol targetType, bool invokedAsExtensionMethod, BindingDiagnosticBag diagnostics)
2268MethodSymbol? delegateMethod;
2583private bool MemberGroupFinalValidation(BoundExpression? receiverOpt, MethodSymbol methodSymbol, SyntaxNode node, BindingDiagnosticBag diagnostics, bool invokedAsExtensionMethod)
2662Debug.Assert(memberSymbol is not MethodSymbol { MethodKind: not MethodKind.Constructor } ||
2667if (receiverOpt != null || memberSymbol is not MethodSymbol { MethodKind: MethodKind.Constructor })
2814internal bool MethodIsCompatibleWithDelegateOrFunctionPointer(BoundExpression? receiverOpt, bool isExtensionMethod, MethodSymbol method, TypeSymbol delegateType, Location errorLocation, BindingDiagnosticBag diagnostics)
2820MethodSymbol delegateOrFuncPtrMethod = delegateType switch
2976internal static ParameterSymbol? GetReceiverParameter(MethodSymbol method)
3009MethodSymbol selectedMethod = conversion.Method;
Binder\Binder_Expressions.cs (111)
1345MethodSymbol method = this.ContainingMember() as MethodSymbol;
1486case MethodSymbol { AssociatedSymbol: SourcePropertySymbol property }:
1489case MethodSymbol { AssociatedSymbol.OriginalDefinition: PEPropertySymbol property } method when
1499if (contextualAttributeBinder is { AttributeTarget: MethodSymbol { AssociatedSymbol: SourcePropertySymbol property } })
1561ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: PropertySymbol { IsIndexer: false } })
2036var containingMethod = this.ContainingMemberOrLambda as MethodSymbol;
2080(this.ContainingMember() is MethodSymbol { MethodKind: MethodKind.Constructor } containingMember && (object)containingMember != primaryCtor)) && // We are in a non-primary instance constructor
2122bool capture = (this.ContainingMember() is MethodSymbol containingMethod && (object)primaryCtor != containingMethod);
2143this.ContainingMemberOrLambda is MethodSymbol { MethodKind: MethodKind.AnonymousFunction or MethodKind.LocalFunction } &&
2697MethodSymbol symbolOpt = GetWellKnownTypeMember(WellKnownMember.System_Index__ctor, diagnostics, syntax: node) as MethodSymbol;
2707MethodSymbol symbolOpt = null;
2732symbolOpt = (MethodSymbol)GetWellKnownTypeMember(
2741symbolOpt = (MethodSymbol)GetWellKnownTypeMember(
2862ImmutableArray<MethodSymbol> originalUserDefinedConversions = conversion.OriginalUserDefinedConversions;
3354&& ((MethodSymbol)containingSymbol).IsAsync
4843MethodSymbol constructor,
4867MethodSymbol constructor,
5003MemberResolutionResult<MethodSymbol> memberResolutionResult;
5004ImmutableArray<MethodSymbol> candidateConstructors;
5029MethodSymbol constructor,
5037MemberResolutionResult<MethodSymbol> memberResolutionResult,
5038ImmutableArray<MethodSymbol> candidateConstructors,
5048this.CheckAndCoerceArguments<MethodSymbol>(nonNullSyntax, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, out argsToParamsOpt);
5057MethodSymbol resultMember = memberResolutionResult.Member;
5176static void validateRecordCopyConstructor(MethodSymbol constructor, NamedTypeSymbol baseType, MethodSymbol resultMember, Location errorLocation, BindingDiagnosticBag diagnostics)
5227internal static bool IsUserDefinedRecordCopyConstructor(MethodSymbol constructor)
6207private static ImmutableSegmentedDictionary<string, Symbol> GetMembersRequiringInitialization(MethodSymbol constructor)
6219MethodSymbol constructor,
6554applicableMethods: ImmutableArray<MethodSymbol>.Empty,
6678internal ImmutableArray<MethodSymbol> FilterInaccessibleConstructors(ImmutableArray<MethodSymbol> constructors, bool allowProtectedConstructorsOfBaseType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
6680ArrayBuilder<MethodSymbol> builder = null;
6684MethodSymbol constructor = constructors[i];
6690builder = ArrayBuilder<MethodSymbol>.GetInstance();
6703private bool IsConstructorAccessible(MethodSymbol constructor, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool allowProtectedConstructorsOfBaseType = false)
6773OverloadResolutionResult<MethodSymbol> overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
6774ImmutableArray<MethodSymbol> accessibleConstructors = GetAccessibleConstructorsForOverloadResolution(type, ref useSiteInfo);
6823out MemberResolutionResult<MethodSymbol> memberResolutionResult,
6824out ImmutableArray<MethodSymbol> candidateConstructors,
6843MemberResolutionResult<MethodSymbol> memberResolutionResult,
6844ImmutableArray<MethodSymbol> candidateConstructors,
6863this.CheckAndCoerceArguments<MethodSymbol>(node, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, out argToParams);
6870var method = memberResolutionResult.Member;
6928MemberResolutionResult<MethodSymbol> memberResolutionResult,
6929ImmutableArray<MethodSymbol> candidateConstructors,
6945this.CheckAndCoerceArguments<MethodSymbol>(node, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, argsToParamsOpt: out _);
7228out MemberResolutionResult<MethodSymbol> memberResolutionResult,
7229out ImmutableArray<MethodSymbol> candidateConstructors,
7235ImmutableArray<MethodSymbol> allInstanceConstructors;
7239OverloadResolutionResult<MethodSymbol> result = OverloadResolutionResult<MethodSymbol>.GetInstance();
7260OverloadResolutionResult<MethodSymbol> inaccessibleResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
7278default(MemberResolutionResult<MethodSymbol>); // Invalid results are not interesting - we have enough info in candidateConstructors.
7349private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
7351ImmutableArray<MethodSymbol> allInstanceConstructors;
7355private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, bool allowProtectedConstructorsOfBaseType, out ImmutableArray<MethodSymbol> allInstanceConstructors, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
8076var method = resolution.MethodGroup.Methods[0];
8246lookupResult.Symbols.All(s => s.Kind == SymbolKind.Method) ? lookupResult.Symbols.SelectAsArray(s_toMethodSymbolFunc) : ImmutableArray<MethodSymbol>.Empty,
8385var builder = ArrayBuilder<MethodSymbol>.GetInstance();
8388var m = s as MethodSymbol;
8832MethodSymbol method = methodGroup.Methods[i];
8873var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
8950MethodSymbol representativeMethod = methodResult.OverloadResolutionResult is { } methodResolution
9737else if (convertedIndex is BoundObjectCreationExpression { Constructor: MethodSymbol constructor, Arguments: { Length: 2 } arguments, ArgsToParamsOpt: { IsDefaultOrEmpty: true }, InitializerExpressionOpt: null } &&
10549var substring = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_String__Substring, diagnostics, syntax);
10580candidate is MethodSymbol method &&
10597void makeCall(SyntaxNode syntax, BoundExpression receiver, MethodSymbol method,
10623internal static bool MethodHasValidSliceSignature(MethodSymbol method)
10690property.GetOwnOrInheritedGetMethod()?.OriginalDefinition is MethodSymbol getMethod &&
10878var method = node.LookupSymbolOpt as MethodSymbol;
10916var result = OverloadResolutionResult<MethodSymbol>.GetInstance();
10942var method = GetUniqueSignatureFromMethodGroup(node, out bool useParams);
10959private MethodSymbol? GetUniqueSignatureFromMethodGroup_CSharp10(BoundMethodGroup node, out bool useParams)
10961MethodSymbol? method = null;
10962var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: node.Methods.Length);
10963foreach (var m in node.Methods)
10988foreach (var m in methods)
11026if (extensionMember is MethodSymbol m)
11031var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true);
11071foreach (var reduced in methods)
11105static bool isCandidateUnique(ref MethodSymbol? method, MethodSymbol candidate)
11123bool memberCountsAsStatic = extensionMember is MethodSymbol { IsExtensionMethod: true } ? false : extensionMember.IsStatic;
11140private MethodSymbol? GetUniqueSignatureFromMethodGroup(BoundMethodGroup node, out bool useParams)
11148MethodSymbol? foundMethod = null;
11155var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: node.Methods.Length);
11156foreach (var memberMethod in node.Methods)
11180var substituted = typeArguments.IsDefaultOrEmpty ? memberMethod : memberMethod.Construct(typeArguments);
11195foreach (var substituted in methods)
11228var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: singleLookupResults.Count);
11240if (extensionMember is MethodSymbol)
11242var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true);
11257foreach (var method in methods)
11283static bool isCandidateUnique(ref MethodSymbol? foundMethod, MethodSymbol candidate)
11298bool satisfiesConstraintChecks(MethodSymbol method)
11325MethodSymbol methodSymbol,
11445MethodSymbol invoke = possibleDelegateType.DelegateInvokeMethod();
11576return symbol is MethodSymbol method &&
Binder\Binder_Invocation.cs (36)
42private static ImmutableArray<MethodSymbol> GetOriginalMethods(OverloadResolutionResult<MethodSymbol> overloadResolutionResult)
52return ImmutableArray<MethodSymbol>.Empty;
55var builder = ArrayBuilder<MethodSymbol>.GetInstance();
356result = BindDynamicInvocation(node, boundExpression, analyzedArguments, ImmutableArray<MethodSymbol>.Empty, diagnostics, queryClause);
403ImmutableArray<MethodSymbol> applicableMethods,
642var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
673private static bool HasApplicableConditionalMethod(ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates)
749ImmutableArray<MethodSymbol> originalMethods;
768Debug.Assert(methodGroup.LookupSymbolOpt is not MethodSymbol);
885private void ReportDynamicInvocationWarnings(SyntaxNode syntax, BoundMethodGroup methodGroup, BindingDiagnosticBag diagnostics, ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates)
925MemberResolutionResult<MethodSymbol> methodResolutionResult,
926MethodSymbol singleCandidate)
981MemberResolutionResult<MethodSymbol> methodResolutionResult)
983MethodSymbol singleCandidate = methodResolutionResult.LeastOverriddenMember;
990var resultWithSingleCandidate = OverloadResolutionResult<MethodSymbol>.GetInstance();
1038(typeArgumentsOpt.IsDefault || ((MethodSymbol)(object)result.Member).CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, syntax.Location, candidateDiagnostics))))
1142OverloadResolutionResult<MethodSymbol> result,
1211var method = methodResult.Member;
1387var method = property.GetMethod ?? property.SetMethod;
1398internal ThreeState ReceiverIsSubjectToCloning(BoundExpression? receiver, MethodSymbol method)
1457if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_UnknownWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1466if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_DispatchWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1897internal bool CheckImplicitThisCopyInReadOnlyMember(BoundExpression receiver, MethodSymbol method, BindingDiagnosticBag diagnostics)
1903ContainingMemberOrLambda is MethodSymbol containingMethod &&
2033ImmutableArray<MethodSymbol> methods,
2041MethodSymbol method;
2045var constructedMethods = ArrayBuilder<MethodSymbol>.GetInstance();
2046foreach (var m in methods)
2048MethodSymbol constructedMethod;
2088private static bool IsUnboundGeneric(MethodSymbol method)
2108private ImmutableArray<BoundExpression> BuildArgumentsForErrorRecovery(AnalyzedArguments analyzedArguments, ImmutableArray<MethodSymbol> methods, BindingDiagnosticBag diagnostics)
2111foreach (var m in methods)
2319MethodSymbol method = new ErrorMethodSymbol(methodContainer, returnType, string.Empty);
2324var originalMethods = (expr.Kind == BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty;
2559BuildArgumentsForErrorRecovery(analyzedArguments, StaticCast<MethodSymbol>.From(methods), BindingDiagnosticBag.Discarded),
Binder\Binder_Operators.cs (76)
156ImmutableArray<MethodSymbol> originalUserDefinedOperators;
172ImmutableArray<MethodSymbol> staticExtensionOriginalUserDefinedOperators;
331ImmutableArray<MethodSymbol> originalUserDefinedOperators,
397ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceOperators(
430ArrayBuilder<MethodSymbol> methods,
436var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
478var method = overloadResolutionResult.ValidResult.Member;
526originalUserDefinedOperatorsOpt: ImmutableArray<MethodSymbol>.Empty,
533ImmutableArray<MethodSymbol> methodsArray = methods.ToImmutableAndFree();
587out ImmutableArray<MethodSymbol> staticOriginalUserDefinedOperators)
667ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
719MethodSymbol method = isAddition ? eventSymbol.AddMethod : eventSymbol.RemoveMethod;
823MethodSymbol userDefinedOperator = null;
1011ImmutableArray<MethodSymbol> originalUserDefinedOperators;
1138out ImmutableArray<MethodSymbol> originalUserDefinedOperators, out BinaryOperatorSignature resultSignature, out BinaryOperatorAnalysisResult best)
1143originalUserDefinedOperators = default(ImmutableArray<MethodSymbol>);
1162ref ImmutableArray<MethodSymbol> originalUserDefinedOperators,
1227ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
1475ImmutableArray<MethodSymbol> originalUserDefinedOperators;
1481originalUserDefinedOperators = default(ImmutableArray<MethodSymbol>);
1597private bool IsValidDynamicCondition(BoundExpression left, bool isNegative, BindingDiagnosticBag diagnostics, out MethodSymbol userDefinedOperator)
1773MethodSymbol definition;
2046out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2064out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2078ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
2105out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2165out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2185private static BinaryOperatorAnalysisResult BinaryOperatorAnalyzeOverloadResolutionResult(BinaryOperatorOverloadResolutionResult result, out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2191var builder = ArrayBuilder<MethodSymbol>.GetInstance();
2194MethodSymbol method = analysisResult.Signature.Method;
2217originalUserDefinedOperators = ImmutableArray<MethodSymbol>.Empty;
2224private void ReportObsoleteAndFeatureAvailabilityDiagnostics(MethodSymbol operatorMethod, SyntaxNode node, BindingDiagnosticBag diagnostics)
2267out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2284ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
2309out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2337out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2343var builder = ArrayBuilder<MethodSymbol>.GetInstance();
2346MethodSymbol method = analysisResult.Signature.Method;
2385originalUserDefinedOperators = ImmutableArray<MethodSymbol>.Empty;
2416out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
3298originalUserDefinedOperatorsOpt: default(ImmutableArray<MethodSymbol>),
3324ImmutableArray<MethodSymbol> originalUserDefinedOperators;
3338ImmutableArray<MethodSymbol> staticExtensionOriginalUserDefinedOperators;
3488ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceOperators(
3520ArrayBuilder<MethodSymbol> methods,
3529var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
3567var method = overloadResolutionResult.ValidResult.Member;
3611ImmutableArray<MethodSymbol>.Empty,
3618ImmutableArray<MethodSymbol> methodsArray = methods.ToImmutableAndFree();
3675out ImmutableArray<MethodSymbol> staticOriginalUserDefinedOperators)
3761ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
3777private ArrayBuilder<MethodSymbol>? LookupUserDefinedInstanceOperators(TypeSymbol lookupInType, string? checkedName, string ordinaryName, int parameterCount, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3782ArrayBuilder<MethodSymbol>? methods = null;
3790methods = ArrayBuilder<MethodSymbol>.GetInstance(lookupResult.Symbols.Count);
3803methods = ArrayBuilder<MethodSymbol>.GetInstance(lookupResult.Symbols.Count);
3808var existing = new HashSet<MethodSymbol>(PairedOperatorComparer.Instance);
3810foreach (var method in methods)
3815foreach (MethodSymbol method in lookupResult.Symbols)
3829static void appendViableMethods(LookupResult lookupResult, int parameterCount, ArrayBuilder<MethodSymbol> methods)
3831foreach (MethodSymbol method in lookupResult.Symbols)
3841private static bool IsViableInstanceOperator(MethodSymbol method, int parameterCount)
3848private ArrayBuilder<MethodSymbol>? LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
3855ArrayBuilder<MethodSymbol>? checkedMethods = null;
3863ArrayBuilder<MethodSymbol>? ordinaryMethods = null;
3874var existing = new HashSet<MethodSymbol>(OverloadResolution.PairedExtensionOperatorSignatureComparer.Instance);
3877foreach (MethodSymbol method in ordinaryMethods)
3893ref ArrayBuilder<MethodSymbol>? methods)
3900var typeOperators = ArrayBuilder<MethodSymbol>.GetInstance();
3903foreach (MethodSymbol op in typeOperators)
3925methods ??= ArrayBuilder<MethodSymbol>.GetInstance();
3934private class PairedOperatorComparer : IEqualityComparer<MethodSymbol>
3940public bool Equals(MethodSymbol x, MethodSymbol y)
3953public int GetHashCode([DisallowNull] MethodSymbol method)
3974private bool CheckConstraintLanguageVersionAndRuntimeSupportForOperator(SyntaxNode node, MethodSymbol? methodOpt, bool isUnsignedRightShift, TypeSymbol? constrainedToTypeOpt, BindingDiagnosticBag diagnostics)
4366ImmutableArray<MethodSymbol> originalUserDefinedOperators;
Binder\Binder_Patterns.cs (16)
988MethodSymbol? deconstructMethod = null;
1017ShouldUseITupleForRecursivePattern(node, declType, diagnostics, out var iTupleType, out var iTupleGetLength, out var iTupleGetItem))
1060private MethodSymbol? BindDeconstructSubpatterns(
1069var deconstructMethod = deconstruct.ExpressionSymbol as MethodSymbol;
1212[NotNullWhen(true)] out MethodSymbol? iTupleGetLength,
1213[NotNullWhen(true)] out MethodSymbol? iTupleGetItem)
1250[NotNullWhen(true)] out MethodSymbol? iTupleGetLength,
1251[NotNullWhen(true)] out MethodSymbol? iTupleGetItem)
1281iTupleGetLength = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Length);
1282iTupleGetItem = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Item);
1388MethodSymbol? deconstructMethod = null;
1413ShouldUseITuple(node, strippedInputType, diagnostics, out var iTupleType, out var iTupleGetLength, out var iTupleGetItem))
1426deconstructMethod = deconstruct.ExpressionSymbol as MethodSymbol;
Binder\Binder_Statements.cs (39)
219var method = (MethodSymbol)this.ContainingMemberOrLambda;
482new SourceLabelSymbol((MethodSymbol)ContainingMemberOrLambda, node.Identifier);
639private bool ImplicitReturnIsOkay(MethodSymbol method)
755/// Checks for a Dispose method on <paramref name="expr"/> and returns its <see cref="MethodSymbol"/> if found.
760/// <returns>The <see cref="MethodSymbol"/> of the Dispose method if one is found, otherwise null.</returns>
761internal MethodSymbol TryFindDisposePatternMethod(BoundExpression expr, SyntaxNode syntaxNode, bool hasAwait, BindingDiagnosticBag diagnostics, out bool isExpanded)
771out var disposeMethod,
1248MethodSymbol fixedPatternMethod = null;
1325private MethodSymbol GetFixedPatternMethodOpt(BoundExpression initializer, BindingDiagnosticBag additionalDiagnostics)
1334var result = PerformPatternMethodLookup(initializer, methodName, initializer.Syntax, additionalDiagnostics, out var patternMethodSymbol, out bool isExpanded);
1362MethodSymbol patternMethodOpt,
1838return (member as MethodSymbol)?.MethodKind == (isStatic ?
1943ImmutableArray<MethodSymbol>.CastUp(GetDeclaredLocalFunctionsForScope(node)),
2315ImmutableArray<MethodSymbol> originalUserDefinedConversions = conversion.OriginalUserDefinedConversions;
2752var best = this.UnaryOperatorOverloadResolution(UnaryOperatorKind.True, expr, node, diagnostics, ref discardedOperatorResolutionForReporting, out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators);
2978protected static bool IsInAsyncMethod(MethodSymbol method)
2985return IsInAsyncMethod(this.ContainingMemberOrLambda as MethodSymbol);
2991return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningTask(this.Compilation);
2997return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningGenericTask(this.Compilation);
3005var method = (MethodSymbol)symbol;
3014var symbol = this.ContainingMemberOrLambda as MethodSymbol;
3571var inferringLambda = this.ContainingMemberOrLambda is MethodSymbol method && (object)method.ReturnType == LambdaSymbol.ReturnTypeIsBeingInferred;
3754BoundExpression initializerInvocation = GetBinder(initializer).BindConstructorInitializer(initializer.ArgumentList, (MethodSymbol)this.ContainingMember(), diagnostics);
3775if (isInstanceConstructor(out MethodSymbol constructorSymbol) &&
3806bool isInstanceConstructor(out MethodSymbol constructorSymbol)
3808if (this.ContainingMember() is MethodSymbol { IsStatic: false } method)
3820BoundExpression initializerInvocation = GetBinder(initializer).BindConstructorInitializer(initializer.ArgumentList, (MethodSymbol)this.ContainingMember(), diagnostics);
3832initializerInvocation = BindImplicitConstructorInitializer((MethodSymbol)this.ContainingMember(), diagnostics, Compilation);
3840var constructorInitializer = new BoundExpressionStatement(ctorSyntax, initializerInvocation) { WasCompilerGenerated = ((MethodSymbol)ContainingMember()).IsImplicitlyDeclared };
3853MethodSymbol constructor, BindingDiagnosticBag diagnostics, CSharpCompilation compilation)
3960internal static BoundCall? GenerateBaseParameterlessConstructorInitializer(MethodSymbol constructor, BindingDiagnosticBag diagnostics)
3963MethodSymbol? baseConstructor = null;
3967foreach (MethodSymbol ctor in baseType.InstanceConstructors)
4029MethodSymbol? baseConstructor = SynthesizedRecordCopyCtor.FindCopyConstructor(baseType, containingType, ref useSiteInfo);
4147SyntaxNode syntaxNode, BindingDiagnosticBag diagnostics, out MethodSymbol result, out bool isExpanded)
4211var 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);
1059MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo.Method;
1097MethodSymbol getEnumeratorMethod;
1102getEnumeratorMethod = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerable_T__GetAsyncEnumerator,
1118getEnumeratorMethod = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerable_T__GetEnumerator, diagnostics, errorLocationSyntax);
1121MethodSymbol moveNextMethod = null;
1124MethodSymbol specificGetEnumeratorMethod = getEnumeratorMethod.AsMember(collectionType);
1135MethodSymbol currentPropertyGetter;
1140MethodSymbol moveNextAsync = (MethodSymbol)GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__MoveNextAsync,
1148currentPropertyGetter = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__get_Current, diagnostics, errorLocationSyntax.Location, isOptional: false);
1152currentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerator_T__get_Current, diagnostics, errorLocationSyntax);
1164moveNextMethod = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__MoveNext, diagnostics, errorLocationSyntax);
1179builder.CurrentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__get_Current, diagnostics, errorLocationSyntax);
1205MethodSymbol patternDisposeMethod = TryFindDisposePatternMethod(receiver, syntax, isAsync, patternDiagnostics, out bool expanded);
1311builder.CurrentPropertyGetter = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerator__get_Current, diagnostics, syntax);
1388ArrayBuilder<MethodSymbol> candidateMethods = ArrayBuilder<MethodSymbol>.GetInstance();
1403MethodSymbol method = (MethodSymbol)member;
1414candidateMethods.Add((MethodSymbol)member);
1429private MethodArgumentInfo PerformForEachPatternOverloadResolution(SyntaxNode syntax, SyntaxNode collectionSyntax, TypeSymbol patternType, ArrayBuilder<MethodSymbol> candidateMethods, bool warningsOnly, BindingDiagnosticBag diagnostics, bool isAsync)
1433var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
1448MethodSymbol result = null;
1533var result = overloadResolutionResult.ValidResult.Member;
1633MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo.Method;
1692MethodSymbol currentPropertyGetterCandidate = ((PropertySymbol)lookupSymbol).GetOwnOrInheritedGetMethod();
1735private bool IsInvalidMoveNextMethod(MethodSymbol moveNextMethodCandidate, bool isAsync)
1936var resolvedMember = (MethodSymbol)GetSpecialTypeMember(member, diagnostics, syntax);
1944private 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,
1468return ((MethodSymbol)member).HidesBaseMethodsByName;
1744ArrayBuilder<MemberResolutionResult<MethodSymbol>> results,
1745ImmutableArray<MethodSymbol> constructors,
1758foreach (MethodSymbol constructor in constructors)
1774RemoveLowerPriorityMembers<MemberResolutionResult<MethodSymbol>, MethodSymbol>(results);
3287MethodSymbol invoke;
3574MethodSymbol invoke1 = d1.DelegateInvokeMethod;
3575MethodSymbol invoke2 = d2.DelegateInvokeMethod;
3702MethodSymbol invoke1 = d1.DelegateInvokeMethod;
3703MethodSymbol invoke2 = d2.DelegateInvokeMethod;
4394if (member is MethodSymbol method)
4469(MethodSymbol)(Symbol)member,
4591Debug.Assert(candidate is MethodSymbol { MethodKind: MethodKind.UserDefinedOperator });
4787return (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)
296internal bool IsNullableAnalysisEnabledIn(MethodSymbol method)
352if (symbol is not MethodSymbol method)
589var methodSymbol = (debugEntryPoint as Symbols.PublicModel.MethodSymbol)?.UnderlyingMethodSymbol;
1922internal new MethodSymbol? GetEntryPoint(CancellationToken cancellationToken)
1961var entryPointMethod = FindEntryPoint(simpleProgramEntryPointSymbol, cancellationToken, out diagnostics);
1972private MethodSymbol? FindEntryPoint(MethodSymbol? simpleProgramEntryPointSymbol, CancellationToken cancellationToken, out ReadOnlyBindingDiagnostic<AssemblySymbol> sealedDiagnostics)
1976var entryPointCandidates = ArrayBuilder<MethodSymbol>.GetInstance();
2030foreach (var main in entryPointCandidates)
2051var taskEntryPoints = ArrayBuilder<(bool IsValid, MethodSymbol Candidate, BindingDiagnosticBag SpecificDiagnostics)>.GetInstance();
2058bool checkValid(MethodSymbol candidate, bool isCandidate, BindingDiagnosticBag specificDiagnostics)
2076var viableEntryPoints = ArrayBuilder<MethodSymbol>.GetInstance();
2078foreach (var candidate in entryPointCandidates)
2163MethodSymbol? entryPoint = null;
2177foreach (var viableEntryPoint in viableEntryPoints)
2217ArrayBuilder<MethodSymbol> entryPointCandidates, IEnumerable<Symbol> members)
2225if (member is MethodSymbol method && method.TryGetCorrespondingExtensionImplementationMethod() is { } implementationMethod)
2236static void addIfCandidate(ArrayBuilder<MethodSymbol> entryPointCandidates, Symbol member)
2238if (member is MethodSymbol method &&
2246internal bool ReturnsAwaitableToVoidOrInt(MethodSymbol method, BindingDiagnosticBag diagnostics)
2289internal (bool IsCandidate, bool IsTaskLike) HasEntryPointSignature(MethodSymbol method, BindingDiagnosticBag bag)
2343public readonly MethodSymbol? MethodSymbol;
2348public EntryPoint(MethodSymbol? methodSymbol, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics)
2502private ConcurrentSet<MethodSymbol>? _moduleInitializerMethods;
2504internal void AddModuleInitializerMethod(MethodSymbol method)
2532private ConcurrentDictionary<(ImmutableArray<byte> ContentHash, int Position), OneOrMany<(Location AttributeLocation, MethodSymbol Interceptor)>>? _interceptions;
2534internal void AddInterception(ImmutableArray<byte> contentHash, int position, Location attributeLocation, MethodSymbol interceptor)
2540() => new ConcurrentDictionary<(ImmutableArray<byte> ContentHash, int Position), OneOrMany<(Location AttributeLocation, MethodSymbol Interceptor)>>(comparer: InterceptorKeyComparer.Instance));
2561internal (Location AttributeLocation, MethodSymbol Interceptor)? TryGetInterceptor(SimpleNameSyntax? node)
3160if (symbol.Kind == SymbolKind.Method && symbol.IsImplicitlyDeclared && ((MethodSymbol)symbol).MethodKind == MethodKind.Constructor)
3592var entryPoint = MethodCompiler.GetEntryPoint(
3755foreach ((_, OneOrMany<(Location, MethodSymbol)> interceptionsOfAGivenLocation) in _interceptions)
3781foreach (MethodSymbol method in _moduleInitializerMethods.OrderBy<MethodSymbol>(LexicalOrderSymbolComparer.Instance))
Compilation\CSharpSemanticModel.cs (32)
1674if (symbol is MethodSymbol { IsExtensionMethod: true } extensionMethod)
1798case MethodSymbol { MethodKind: MethodKind.LambdaMethod }:
3502var methodSymbol = eventAssignment.IsAddition ? eventSymbol.AddMethod : eventSymbol.RemoveMethod;
3533var symbol = conversion.SymbolOpt;
3631memberGroup = dynamicInvocation.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3639memberGroup = collectionInit.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3659memberGroup = objectCreation.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3678memberGroup = boundObjectCreation.ConstructorsGroup.Cast<MethodSymbol, Symbol>();
3739return new ThisParameterSymbol(containingMember as MethodSymbol, typeOfThis);
3758thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, containingType);
3765thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, containingType);
3793thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, typeOfThis);
3947private static void GetSymbolsAndResultKind(BoundExpression node, Symbol symbolOpt, ImmutableArray<MethodSymbol> originalCandidates, out OneOrMany<Symbol> symbols, out LookupResultKind resultKind)
3978MethodSymbol constructor = null;
4024MethodSymbol constructorOpt,
4041ImmutableArray<MethodSymbol> candidateConstructors;
4062candidateConstructors = ImmutableArray<MethodSymbol>.Empty;
4077memberGroup = candidateConstructors.Cast<MethodSymbol, Symbol>();
4203private static ImmutableArray<MethodSymbol> FilterOverriddenOrHiddenMethods(ImmutableArray<MethodSymbol> methods)
4212foreach (MethodSymbol method in methods)
4305MethodSymbol method = null;
4334symbols = OneOrMany.Create(dynamicInvocation.ApplicableMethods.Cast<MethodSymbol, Symbol>());
4582ImmutableArray<MethodSymbol> nonHiddenMethods = FilterOverriddenOrHiddenMethods(node.Methods);
4585foreach (var method in nonHiddenMethods)
4644if (singleLookupResult.Symbol is not (MethodSymbol or PropertySymbol))
4771foreach (var method in FilterOverriddenOrHiddenMethods(methods))
4786var method = call.Method;
4793MethodSymbol reduced = method.ReduceExtensionMethod(receiver.Type, Compilation);
4803var method = delegateCreation.MethodOpt;
4808MethodSymbol reduced = method.ReduceExtensionMethod(receiverOpt.Type, Compilation);
5242if (node.GetInterceptableNameSyntax() is { } nameSyntax && Compilation.TryGetInterceptor(nameSyntax) is (_, MethodSymbol interceptor))
Compilation\MemberSemanticModel.SpeculativeMemberSemanticModel.cs (2)
52return NullableWalker.AnalyzeAndRewrite(Compilation, MemberSymbol as MethodSymbol, boundRoot, binder, initialState: null, diagnostics, createSnapshots: false, out snapshotManager, ref remappedSymbols);
57NullableWalker.AnalyzeWithoutRewrite(Compilation, MemberSymbol as MethodSymbol, boundRoot, binder, diagnostics, createSnapshots);
Compilation\MethodBodySemanticModel.cs (15)
44MethodSymbol owner,
61internal static MethodBodySemanticModel Create(SyntaxTreeSemanticModel containingSemanticModel, MethodSymbol owner, InitialState initialState)
112MethodSymbol owner,
124MethodSymbol owner,
137internal static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, ArrowExpressionClauseSyntax syntax, Binder rootBinder, int position)
145internal static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, ConstructorInitializerSyntax syntax, Binder rootBinder, int position)
153internal static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, PrimaryConstructorBaseTypeSyntax syntax, Binder rootBinder, int position)
168var methodSymbol = (MethodSymbol)this.MemberSymbol;
212var methodSymbol = (MethodSymbol)this.MemberSymbol;
230var methodSymbol = (MethodSymbol)this.MemberSymbol;
240if (MemberSymbol is MethodSymbol methodSymbol && methodSymbol.MethodKind == MethodKind.Constructor &&
305return Compilation.IsNullableAnalysisEnabledIn((MethodSymbol)MemberSymbol);
Compiler\MethodCompiler.cs (28)
136MethodSymbol? entryPoint = null;
226internal static MethodSymbol GetEntryPoint(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuilt, bool hasDeclarationErrors, bool emitMethodBodies, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken)
234var entryPoint = entryPointAndDiagnostics.MethodSymbol;
527MethodSymbol method = (MethodSymbol)member;
609foreach (var method in AnonymousTypeManager.GetAnonymousTypeHiddenMethods(containingType))
625MethodSymbol method = new SynthesizedStaticConstructor(sourceTypeSymbol);
680internal static MethodSymbol GetMethodToCompile(MethodSymbol method)
698var method = (MethodSymbol)definition.GetInternalSymbol();
717foreach (var method in additionalType.GetMethodsToEmit())
758var method = methodWithBody.Method;
903public override object VisitMethod(MethodSymbol symbol, TypeCompilationState arg)
924MethodSymbol methodSymbol,
1412private void EmitSkeletonMethodInExtension(MethodSymbol methodSymbol)
1424var ctor = (MethodSymbol)Binder.GetWellKnownTypeMember(_compilation, WellKnownMember.System_NotSupportedException__ctor, _diagnostics, syntax: syntax, isOptional: false);
1470private static MethodSymbol GetSymbolForEmittedBody(MethodSymbol methodSymbol)
1477MethodSymbol method,
1633MethodSymbol method,
1674MethodSymbol kickoffMethod;
1757MethodSymbol methodBodyParentSymbol = GetSymbolForEmittedBody(method);
1867internal static BoundBlock? BindSynthesizedMethodBody(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
1884MethodSymbol method,
2483private static BoundStatement BindImplicitConstructorInitializerIfAny(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
2507private static void ReportCtorInitializerCycles(MethodSymbol method, BoundExpression initializerInvocation, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
Compiler\TypeCompilationState.cs (19)
29public readonly MethodSymbol Method;
33internal MethodWithBody(MethodSymbol method, BoundStatement body, ImportChain? importChain)
52private Dictionary<MethodSymbol, MethodSymbol>? _wrappers;
80private SmallDictionary<MethodSymbol, MethodSymbol>? _constructorInitializers;
133public void AddSynthesizedMethod(MethodSymbol method, BoundStatement body)
150public void AddMethodWrapper(MethodSymbol method, MethodSymbol wrapper, BoundStatement body)
156_wrappers = new Dictionary<MethodSymbol, MethodSymbol>();
175public MethodSymbol? GetMethodWrapper(MethodSymbol method)
177MethodSymbol? wrapper = null;
202internal void ReportCtorInitializerCycles(MethodSymbol method1, MethodSymbol method2, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
217_constructorInitializers = new SmallDictionary<MethodSymbol, MethodSymbol>();
222MethodSymbol? next = method2;
Emitter\Model\PEModuleBuilder.cs (29)
28internal abstract class PEModuleBuilder : PEModuleBuilder<CSharpCompilation, SourceModuleSymbol, AssemblySymbol, TypeSymbol, NamedTypeSymbol, MethodSymbol, SyntaxNode, NoPia.EmbeddedTypesManager, ModuleCompilationState>
401var method = (MethodSymbol)member;
510internal virtual VariableSlotAllocator TryCreateVariableSlotAllocator(MethodSymbol method, MethodSymbol topLevelMethod, DiagnosticBag diagnostics)
515internal virtual MethodInstrumentation GetMethodBodyInstrumentations(MethodSymbol method)
993return ((MethodSymbol)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__InitializeArrayArrayRuntimeFieldHandle))?.GetCciAdapter();
1355internal sealed override Cci.IMethodReference Translate(MethodSymbol symbol, DiagnosticBag diagnostics, bool needDeclaration)
1361MethodSymbol methodSymbol,
1395MethodSymbol methodSymbol,
1455else if (methodSymbol is NativeIntegerMethodSymbol { UnderlyingMethod: MethodSymbol underlyingMethod })
1471MethodSymbol methodSymbol,
1583return container.Kind == SymbolKind.Method && ((MethodSymbol)container).IsGenericMethod ||
1996internal MethodSymbol EnsureThrowSwitchExpressionExceptionExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
2009private MethodSymbol EnsurePrivateImplClassMethodExists<TArg>(SyntaxNode syntaxNode, string methodName, Func<SynthesizedPrivateImplementationDetailsType, TArg, MethodSymbol> createMethodSymbol, TArg arg, DiagnosticBag diagnostics)
2016return (MethodSymbol)methodAdapter.GetInternalSymbol()!;
2019MethodSymbol methodSymbol = createMethodSymbol(privateImplClass, arg);
2024return (MethodSymbol)privateImplClass.PrivateImplementationDetails.GetMethod(methodName)!.GetInternalSymbol()!;
2043internal MethodSymbol EnsureThrowSwitchExpressionExceptionParameterlessExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
2063internal MethodSymbol EnsureThrowInvalidOperationExceptionExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, DiagnosticBag diagnostics)
2080internal MethodSymbol EnsureInlineArrayAsSpanExists(SyntaxNode syntaxNode, NamedTypeSymbol spanType, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2116var attributeConstructor = (MethodSymbol)arg.factory.SpecialMember(SpecialMember.System_Runtime_CompilerServices_InlineArrayAttribute__ctor);
2151internal MethodSymbol EnsureInlineArrayAsReadOnlySpanExists(SyntaxNode syntaxNode, NamedTypeSymbol spanType, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2168internal MethodSymbol EnsureInlineArrayElementRefExists(SyntaxNode syntaxNode, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2184internal MethodSymbol EnsureInlineArrayElementRefReadOnlyExists(SyntaxNode syntaxNode, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2200internal MethodSymbol EnsureInlineArrayFirstElementRefExists(SyntaxNode syntaxNode, DiagnosticBag diagnostics)
2213internal 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)
2120protected virtual void PropertySetter(BoundExpression node, BoundExpression receiver, MethodSymbol setter, BoundExpression value = null)
2147var method = GetWriteMethod(property);
2202var readMethod = GetReadMethod(property);
2221var writeMethod = GetWriteMethod(property);
2281var method = GetReadMethod(property);
2838var readMethod = GetReadMethod(property);
2839var writeMethod = GetWriteMethod(property);
3042var method = conversion.Method;
3619MethodSymbol method = null;
3720private static MethodSymbol GetReadMethod(PropertySymbol property) =>
3723private static MethodSymbol GetWriteMethod(PropertySymbol property) =>
3747var readMethod = property.GetOwnOrInheritedGetMethod();
3805var 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;
3397private Variables GetOrCreateNestedFunctionVariables(Variables container, MethodSymbol lambdaOrLocalFunction)
3399_nestedFunctionVariables ??= PooledDictionary<MethodSymbol, Variables>.GetInstance();
3411MethodSymbol lambdaOrFunctionSymbol,
3413MethodSymbol? delegateInvokeMethod,
3425var oldDelegateInvokeMethod = _delegateInvokeMethod;
3791var invokeMethod = n.DelegateInvokeMethod;
3923var addMethod = initializer.AddMethod;
3924MethodSymbol reinferredAddMethod;
3927reinferredAddMethod = (MethodSymbol)AsMemberOfType(targetCollectionType, addMethod);
4025var createMethod = node.CollectionBuilderMethod;
4041var createMethod = node.CollectionBuilderMethod;
4089MethodSymbol? constructor = getConstructor(node, node.Type);
4092(_, ImmutableArray<VisitResult> argumentResults, _, ArgumentsCompletionDelegate<MethodSymbol>? argumentsCompletion) =
4101(int slot, NullableFlowState resultState, Func<TypeSymbol, MethodSymbol?, int>? initialStateInferenceCompletion) =
4118ArgumentsCompletionDelegate<MethodSymbol>? argumentsCompletion,
4119Func<TypeSymbol, MethodSymbol?, int>? initialStateInferenceCompletion,
4147ArgumentsCompletionDelegate<MethodSymbol> argumentsCompletion,
4148Func<TypeSymbol, MethodSymbol?, int> initialStateInferenceCompletion,
4160MethodSymbol? constructor = getConstructor(node, type);
4172static MethodSymbol? getConstructor(BoundObjectCreationExpressionBase node, TypeSymbol type)
4174var constructor = node.Constructor;
4178constructor = (MethodSymbol)AsMemberOfType(type, constructor);
4184(int slot, NullableFlowState resultState, Func<TypeSymbol, MethodSymbol?, int>? completion) inferInitialObjectState(
4185BoundExpression node, TypeSymbol type, MethodSymbol? constructor,
4255Func<TypeSymbol, MethodSymbol?, int> inferInitialObjectStateAsContinuation(
4261return (TypeSymbol type, MethodSymbol? constructor) =>
4577MethodSymbol addMethod = addMethodAsMemberOfContainingType(node, containingType, ref argumentResults);
4580(MethodSymbol? reinferredMethod,
4583ArgumentsCompletionDelegate<MethodSymbol>? visitArgumentsCompletion) =
4610MethodSymbol? reinferredMethod,
4612ArgumentsCompletionDelegate<MethodSymbol>? visitArgumentsCompletion,
4637ArgumentsCompletionDelegate<MethodSymbol> visitArgumentsCompletion)
4641MethodSymbol addMethod = addMethodAsMemberOfContainingType(node, containingType, ref argumentResults);
4649static MethodSymbol addMethodAsMemberOfContainingType(BoundCollectionElementInitializer node, TypeSymbol containingType, ref ImmutableArray<VisitResult> argumentResults)
4651var method = node.AddMethod;
4675method = (MethodSymbol)AsMemberOfType(containingType, method);
5110private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType)
5349MethodSymbol? method,
5372MethodSymbol reinferredMethod = ReInferBinaryOperator(binary.Syntax, method, leftOperand, rightOperand, leftUnderlyingType, rightUnderlyingType);
5429private MethodSymbol ReInferBinaryOperator(
5431MethodSymbol method,
5438MethodSymbol reinferredMethod;
5444reinferredMethod = (MethodSymbol)AsMemberOfType(asMemberOfType, method);
6660(MethodSymbol method, ImmutableArray<VisitResult> results, bool returnNotNull) = ReInferMethodAndVisitArguments(
6686private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method)
6700private (MethodSymbol method, ImmutableArray<VisitResult> results, bool returnNotNull) ReInferMethodAndVisitArguments(
6704MethodSymbol method,
6720method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
6729(var newMethod, results, returnNotNull) = VisitArguments(node, arguments, refKindsOpt, parameters, argsToParamsOpt, defaultArguments,
6748static ImmutableArray<ParameterSymbol> getParameters(ImmutableArray<ParameterSymbol> parameters, bool isNewExtension, MethodSymbol method)
6763MethodSymbol method, int argumentCount)
6788private static RefKind GetExtensionReceiverRefKind(MethodSymbol method)
6820private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results)
6858static bool anyOverriddenMethodHasExplicitImplementation(MethodSymbol method)
6860for (var overriddenMethod = method; overriddenMethod is object; overriddenMethod = overriddenMethod.OverriddenMethod)
6871static bool isWellKnownEqualityMethodOrImplementation(CSharpCompilation compilation, MethodSymbol method, TypeSymbol? receiverType, WellKnownMember wellKnownMember)
6873var wellKnownMethod = (MethodSymbol?)compilation.GetWellKnownTypeMember(wellKnownMember);
6882var constructedMethod = wellKnownMethod.AsMember(constructedType);
6907for (var overriddenMethod = method; overriddenMethod is object; overriddenMethod = overriddenMethod.OverriddenMethod)
6985private bool IsCompareExchangeMethod(MethodSymbol? method)
7057private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method)
7090private TypeWithState GetReturnTypeWithState(MethodSymbol method)
7228protected override void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method, ImmutableArray<int> argsToParamsOpt, bool expanded)
7234private (MethodSymbol? method, ImmutableArray<VisitResult> results, bool returnNotNull) VisitArguments(
7238MethodSymbol? method,
7361if (member is MethodSymbol reinferredMethod)
7381var method = member as MethodSymbol;
7629private void ApplyMemberPostConditions(BoundExpression? receiverOpt, MethodSymbol? method)
7653private int GetReceiverSlotForMemberPostConditions(MethodSymbol? method)
7665MethodSymbol? current = method;
7666while (current.ContainingSymbol is MethodSymbol container)
7683private void ApplyMemberPostConditions(int receiverSlot, MethodSymbol method)
8515internal override TypeWithAnnotations GetMethodGroupResultType(BoundMethodGroup group, MethodSymbol method)
8521method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
8605private void CheckMethodConstraints(SyntaxNode syntax, MethodSymbol method)
8816if (((MethodSymbol)symbol).MethodKind == MethodKind.LocalFunction)
8889if (result is MethodSymbol resultMethod && resultMethod.IsGenericMethod)
8891result = resultMethod.Construct(((MethodSymbol)symbol).TypeArgumentsWithAnnotations);
9270private void ReportNullabilityMismatchWithTargetDelegate(Location location, TypeSymbol targetType, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool invokedAsExtensionMethod)
9288void reportBadDelegateReturn(BindingDiagnosticBag bag, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool topLevel, (TypeSymbol targetType, Location location) arg)
9295void reportBadDelegateParameter(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameter, bool topLevel, (TypeSymbol targetType, Location location) arg)
9306MethodSymbol? targetInvokeMethod = delegateType.DelegateInvokeMethod;
9359void reportBadDelegateReturn(BindingDiagnosticBag bag, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool topLevel, Location location)
9366void reportBadDelegateParameter(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameterSymbol, bool topLevel, Location location)
9480var method = conversion.Method;
9497static (MethodSymbol invokeSignature, ImmutableArray<ParameterSymbol>) getDelegateOrFunctionPointerInfo(TypeSymbol targetType)
10020var method = conversion.Method;
10320var method = node.MethodOpt;
10450private MethodSymbol CheckMethodGroupReceiverNullability(BoundMethodGroup group, ImmutableArray<ParameterSymbol> parameters, MethodSymbol method, bool invokedAsExtensionMethod)
10460method = (MethodSymbol)AsMemberOfType(receiverType.Type, method);
10524var delegateInvokeMethod = delegateTypeOpt?.DelegateInvokeMethod;
10540private static void UseDelegateInvokeParameterAndReturnTypes(BoundLambda lambda, MethodSymbol? delegateInvokeMethod, out bool useDelegateInvokeParameterTypes, out bool useDelegateInvokeReturnType)
10842deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.Type, deconstructMethod);
11158MethodSymbol? incrementOperator = (node.OperatorKind.IsUserDefined() && node.MethodOpt?.ParameterCount == 1) ? node.MethodOpt : null;
11651var getMethod = ((PropertySymbol)member.OriginalDefinition).GetMethod;
11672var getValue = (MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Nullable_T_get_Value);
11737MethodSymbol? reinferredGetEnumeratorMethod = null;
11855reinferredGetEnumeratorMethod = (MethodSymbol)AsMemberOfType(getEnumeratorType, enumeratorInfoOpt.GetEnumeratorInfo.Method);
11868var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.Type, enumeratorInfoOpt.CurrentPropertyGetter);
11877var moveNextAsyncMethod = (MethodSymbol)AsMemberOfType(reinferredGetEnumeratorMethod.ReturnType, enumeratorInfoOpt.MoveNextInfo.Method);
11893var disposeAsyncMethod = (MethodSymbol)AsMemberOfType(reinferredGetEnumeratorMethod.ReturnType, originalDisposeMethod);
12106node.MethodOpt is MethodSymbol method &&
12151private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType)
12155method = (MethodSymbol)AsMemberOfType(operandType.Type!.StrippedType(), method);
12328MethodSymbol logicalOperator = binary.LogicalOperator;
12331MethodSymbol reInferredMethod = ReInferBinaryOperator(binary.Syntax, logicalOperator, leftOperand, rightOperand, leftUnderlyingType, rightUnderlyingType);
12344MethodSymbol trueFalseOperator = isAnd ? binary.FalseOperator : binary.TrueOperator;
12347var updatedTrueFalseOperator = ReInferUnaryOperator(leftOperand.Syntax, trueFalseOperator, binary.Left, leftType);
12399var getResult = awaitableInfo.GetResult;
12400var reinferredGetResult = _visitResult.RValueType.Type is NamedTypeSymbol taskAwaiterType
12952var method = (MethodSymbol)CurrentSymbol;
13606var variables = (symbol.ContainingSymbol is MethodSymbol containingMethod ? _variables.GetVariablesForMethodScope(containingMethod) : null) ??
Generated\BoundNodes.xml.Generated.cs (232)
1177public BoundUnaryOperator(SyntaxNode syntax, UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1197public MethodSymbol? MethodOpt { get; }
1200public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1205public BoundUnaryOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
1219public 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)
1241public MethodSymbol? MethodOpt { get; }
1248public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1253public 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)
1328public BoundFunctionPointerLoad(SyntaxNode syntax, MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type, bool hasErrors)
1339public BoundFunctionPointerLoad(SyntaxNode syntax, MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type)
1350public MethodSymbol TargetMethod { get; }
1357public BoundFunctionPointerLoad Update(MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type)
1477public BoundRefTypeOperator(SyntaxNode syntax, BoundExpression operand, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors = false)
1490public MethodSymbol? GetTypeFromHandle { get; }
1495public BoundRefTypeOperator Update(BoundExpression operand, MethodSymbol? getTypeFromHandle, TypeSymbol type)
1571public BoundFromEndIndexExpression(SyntaxNode syntax, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
1584public MethodSymbol? MethodOpt { get; }
1589public BoundFromEndIndexExpression Update(BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol type)
1603public BoundRangeExpression(SyntaxNode syntax, BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
1617public MethodSymbol? MethodOpt { get; }
1622public BoundRangeExpression Update(BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type)
1731public 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)
1758public MethodSymbol LogicalOperator { get; }
1759public MethodSymbol TrueOperator { get; }
1760public MethodSymbol FalseOperator { get; }
1765public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1770public 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)
1784public 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)
1812public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1817public BoundCompoundAssignmentOperator Update(BinaryOperatorSignature @operator, BoundExpression left, BoundExpression right, BoundValuePlaceholder? leftPlaceholder, BoundExpression? leftConversion, BoundValuePlaceholder? finalPlaceholder, BoundExpression? finalConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
2147public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder, bool hasErrors = false)
2167public MethodSymbol? GetResult { get; }
2174public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder)
2223protected BoundTypeOf(BoundKind kind, SyntaxNode syntax, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors)
2232protected BoundTypeOf(BoundKind kind, SyntaxNode syntax, MethodSymbol? getTypeFromHandle, TypeSymbol type)
2242public MethodSymbol? GetTypeFromHandle { get; }
2247public BoundTypeOfOperator(SyntaxNode syntax, BoundTypeExpression sourceType, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors = false)
2262public BoundTypeOfOperator Update(BoundTypeExpression sourceType, MethodSymbol? getTypeFromHandle, TypeSymbol type)
2308public BoundMethodDefIndex(SyntaxNode syntax, MethodSymbol method, TypeSymbol type, bool hasErrors)
2322public BoundMethodDefIndex(SyntaxNode syntax, MethodSymbol method, TypeSymbol type)
2333public MethodSymbol Method { get; }
2338public BoundMethodDefIndex Update(MethodSymbol method, TypeSymbol type)
2726public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type, bool hasErrors)
2737public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
2749public MethodSymbol Method { get; }
2750public MethodSymbol? GetMethodFromHandle { get; }
2755public BoundMethodInfo Update(MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
2769public BoundFieldInfo(SyntaxNode syntax, FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type, bool hasErrors)
2780public BoundFieldInfo(SyntaxNode syntax, FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type)
2793public MethodSymbol? GetFieldFromHandle { get; }
2798public BoundFieldInfo Update(FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type)
3016public BoundReadOnlySpanFromArray(SyntaxNode syntax, BoundExpression operand, MethodSymbol conversionMethod, TypeSymbol type, bool hasErrors = false)
3030public MethodSymbol ConversionMethod { get; }
3035public BoundReadOnlySpanFromArray Update(BoundExpression operand, MethodSymbol conversionMethod, TypeSymbol type)
3115public BoundFixedLocalCollectionInitializer(SyntaxNode syntax, TypeSymbol elementPointerType, BoundValuePlaceholder? elementPointerPlaceholder, BoundExpression? elementPointerConversion, BoundExpression expression, MethodSymbol? getPinnableOpt, TypeSymbol type, bool hasErrors = false)
3135public MethodSymbol? GetPinnableOpt { get; }
3140public BoundFixedLocalCollectionInitializer Update(TypeSymbol elementPointerType, BoundValuePlaceholder? elementPointerPlaceholder, BoundExpression? elementPointerConversion, BoundExpression expression, MethodSymbol? getPinnableOpt, TypeSymbol type)
3325public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3340public ImmutableArray<MethodSymbol> LocalFunctions { get; }
3347public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements)
3527public BoundLocalFunctionStatement(SyntaxNode syntax, MethodSymbol symbol, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false)
3538public MethodSymbol Symbol { get; }
3545public BoundLocalFunctionStatement Update(MethodSymbol symbol, BoundBlock? blockBody, BoundBlock? expressionBody)
3795public BoundSwitchStatement(SyntaxNode syntax, BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<MethodSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, LabelSymbol breakLabel, bool hasErrors = false)
3817public ImmutableArray<MethodSymbol> InnerLocalFunctions { get; }
3826public BoundSwitchStatement Update(BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<MethodSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, LabelSymbol breakLabel)
5407public BoundDagDeconstructEvaluation(SyntaxNode syntax, MethodSymbol deconstructMethod, BoundDagTemp input, bool hasErrors = false)
5417public MethodSymbol DeconstructMethod { get; }
5422public BoundDagDeconstructEvaluation Update(MethodSymbol deconstructMethod, BoundDagTemp input)
5916public BoundDynamicInvocation(SyntaxNode syntax, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false)
5933public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
5938public BoundDynamicInvocation Update(ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type)
5985public BoundLoweredConditionalAccess(SyntaxNode syntax, BoundExpression receiver, MethodSymbol? hasValueMethodOpt, BoundExpression whenNotNull, BoundExpression? whenNullOpt, int id, bool forceCopyOfNullableValueType, TypeSymbol type, bool hasErrors = false)
6003public MethodSymbol? HasValueMethodOpt { get; }
6012public BoundLoweredConditionalAccess Update(BoundExpression receiver, MethodSymbol? hasValueMethodOpt, BoundExpression whenNotNull, BoundExpression? whenNullOpt, int id, bool forceCopyOfNullableValueType, TypeSymbol type)
6097public 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)
6115public ImmutableArray<MethodSymbol> Methods { get; }
6124public BoundMethodGroup Update(ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, string name, ImmutableArray<MethodSymbol> methods, Symbol? lookupSymbolOpt, DiagnosticInfo? lookupError, BoundMethodGroupFlags? flags, FunctionTypeSymbol? functionType, BoundExpression? receiverOpt, LookupResultKind resultKind)
6166public 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)
6196public MethodSymbol Method { get; }
6206public ImmutableArray<MethodSymbol> OriginalMethodsOpt { get; }
6211public 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)
6264public 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)
6283public MethodSymbol? Constructor { get; }
6295public BoundAttribute Update(MethodSymbol? constructor, ImmutableArray<BoundExpression> constructorArguments, ImmutableArray<string?> constructorArgumentNamesOpt, ImmutableArray<int> constructorArgumentsToParamsOpt, bool constructorExpanded, BitVector constructorDefaultArguments, ImmutableArray<BoundAssignmentOperator> namedArguments, LookupResultKind resultKind, TypeSymbol type)
6368public 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)
6390public override MethodSymbol Constructor { get; }
6391public ImmutableArray<MethodSymbol> ConstructorsGroup { get; }
6405public 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)
6460public 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)
6482public MethodSymbol? CollectionBuilderMethod { get; }
6491public BoundCollectionExpression Update(CollectionExpressionTypeKind collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundValuePlaceholder? collectionBuilderInvocationPlaceholder, BoundExpression? collectionBuilderInvocationConversion, bool wasTargetTyped, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type)
6648public 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)
6671public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
6677public BoundDynamicObjectCreationExpression Update(string name, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, ImmutableArray<MethodSymbol> applicableMethods, bool wasTargetTyped, TypeSymbol type)
6892public 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)
6911public MethodSymbol AddMethod { get; }
6923public BoundCollectionElementInitializer Update(MethodSymbol addMethod, ImmutableArray<BoundExpression> arguments, BoundExpression? implicitReceiverOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, bool invokedAsExtensionMethod, LookupResultKind resultKind, TypeSymbol type)
6937public BoundDynamicCollectionElementInitializer(SyntaxNode syntax, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false)
6950public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
6955public BoundDynamicCollectionElementInitializer Update(ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type)
7004public BoundAnonymousObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<BoundAnonymousPropertyDeclaration> declarations, TypeSymbol type, bool hasErrors = false)
7019public MethodSymbol Constructor { get; }
7026public BoundAnonymousObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<BoundAnonymousPropertyDeclaration> declarations, TypeSymbol type)
7110public BoundDelegateCreationExpression(SyntaxNode syntax, BoundExpression argument, MethodSymbol? methodOpt, bool isExtensionMethod, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false)
7125public MethodSymbol? MethodOpt { get; }
7132public BoundDelegateCreationExpression Update(BoundExpression argument, MethodSymbol? methodOpt, bool isExtensionMethod, bool wasTargetTyped, TypeSymbol type)
7619public BoundLambda(SyntaxNode syntax, UnboundLambda unboundLambda, MethodSymbol symbol, BoundBlock body, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics, Binder binder, TypeSymbol? type, bool hasErrors = false)
7636public MethodSymbol Symbol { get; }
7645public BoundLambda Update(UnboundLambda unboundLambda, MethodSymbol symbol, BoundBlock body, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics, Binder binder, TypeSymbol? type)
8178public 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)
8197public MethodSymbol? DeconstructMethod { get; }
8205public BoundRecursivePattern Update(BoundTypeExpression? declaredType, MethodSymbol? deconstructMethod, ImmutableArray<BoundPositionalSubpattern> deconstruction, ImmutableArray<BoundPropertySubpattern> properties, bool isExplicitNotNullTest, Symbol? variable, BoundExpression? variableAccess, TypeSymbol inputType, TypeSymbol narrowedType)
8302public BoundITuplePattern(SyntaxNode syntax, MethodSymbol getLengthMethod, MethodSymbol getItemMethod, ImmutableArray<BoundPositionalSubpattern> subpatterns, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false)
8321public MethodSymbol GetLengthMethod { get; }
8322public MethodSymbol GetItemMethod { get; }
8328public BoundITuplePattern Update(MethodSymbol getLengthMethod, MethodSymbol getItemMethod, ImmutableArray<BoundPositionalSubpattern> subpatterns, TypeSymbol inputType, TypeSymbol narrowedType)
8858public BoundWithExpression(SyntaxNode syntax, BoundExpression receiver, MethodSymbol? cloneMethod, BoundObjectInitializerExpressionBase initializerExpression, TypeSymbol type, bool hasErrors = false)
8873public MethodSymbol? CloneMethod { get; }
8879public BoundWithExpression Update(BoundExpression receiver, MethodSymbol? cloneMethod, BoundObjectInitializerExpressionBase initializerExpression, TypeSymbol type)
11011MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11012ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11020MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11021ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11045MethodSymbol targetMethod = this.VisitMethodSymbol(node.TargetMethod);
11072MethodSymbol? getTypeFromHandle = this.VisitMethodSymbol(node.GetTypeFromHandle);
11091MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11098MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11120MethodSymbol logicalOperator = this.VisitMethodSymbol(node.LogicalOperator);
11121MethodSymbol trueOperator = this.VisitMethodSymbol(node.TrueOperator);
11122MethodSymbol falseOperator = this.VisitMethodSymbol(node.FalseOperator);
11123ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11134ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11213MethodSymbol? getResult = this.VisitMethodSymbol(node.GetResult);
11229MethodSymbol? getTypeFromHandle = this.VisitMethodSymbol(node.GetTypeFromHandle);
11243MethodSymbol method = this.VisitMethodSymbol(node.Method);
11303MethodSymbol method = this.VisitMethodSymbol(node.Method);
11304MethodSymbol? getMethodFromHandle = this.VisitMethodSymbol(node.GetMethodFromHandle);
11311MethodSymbol? getFieldFromHandle = this.VisitMethodSymbol(node.GetFieldFromHandle);
11356MethodSymbol conversionMethod = this.VisitMethodSymbol(node.ConversionMethod);
11374MethodSymbol? getPinnableOpt = this.VisitMethodSymbol(node.GetPinnableOpt);
11398ImmutableArray<MethodSymbol> localFunctions = this.VisitDeclaredLocalFunctions(node.LocalFunctions);
11436MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
11476ImmutableArray<MethodSymbol> innerLocalFunctions = this.VisitDeclaredLocalFunctions(node.InnerLocalFunctions);
11769MethodSymbol deconstructMethod = this.VisitMethodSymbol(node.DeconstructMethod);
11867ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
11882MethodSymbol? hasValueMethodOpt = this.VisitMethodSymbol(node.HasValueMethodOpt);
11903ImmutableArray<MethodSymbol> methods = this.VisitSymbols<MethodSymbol>(node.Methods);
11919MethodSymbol method = this.VisitMethodSymbol(node.Method);
11920ImmutableArray<MethodSymbol> originalMethodsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalMethodsOpt);
11936MethodSymbol? constructor = this.VisitMethodSymbol(node.Constructor);
11950MethodSymbol constructor = this.VisitMethodSymbol(node.Constructor);
11951ImmutableArray<MethodSymbol> constructorsGroup = this.VisitSymbols<MethodSymbol>(node.ConstructorsGroup);
11965MethodSymbol? collectionBuilderMethod = this.VisitMethodSymbol(node.CollectionBuilderMethod);
12005ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
12047MethodSymbol addMethod = this.VisitMethodSymbol(node.AddMethod);
12055ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
12068MethodSymbol constructor = this.VisitMethodSymbol(node.Constructor);
12088MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
12186MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
12283MethodSymbol? deconstructMethod = this.VisitMethodSymbol(node.DeconstructMethod);
12318MethodSymbol getLengthMethod = this.VisitMethodSymbol(node.GetLengthMethod);
12319MethodSymbol getItemMethod = this.VisitMethodSymbol(node.GetItemMethod);
12426MethodSymbol? cloneMethod = this.VisitMethodSymbol(node.CloneMethod);
12733MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12735ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12753MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12755ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12811MethodSymbol targetMethod = GetUpdatedSymbol(node, node.TargetMethod);
12882MethodSymbol? getTypeFromHandle = GetUpdatedSymbol(node, node.GetTypeFromHandle);
12934MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12952MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
13155MethodSymbol? getResult = GetUpdatedSymbol(node, node.GetResult);
13183MethodSymbol? getTypeFromHandle = GetUpdatedSymbol(node, node.GetTypeFromHandle);
13209MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13358MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13359MethodSymbol? getMethodFromHandle = GetUpdatedSymbol(node, node.GetMethodFromHandle);
13377MethodSymbol? getFieldFromHandle = GetUpdatedSymbol(node, node.GetFieldFromHandle);
13495MethodSymbol conversionMethod = GetUpdatedSymbol(node, node.ConversionMethod);
13543MethodSymbol? getPinnableOpt = GetUpdatedSymbol(node, node.GetPinnableOpt);
13564ImmutableArray<MethodSymbol> localFunctions = GetUpdatedArray(node, node.LocalFunctions);
13595MethodSymbol symbol = GetUpdatedSymbol(node, node.Symbol);
13604ImmutableArray<MethodSymbol> innerLocalFunctions = GetUpdatedArray(node, node.InnerLocalFunctions);
13884MethodSymbol deconstructMethod = GetUpdatedSymbol(node, node.DeconstructMethod);
14014ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14051MethodSymbol? hasValueMethodOpt = GetUpdatedSymbol(node, node.HasValueMethodOpt);
14101ImmutableArray<MethodSymbol> methods = GetUpdatedArray(node, node.Methods);
14139MethodSymbol method = GetUpdatedSymbol(node, node.Method);
14140ImmutableArray<MethodSymbol> originalMethodsOpt = GetUpdatedArray(node, node.OriginalMethodsOpt);
14178MethodSymbol? constructor = GetUpdatedSymbol(node, node.Constructor);
14214MethodSymbol constructor = GetUpdatedSymbol(node, node.Constructor);
14215ImmutableArray<MethodSymbol> constructorsGroup = GetUpdatedArray(node, node.ConstructorsGroup);
14251MethodSymbol? collectionBuilderMethod = GetUpdatedSymbol(node, node.CollectionBuilderMethod);
14321ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14429MethodSymbol addMethod = GetUpdatedSymbol(node, node.AddMethod);
14448ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14479MethodSymbol constructor = GetUpdatedSymbol(node, node.Constructor);
14532MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
14751MethodSymbol symbol = GetUpdatedSymbol(node, node.Symbol);
14946MethodSymbol? deconstructMethod = GetUpdatedSymbol(node, node.DeconstructMethod);
14984MethodSymbol getLengthMethod = GetUpdatedSymbol(node, node.GetLengthMethod);
14985MethodSymbol getItemMethod = GetUpdatedSymbol(node, node.GetItemMethod);
15140MethodSymbol? 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)
392private static WellKnownMember GetBinaryOperatorFactory(BinaryOperatorKind opKind, MethodSymbol methodOpt, out bool isChecked, out bool isLifted, out bool requiresLifted)
488static bool useCheckedFactory(bool isChecked, MethodSymbol methodOpt)
494private BoundExpression VisitBinaryOperator(BinaryOperatorKind opKind, MethodSymbol methodOpt, TypeSymbol type, BoundExpression left, BoundExpression right)
574private BoundExpression MakeBinary(MethodSymbol methodOpt, TypeSymbol type, bool isLifted, bool requiresLifted, WellKnownMember opFactory, BoundExpression loweredLeft, BoundExpression loweredRight)
653var method = node.Method;
706var method = node.SymbolOpt;
764private BoundExpression DelegateCreation(BoundExpression receiver, MethodSymbol method, TypeSymbol delegateType, bool requiresInstanceReceiver)
779var createDelegate = _bound.WellKnownMethod(WellKnownMember.System_Reflection_MethodInfo__CreateDelegate, isOptional: true);
1153var 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);
532var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, original.Syntax);
553MethodSymbol method = original.Method;
610var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, invocation.Syntax);
Lowering\LocalRewriter\DelegateCacheContainer.cs (8)
19private readonly Dictionary<(TypeSymbol?, TypeSymbol, MethodSymbol), FieldSymbol> _delegateFields = new(CLRSignatureComparer.Instance);
36TypeMap.ConcatMethodTypeParameters((MethodSymbol)owner, stopAt: null)))
40Debug.Assert(owner is NamedTypeSymbol { Arity: > 0 } or MethodSymbol { Arity: > 0 });
62var targetMethod = boundDelegateCreation.MethodOpt;
93private sealed class CLRSignatureComparer : IEqualityComparer<(TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod)>
97public bool Equals((TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) x, (TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) y)
106public int GetHashCode((TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) conversion)
Lowering\LocalRewriter\LocalRewriter.cs (18)
57MethodSymbol containingMethod,
86MethodSymbol method,
337delegateType.DelegateInvokeMethod() is MethodSymbol delegateInvoke &&
355var lambda = node.Symbol;
358var oldContainingSymbol = _factory.CurrentFunction;
388var localFunction = node.Symbol;
419static bool hasReturnTypeOrParameter(MethodSymbol localFunction, Func<TypeWithAnnotations, bool> predicate) =>
423var oldContainingSymbol = _factory.CurrentFunction;
610/// Recommendation: Do not use, use <see cref="TryGetSpecialTypeMethod(SyntaxNode, SpecialMember, out MethodSymbol, bool)"/> instead!
613private MethodSymbol UnsafeGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember)
620/// Recommendation: Do not use, use <see cref="TryGetSpecialTypeMethod(SyntaxNode, SpecialMember, CSharpCompilation, BindingDiagnosticBag, out MethodSymbol, bool)"/> instead!
623private static MethodSymbol UnsafeGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, CSharpCompilation compilation, BindingDiagnosticBag diagnostics)
625MethodSymbol method;
640private bool TryGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, out MethodSymbol method, bool isOptional = false)
645private static bool TryGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, CSharpCompilation compilation, BindingDiagnosticBag diagnostics, out MethodSymbol method, bool isOptional = false)
661MethodSymbol? getTypeFromHandle;
691MethodSymbol? getTypeFromHandle;
1134private void CheckRefReadOnlySymbols(MethodSymbol symbol)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (23)
187MethodSymbol? method,
203MethodSymbol? method,
545private BoundExpression RewriteLiftedBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt)
608MethodSymbol? leftTruthOperator,
733private BoundExpression MakeTruthTestForDynamicLogicalOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, TypeSymbol boolean, MethodSymbol? leftTruthOperator, TypeSymbol? constrainedToTypeOpt, bool negative)
757return new BoundUnaryOperator(syntax, UnaryOperatorKind.BoolLogicalNegation, converted, ConstantValue.NotAvailable, MethodSymbol.None, constrainedToTypeOpt: null, LookupResultKind.Viable, boolean)
792MethodSymbol? method,
819MethodSymbol? method,
1149MethodSymbol? method,
1318MethodSymbol? method,
1358MethodSymbol? method,
1427MethodSymbol? method,
1529MethodSymbol? method,
1855MethodSymbol getValueOrDefaultX = UnsafeGetNullableMethod(syntax, boundTempX.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1856MethodSymbol getValueOrDefaultY = UnsafeGetNullableMethod(syntax, boundTempY.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1913private MethodSymbol UnsafeGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member)
1923internal static MethodSymbol UnsafeGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member, CSharpCompilation compilation, BindingDiagnosticBag diagnostics)
1930private bool TryGetNullableMethod(SyntaxNode syntax, TypeSymbol nullableType, SpecialMember member, out MethodSymbol result, bool isOptional = false)
2021var method = UnsafeGetSpecialTypeMethod(syntax, member);
2029MethodSymbol method;
2032method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member);
2035(object)(method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member)) == null)
2082var method = UnsafeGetSpecialTypeMethod(syntax, member);
Lowering\LocalRewriter\LocalRewriter_Call.cs (13)
98private void EmbedIfNeedTo(BoundExpression receiver, ImmutableArray<MethodSymbol> methods, SyntaxNode syntaxNode)
109foreach (var m in methods)
137ref MethodSymbol method,
200var containingMethod = this._factory.CurrentFunction;
216var symbolForCompare = needToReduce ? ReducedExtensionMethodSymbol.Create(interceptor, receiverOpt!.Type, _compilation, out _) : interceptor;
379MethodSymbol method = node.Method;
459MethodSymbol method,
540private BoundExpression MakeCall(SyntaxNode syntax, BoundExpression? rewrittenReceiver, MethodSymbol method, ImmutableArray<BoundExpression> rewrittenArguments)
673var requiresInstanceReceiver = methodOrIndexer.RequiresInstanceReceiver() && methodOrIndexer is not MethodSymbol { MethodKind: MethodKind.Constructor } and not FunctionPointerMethodSymbol;
958(isReceiverTakenByValue && methodOrIndexer is MethodSymbol)) // Extension methods with by-value receivers capture by value as classic extension methods do.
1327return ((MethodSymbol)methodOrIndexer).Parameters[0].Type as NamedTypeSymbol;
1510MethodSymbol? arrayEmpty = _compilation.GetSpecialTypeMember(SpecialMember.System_Array__Empty) as MethodSymbol;
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (47)
90var addMethod = (MethodSymbol?)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__Add);
98static bool canOptimizeListElement(BoundNode element, MethodSymbol addMethod)
153if (!TryGetWellKnownTypeMember(node.Syntax, WellKnownMember.System_Linq_Enumerable__ToList, out MethodSymbol? toListGeneric, isOptional: true))
158var toListOfElementType = toListGeneric.Construct([listElementType]);
175private bool ShouldUseIEnumerableBulkAddMethod(TypeSymbol spreadType, TypeSymbol targetEnumerableType, MethodSymbol? getEnumeratorMethod)
276if (_factory.WellKnownMethod(WellKnownMember.System_Runtime_InteropServices_ImmutableCollectionsMarshal__AsImmutableArray_T, isOptional: true) is MethodSymbol asImmutableArray)
310var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_ReadOnlySpan_T__ctor_Array)).AsMember(spanType);
343var spanConstructor = _factory.WellKnownMethod(wellKnownMember).AsMember(spanType);
380var listToArray = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ToArray)).AsMember((NamedTypeSymbol)list.Type);
542var constructMethod = node.CollectionBuilderMethod;
619: WellKnownMember.System_Span_T__ctor_ref_T, isOptional: true) is MethodSymbol spanRefConstructor)
625var constructor = spanRefConstructor.AsMember(spanType);
637MethodSymbol elementRef = _factory.ModuleBuilderOpt.EnsureInlineArrayElementRefExists(syntax, intType, _diagnostics.DiagnosticBag).
664MethodSymbol inlineArrayAsSpan = asReadOnlySpan ?
740&& tryGetToArrayMethod(spreadTypeOriginalDefinition, WellKnownType.System_Collections_Generic_List_T, WellKnownMember.System_Collections_Generic_List_T__ToArray, out MethodSymbol? listToArrayMethod))
751var linqToArrayMethod = linqToArrayMethodGeneric.Construct([arrayType.ElementTypeWithAnnotations]);
760&& TryGetSpanConversion(spreadExpression.Type, writableOnly: false, out var asSpanMethod))
763if (tryGetToArrayMethod(spanType, WellKnownType.System_ReadOnlySpan_T, WellKnownMember.System_ReadOnlySpan_T__ToArray, out var toArrayMethod)
771bool tryGetToArrayMethod(TypeSymbol spreadTypeOriginalDefinition, WellKnownType wellKnownType, WellKnownMember wellKnownMember, [NotNullWhen(true)] out MethodSymbol? toArrayMethod)
954private bool TryGetSpanConversion(TypeSymbol type, bool writableOnly, out MethodSymbol? asSpanMethod)
1004if (!TryGetSpanConversion(type, writableOnly, out var asSpanMethod))
1014private BoundExpression CallAsSpanMethod(BoundExpression spreadExpression, MethodSymbol? asSpanMethod)
1020if (asSpanMethod is MethodSymbol { MethodKind: MethodKind.Constructor } constructor)
1024else if (asSpanMethod is MethodSymbol { IsStatic: true, ParameterCount: 1 })
1038private (MethodSymbol spanSliceMethod, BoundExpression spreadElementAsSpan, MethodSymbol getLengthMethod, MethodSymbol copyToMethod)? PrepareCopyToOptimization(
1063(MethodSymbol getLengthMethod, MethodSymbol copyToMethod)? getSpanMethodsForSpread(
1085MethodSymbol spanSliceMethod,
1087MethodSymbol getLengthMethod,
1088MethodSymbol copyToMethod)
1134MethodSymbol? setCount = null;
1135MethodSymbol? asSpan = null;
1140setCount = ((MethodSymbol?)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_CollectionsMarshal__SetCount_T))?.Construct(typeArguments);
1141asSpan = ((MethodSymbol?)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_CollectionsMarshal__AsSpan_T))?.Construct(typeArguments);
1156var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ctorInt32)).AsMember(collectionType);
1180var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ctor)).AsMember(collectionType);
1206var spanGetItem = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Span_T__get_Item)).AsMember((NamedTypeSymbol)spanTemp.Type);
1285var addMethod = _factory.WellKnownMethod(WellKnownMember.System_Collections_Generic_List_T__Add).AsMember(collectionType);
1286var 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);
660MethodSymbol implicitOperator = implicitOperatorDefinition.AsMember((NamedTypeSymbol)sourceType);
673MethodSymbol castUpMethod = castUpMethodDefinition.AsMember(destinationType).Construct([sourceElementType]);
694MethodSymbol method = methodDefinition.AsMember(destinationType).Construct([sourceElementType]);
750delegateType.DelegateInvokeMethod() is MethodSymbol delegateInvoke &&
1073MethodSymbol ctor = UnsafeGetNullableMethod(syntax, rewrittenType, SpecialMember.System_Nullable_T__ctor);
1089MethodSymbol get_Value = UnsafeGetNullableMethod(syntax, rewrittenOperandType, SpecialMember.System_Nullable_T_get_Value);
1135if (!TryGetSpecialTypeMethod(syntax, DecimalConversionMethod(typeFromUnderlying, typeToUnderlying), out MethodSymbol method))
1176MethodSymbol getValueOrDefault;
1393MethodSymbol ctor = UnsafeGetNullableMethod(call.Syntax, resultType, SpecialMember.System_Nullable_T__ctor);
1444MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, boundTemp.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1506MethodSymbol method;
1739if (!TryGetSpecialTypeMethod(syntax, member, out MethodSymbol method))
1769var meth = conversion.Method;
1801MethodSymbol method;
1815MethodSymbol method;
1832MethodSymbol method;
1845MethodSymbol method;
1873private 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);
407private MethodSymbol? _concatStringString = ErrorMethodSymbol.UnknownMethod;
408private MethodSymbol? _concatStringStringString = ErrorMethodSymbol.UnknownMethod;
409private MethodSymbol? _concatStringStringStringString = ErrorMethodSymbol.UnknownMethod;
410private MethodSymbol? _concatStringArray = ErrorMethodSymbol.UnknownMethod;
411private MethodSymbol? _objectToString = ErrorMethodSymbol.UnknownMethod;
455private readonly void InitializeField(ref MethodSymbol? member, SpecialMember specialMember)
459member = _compilation.GetSpecialTypeMember(specialMember) as MethodSymbol;
463private readonly bool IsConcatNonArray(BoundCall call, ref MethodSymbol? concatMethod, SpecialMember concatSpecialMember, out ImmutableArray<BoundExpression> arguments)
483[NotNullWhen(true)] out MethodSymbol? readOnlySpanCtorRefParamChar,
484out MethodSymbol? stringImplicitConversionToReadOnlySpan)
489if (self.TryGetSpecialTypeMethod(syntax, SpecialMember.System_ReadOnlySpan_T__ctor_Reference, out MethodSymbol? readOnlySpanCtorRefParamGeneric, isOptional: true) &&
511MethodSymbol spanConcat,
512MethodSymbol? stringImplicitConversionToReadOnlySpan,
513MethodSymbol readOnlySpanCtorRefParamChar,
607var method = UnsafeGetSpecialTypeMethod(current.Syntax, member);
662var objectToStringMethod = UnsafeGetSpecialTypeMethod(syntax, SpecialMember.System_Object__ToString);
666MethodSymbol? structToStringMethod = null;
673if (member is MethodSymbol toStringMethod &&
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (20)
66MethodSymbol? method,
78MethodSymbol? method,
167method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(SpecialMember.System_Decimal__op_UnaryNegation);
182MethodSymbol? method,
205MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, boundTemp.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
246MethodSymbol? method,
354private BoundExpression GetLiftedUnaryOperatorConsequence(UnaryOperatorKind kind, SyntaxNode syntax, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt, TypeSymbol type, BoundExpression nonNullOperand)
356MethodSymbol ctor = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T__ctor);
456private BoundExpression MakeInstanceCompoundAssignmentOperatorResult(SyntaxNode syntax, BoundExpression left, BoundExpression? rightOpt, MethodSymbol operatorMethod, bool isChecked, AssignmentKind assignmentKind)
523static BoundCall makeIncrementCall(SyntaxNode syntax, BoundLocal boundTemp, BoundExpression? rightOpt, MethodSymbol operatorMethod)
830MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T_GetValueOrDefault);
831MethodSymbol ctor = UnsafeGetNullableMethod(syntax, type, SpecialMember.System_Nullable_T__ctor);
914MethodSymbol ctor = UnsafeGetNullableMethod(node.Syntax, binaryOperandType, SpecialMember.System_Nullable_T__ctor);
966private MethodSymbol GetDecimalIncDecOperator(BinaryOperatorKind oper)
977var method = (MethodSymbol)_compilation.Assembly.GetSpecialTypeMember(member);
986MethodSymbol method = GetDecimalIncDecOperator(oper);
995MethodSymbol method = GetDecimalIncDecOperator(oper);
996MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
997MethodSymbol ctor = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T__ctor);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (4)
46private IteratorAndAsyncCaptureWalker(CSharpCompilation compilation, MethodSymbol method, BoundNode node, HashSet<Symbol> initiallyAssignedVariables, bool isRuntimeAsync)
58public static OrderedSet<Symbol> Analyze(CSharpCompilation compilation, MethodSymbol method, BoundNode node, bool isRuntimeAsync, DiagnosticBag diagnostics)
371private readonly MethodSymbol _topLevelMethod;
374public OutsideVariablesUsedInside(IteratorAndAsyncCaptureWalker analyzer, MethodSymbol topLevelMethod, IteratorAndAsyncCaptureWalker parent)
Lowering\SyntheticBoundNodeFactory.cs (47)
64private MethodSymbol? _currentFunction;
65public MethodSymbol? CurrentFunction
83private MethodSymbol? _topLevelMethod;
84public MethodSymbol? TopLevelMethod
103public SyntheticBoundNodeFactory(MethodSymbol topLevelMethod, SyntaxNode node, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, InstrumentationState? instrumentationState = null)
114public SyntheticBoundNodeFactory(MethodSymbol? topLevelMethodOpt, NamedTypeSymbol? currentClassOpt, SyntaxNode node, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, InstrumentationState? instrumentationState = null)
283var accessor = property.GetOwnOrInheritedGetMethod();
291var accessor = property.GetOwnOrInheritedGetMethod();
341public MethodSymbol? WellKnownMethod(WellKnownMember wm, bool isOptional)
343return (MethodSymbol?)WellKnownMember(wm, isOptional);
346public MethodSymbol WellKnownMethod(WellKnownMember wm)
348return (MethodSymbol)WellKnownMember(wm, isOptional: false)!;
399public MethodSymbol SpecialMethod(SpecialMember sm)
401var result = (MethodSymbol?)SpecialMember(sm, isOptional: false);
406public MethodSymbol? SpecialMethod(SpecialMember sm, bool isOptional)
408return (MethodSymbol?)SpecialMember(sm, isOptional);
483return Block(locals, ImmutableArray<MethodSymbol>.CastUp(localFunctions), statements);
486public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
637public ParameterSymbol SynthesizedParameter(TypeSymbol type, string name, MethodSymbol? container = null, int ordinal = 0)
761var ctor = type.InstanceConstructors.Single(c => c.ParameterCount == args.Length);
765public BoundObjectCreationExpression New(MethodSymbol ctor, params BoundExpression[] args)
770var ctor = type.InstanceConstructors.Single(c => c.ParameterCount == args.Length);
774public BoundObjectCreationExpression New(MethodSymbol ctor, ImmutableArray<BoundExpression> args)
777public BoundObjectCreationExpression New(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKinds)
794var ctor = WellKnownMethod(wm);
813public BoundExpression StaticCall(TypeSymbol receiver, MethodSymbol method, params BoundExpression[] args)
823public BoundExpression StaticCall(MethodSymbol method, ImmutableArray<BoundExpression> args)
828MethodSymbol methodSymbol = WellKnownMethod(method);
836MethodSymbol methodSymbol = WellKnownMethod(method);
847MethodSymbol methodSymbol = SpecialMethod(method);
852public BoundCall Call(BoundExpression? receiver, MethodSymbol method)
857public BoundCall Call(BoundExpression? receiver, MethodSymbol method, BoundExpression arg0, bool useStrictArgumentRefKinds = false)
862public BoundCall Call(BoundExpression? receiver, MethodSymbol method, BoundExpression arg0, BoundExpression arg1, bool useStrictArgumentRefKinds = false)
867public BoundCall Call(BoundExpression? receiver, MethodSymbol method, params BoundExpression[] args)
875public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<BoundExpression> args, bool useStrictArgumentRefKinds = false)
887public static ImmutableArray<RefKind> ArgumentRefKindsFromParameterRefKinds(MethodSymbol method, bool useStrictArgumentRefKinds)
917public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<RefKind> refKinds, ImmutableArray<BoundExpression> args)
1221var ctor = baseType.InstanceConstructors.Single(c => c.ParameterCount == 0);
1286MethodSymbol getTypeFromHandle;
1328internal BoundExpression ConstructorInfo(MethodSymbol ctor)
1346public BoundExpression MethodDefIndex(MethodSymbol method)
1428public BoundExpression MethodInfo(MethodSymbol method, TypeSymbol systemReflectionMethodInfo)
1463private MethodSymbol GetMethodFromHandleMethod(NamedTypeSymbol methodContainer, TypeSymbol systemReflectionMethodOrConstructorInfo)
1487private MethodSymbol GetFieldFromHandleMethod(NamedTypeSymbol fieldContainer)
1548MethodSymbol? arrayEmpty = SpecialMethod(CodeAnalysis.SpecialMember.System_Array__Empty, isOptional: true);
1657MethodSymbol? containingMethod = this.CurrentFunction;
Symbols\Compilation_WellKnownMembers.cs (13)
79/// <see cref="MethodSymbol.AsMember"/> to construct an instantiation.
251internal static Symbol? GetRuntimeMember(NamedTypeSymbol declaringType, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
257internal static Symbol? GetRuntimeMember(ImmutableArray<Symbol> members, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
311MethodSymbol method = (MethodSymbol)member;
400var ctorSymbol = (MethodSymbol)Binder.GetWellKnownTypeMember(this, constructor, useSiteInfo: out _, isOptional: true);
447var ctorSymbol = (MethodSymbol)this.GetSpecialTypeMember(constructor);
1079internal class SpecialMembersSignatureComparer : SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol>
1149protected override ImmutableArray<ParameterSymbol> GetParameters(MethodSymbol method)
1169protected override TypeSymbol GetReturnType(MethodSymbol method)
1193protected 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;
464if ((options & LookupOptions.MustBeOperator) != 0 && member is not MethodSymbol { MethodKind: MethodKind.UserDefinedOperator })
495public 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 &&
4119(prevMethod.IsPartialImplementation || (prevMethod.OtherPartOfPartial is MethodSymbol otherImplementation && (object)otherImplementation != currentMethod)))
4125(prevMethod.IsPartialDefinition || (prevMethod.OtherPartOfPartial is MethodSymbol otherDefinition && (object)otherDefinition != currentMethod)))
4363MethodSymbol accessor = getNotSet ? propertySymbol.GetMethod : propertySymbol.SetMethod;
4388var methodSymbol = (MethodSymbol)symbol;
4427var methodSymbol = (MethodSymbol)symbol;
4580var meth = (MethodSymbol)member;
4642var meth = (MethodSymbol)member;
4689var m = s as MethodSymbol;
4734if (hasInitializers && !builder.NonTypeMembersWithPartialImplementations.Any(member => member is MethodSymbol { MethodKind: MethodKind.Constructor }))
4786case MethodSymbol { MethodKind: not (MethodKind.Ordinary or MethodKind.Constructor) }:
4842var thisEquals = addThisEquals(equalityContract);
4850var getHashCode = addGetHashCode(equalityContract);
4858var printMembers = addPrintMembersMethod(membersSoFar);
4896ImmutableArray<MethodSymbol>.Empty);
4904var deconstruct = (MethodSymbol)existingDeconstructMethod;
4944ImmutableArray<MethodSymbol>.Empty);
4958var constructor = (MethodSymbol)existingConstructor;
4977MethodSymbol addPrintMembersMethod(IEnumerable<Symbol> userDefinedMembers)
4996explicitInterfaceImplementations: ImmutableArray<MethodSymbol>.Empty);
4998MethodSymbol printMembersMethod;
5006printMembersMethod = (MethodSymbol)existingPrintMembersMethod;
5037void addToStringMethod(MethodSymbol printMethod)
5051explicitInterfaceImplementations: ImmutableArray<MethodSymbol>.Empty);
5053var baseToStringMethod = getBaseToStringMethod();
5080var toStringMethod = (MethodSymbol)existingToStringMethod;
5091MethodSymbol? getBaseToStringMethod()
5099if (member is not MethodSymbol method)
5206void addObjectEquals(MethodSymbol thisEquals)
5211MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5225ImmutableArray<MethodSymbol>.Empty);
5227MethodSymbol getHashCode;
5236getHashCode = (MethodSymbol)existingHashCodeMethod;
5304MethodSymbol addThisEquals(PropertySymbol? equalityContract)
5324ImmutableArray<MethodSymbol>.Empty);
5326MethodSymbol thisEquals;
5335thisEquals = (MethodSymbol)existingEqualsMethod;
5398var method = (MethodSymbol)member;
5854private void AddAccessorIfAvailable(ArrayBuilder<Symbol> symbols, MethodSymbol? accessorOpt)
6019if (member is MethodSymbol { MethodKind: MethodKind.Ordinary })
6047ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)>.Empty);
6050public readonly ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> MethodImpls;
6054ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> methodImpls)
6062ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> methodImpls)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (62)
18internal delegate void ReportMismatchInReturnType<TArg>(BindingDiagnosticBag bag, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, bool topLevel, TArg arg);
19internal delegate void ReportMismatchInParameterType<TArg>(BindingDiagnosticBag bag, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, ParameterSymbol parameter, bool topLevel, TArg arg);
73internal sealed override IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls()
115var methodImpls = ArrayBuilder<(MethodSymbol Body, MethodSymbol Implemented)>.GetInstance();
237var associatedPropertyOrEvent = interfaceMemberKind == SymbolKind.Method ? ((MethodSymbol)interfaceMember).AssociatedSymbol : null;
551var method = (MethodSymbol)member;
552if (MethodSymbol.CanOverrideOrHide(method.MethodKind) && !method.IsAccessor())
573MethodSymbol overridden = method.GetFirstRuntimeOverriddenMethodIgnoringNewSlot(out _);
587var getMethod = property.GetMethod;
588var setMethod = property.SetMethod;
628var addMethod = @event.AddMethod;
629var removeMethod = @event.RemoveMethod;
719if (hiddenMember.Kind == SymbolKind.Method && !((MethodSymbol)hiddenMember).CanBeHiddenByMember(symbol))
797associatedPropertyOrEvent = ((MethodSymbol)overridingMember).AssociatedSymbol;
806? ((MethodSymbol)overridingMember).ParameterTypesWithAnnotations
870if (!this.ContainingAssembly.RuntimeSupportsCovariantReturnsOfClasses && overridingMember is MethodSymbol overridingMethod)
875var ambiguousMethod = overridingMethod.OverriddenMethod;
907!(overridingMemberIsMethod && ((MethodSymbol)overriddenMember).MethodKind == MethodKind.Destructor)) //destructors are metadata virtual
936else if (overriddenMember is MethodSymbol overridden && overridden.IsOperator() != ((MethodSymbol)overridingMember).IsOperator())
998var overridingMethod = (MethodSymbol)overridingMember;
999var overriddenMethod = (MethodSymbol)overriddenMember;
1117MethodSymbol overriddenGetMethod = overriddenProperty.GetOwnOrInheritedGetMethod();
1127var ownOrInheritedOverriddenSetMethod = overriddenProperty.GetOwnOrInheritedSetMethod();
1148MethodSymbol ownOrInheritedGetMethod = overridingProperty.GetOwnOrInheritedGetMethod();
1155MethodSymbol ownOrInheritedSetMethod = overridingProperty.GetOwnOrInheritedSetMethod();
1168MethodSymbol overriddenMethod,
1169MethodSymbol overridingMethod,
1237(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, bool topLevel, Location location)
1244(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, ParameterSymbol overridingParameter, bool topLevel, Location location)
1255MethodSymbol baseMethod,
1256MethodSymbol overrideMethod,
1396internal static bool RequiresValidScopedOverrideForRefSafety(MethodSymbol? method, ParameterSymbol? overrideThisParameter)
1455internal static bool ReportInvalidScopedOverrideAsError(MethodSymbol baseMethod, MethodSymbol overrideMethod)
1466MethodSymbol? baseMethod,
1467MethodSymbol? overrideMethod,
1519MethodSymbol? baseMethod,
1520MethodSymbol? overrideMethod,
1648if (hidingMember is MethodSymbol hidingMethod && hiddenMembers[0] is MethodSymbol hiddenMethod)
1708var associatedPropertyOrEvent = ((MethodSymbol)hidingMember).AssociatedSymbol;
1826private (SynthesizedExplicitImplementationForwardingMethod? ForwardingMethod, (MethodSymbol Body, MethodSymbol Implemented)? MethodImpl)
1845MethodSymbol interfaceMethod = (MethodSymbol)interfaceMember;
1846MethodSymbol implementingMethod = (MethodSymbol)implementingMember;
1856MethodSymbol implementingMethodOriginalDefinition = implementingMethod.OriginalDefinition;
1875else if (implementingMethod.IsMetadataVirtual(MethodSymbol.IsMetadataVirtualOption.IgnoreInterfaceImplementationChanges))
1928private static bool IsPossibleImplementationUnderRuntimeRules(MethodSymbol implementingMethod, NamedTypeSymbol @interface)
1952private static bool IsOverrideOfPossibleImplementationUnderRuntimeRules(MethodSymbol implementingMethod, NamedTypeSymbol @interface)
1954MethodSymbol curr = implementingMethod;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (62)
322(MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerable__GetEnumerator),
342(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__CopyTo)!,
347(PropertySymbol)((MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__get_Item)!).AssociatedSymbol,
363(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Add)!,
368(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Clear)!,
373(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Contains)!,
378(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IndexOf)!,
383(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Insert)!,
388(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Remove)!,
393(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__RemoveAt)!,
398((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerable_T__GetEnumerator)!).AsMember(iEnumerableT),
410((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyList_T__get_Item)!).AssociatedSymbol).AsMember(iReadOnlyListT),
426((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Add)!).AsMember(iCollectionT),
431((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Clear)!).AsMember(iCollectionT),
436((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Contains)!).AsMember(iCollectionT),
441((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__CopyTo)!).AsMember(iCollectionT),
446((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Remove)!).AsMember(iCollectionT),
451((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__get_Item)!).AssociatedSymbol).AsMember(iListT),
457((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__IndexOf)!).AsMember(iListT),
462((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__Insert)!).AsMember(iListT),
467((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__RemoveAt)!).AsMember(iListT),
472static BoundStatement generateGetEnumerator(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
504static BoundStatement generateCount(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
532static BoundStatement generateIsSynchronized(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
539static BoundStatement generateSyncRoot(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
557static BoundStatement generateIsFixedSize(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
564static BoundStatement generateIsReadOnly(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
571static BoundStatement generateContains(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
604var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__Contains);
614static BoundStatement generateCopyTo(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
626var arraySetValueMethod = (MethodSymbol)method.DeclaringCompilation.GetSpecialTypeMember(SpecialMember.System_Array__SetValue)!;
671var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__CopyTo);
683static BoundStatement generateIndexer(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
694var constructor = (MethodSymbol)method.DeclaringCompilation.GetWellKnownTypeMember(WellKnownMember.System_IndexOutOfRangeException__ctor)!;
710var listMember = (PropertySymbol)((MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__get_Item)).AssociatedSymbol;
717static BoundStatement generateIndexOf(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
754var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__IndexOf);
763static BoundStatement generateNotSupportedException(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
765var constructor = (MethodSymbol)method.DeclaringCompilation.GetWellKnownTypeMember(WellKnownMember.System_NotSupportedException__ctor)!;
785var equalityComparer_get_Default = f.WellKnownMethod(
787var equalityComparer_Equals = f.WellKnownMethod(
1002internal override IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls() => SpecializedCollections.EmptyEnumerable<(MethodSymbol Body, MethodSymbol Implemented)>();
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (6)
220public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations
222get { return ImmutableArray<MethodSymbol>.Empty; }
293private static BoundCall CreateParameterlessCall(CSharpSyntaxNode syntax, BoundExpression receiver, ThreeState receiverIsSubjectToCloning, MethodSymbol method)
344internal readonly MethodSymbol UserMain;
346internal AsyncForwardEntryPoint(CSharpCompilation compilation, NamedTypeSymbol containingType, MethodSymbol userMain) :
383if (Binder.TryGetSpecialTypeMember(compilation, specialMember, _userMainReturnTypeSyntax, BindingDiagnosticBag.Discarded, out MethodSymbol handleAsyncEntryPointMethod, isOptional: true)
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;