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;
262out MethodSymbol? getResult,
348if (!isApplicableMethod(exprType, member, node, diagnostics, this, out MethodSymbol? method, out Conversion argumentConversion))
403[NotNullWhen(true)] out MethodSymbol? awaitMethod,
408if (member is not MethodSymbol method
435var substitutedMethod = method.Construct(exprType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics);
457static bool isValidConversion(TypeSymbol exprType, MethodSymbol method, SyntaxNode node, BindingDiagnosticBag diagnostics, Binder @this, out Conversion conversion)
485var awaitMethod = (MethodSymbol?)GetSpecialTypeMember(
501var runtimeAwaitAwaiterMethod = awaitMethod.Construct(awaiterType);
532static void reportObsoleteDiagnostics(Binder @this, BindingDiagnosticBag diagnostics, MethodSymbol method, SyntaxNode syntax)
597var getAwaiterMethod = call.Method;
684private bool GetGetResultMethod(BoundExpression awaiterExpression, SyntaxNode node, TypeSymbol awaitedExpressionType, BindingDiagnosticBag diagnostics, out MethodSymbol? getResultMethod, [NotNullWhen(true)] out BoundExpression? getAwaiterGetResultCall)
728private static bool HasOptionalParameters(MethodSymbol method)
Binder\Binder_Conversions.cs (50)
413if (conversion.Method is MethodSymbol method && method.IsStatic)
529MethodSymbol? castUpMethod = TryFindCastUpMethod(sourceForCastUp, destination.OriginalDefinition);
556static void reportUseSiteOrMissing(MethodSymbol? method, object containingType, string methodName, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
574internal static MethodSymbol? TryFindImplicitOperatorFromArray(TypeSymbol type)
584internal static MethodSymbol? TryFindImplicitOperatorFromSpan(TypeSymbol spanType, TypeSymbol readonlySpanType)
594private static MethodSymbol? TryFindImplicitOperator<TArg>(TypeSymbol type, TArg arg,
595Func<TArg, MethodSymbol, bool> predicate)
624internal static MethodSymbol? TryFindCastUpMethod(TypeSymbol source, TypeSymbol destination)
652internal static MethodSymbol? TryFindAsSpanCharMethod(CSharpCompilation compilation, TypeSymbol readOnlySpanType)
658MethodSymbol? result = null;
686private static MethodSymbol? TryFindSingleMethod<TArg>(TypeSymbol type, string name, TArg arg, Func<TArg, MethodSymbol, bool> predicate)
689MethodSymbol? result = null;
692if (member is MethodSymbol method && predicate(arg, method))
820var collectionTypeKind = conversion.GetCollectionExpressionTypeKind(out var elementType, out MethodSymbol? constructor, out bool isExpanded);
837MethodSymbol? collectionBuilderMethod = null;
886HasParamsCollectionTypeInProgress(namedType, out NamedTypeSymbol? inProgress, out MethodSymbol? inProgressConstructor))
1032internal MethodSymbol? GetAndValidateCollectionBuilderMethod(
1038MethodSymbol? collectionBuilderMethod;
1077internal BoundExpression BindCollectionExpressionConstructor(SyntaxNode syntax, TypeSymbol targetType, MethodSymbol? constructor, BindingDiagnosticBag diagnostics)
1107internal bool HasCollectionExpressionApplicableConstructor(SyntaxNode syntax, TypeSymbol targetType, out MethodSymbol? constructor, out bool isExpanded, BindingDiagnosticBag diagnostics, bool isParamsModifierValidation = false)
1143out MemberResolutionResult<MethodSymbol> memberResolutionResult,
1177MemberResolutionResult<MethodSymbol> memberResolutionResult,
1184var method = memberResolutionResult.Member;
1218out MethodSymbol? constructor)
1239internal bool HasCollectionExpressionApplicableAddMethod(SyntaxNode syntax, TypeSymbol targetType, out ImmutableArray<MethodSymbol> addMethods, BindingDiagnosticBag diagnostics)
1281out ImmutableArray<MethodSymbol> addMethods)
1299out ImmutableArray<MethodSymbol> addMethods)
1340out ImmutableArray<MethodSymbol> addMethods)
1355out ImmutableArray<MethodSymbol> addMethods)
1444resolution.MethodGroup, diagnostics: diagnostics, out var addMethod);
1459static ImmutableArray<MethodSymbol> filterOutBadGenericMethods(
1461ImmutableArray<MemberResolutionResult<MethodSymbol>> finalApplicableCandidates, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1464var resultBuilder = ArrayBuilder<MethodSymbol>.GetInstance(finalApplicableCandidates.Length);
1469var member = candidate.Member;
1495MethodSymbol? constructed = null;
1581OverloadResolutionResult<MethodSymbol> result,
1585out MethodSymbol? addMethod)
1831private MethodSymbol? GetCollectionBuilderMethod(
1855if (candidate is not MethodSymbol { IsStatic: true } method)
1881MethodSymbol methodWithTargetTypeParameters; // builder method substituted with type parameters from target type
2260private static void CheckParameterModifierMismatchMethodConversion(SyntaxNode syntax, MethodSymbol lambdaOrMethod, TypeSymbol targetType, bool invokedAsExtensionMethod, BindingDiagnosticBag diagnostics)
2262MethodSymbol? delegateMethod;
2577private bool MemberGroupFinalValidation(BoundExpression? receiverOpt, MethodSymbol methodSymbol, SyntaxNode node, BindingDiagnosticBag diagnostics, bool invokedAsExtensionMethod)
2656Debug.Assert(memberSymbol is not MethodSymbol { MethodKind: not MethodKind.Constructor } ||
2661if (receiverOpt != null || memberSymbol is not MethodSymbol { MethodKind: MethodKind.Constructor })
2808internal bool MethodIsCompatibleWithDelegateOrFunctionPointer(BoundExpression? receiverOpt, bool isExtensionMethod, MethodSymbol method, TypeSymbol delegateType, Location errorLocation, BindingDiagnosticBag diagnostics)
2814MethodSymbol delegateOrFuncPtrMethod = delegateType switch
2970internal static ParameterSymbol? GetReceiverParameter(MethodSymbol method)
3003MethodSymbol selectedMethod = conversion.Method;
Binder\Binder_Expressions.cs (111)
1325MethodSymbol method = this.ContainingMember() as MethodSymbol;
1466case MethodSymbol { AssociatedSymbol: SourcePropertySymbol property }:
1469case MethodSymbol { AssociatedSymbol.OriginalDefinition: PEPropertySymbol property } method when
1479if (contextualAttributeBinder is { AttributeTarget: MethodSymbol { AssociatedSymbol: SourcePropertySymbol property } })
1541ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: PropertySymbol { IsIndexer: false } })
2004var containingMethod = this.ContainingMemberOrLambda as MethodSymbol;
2133(this.ContainingMember() is MethodSymbol { MethodKind: MethodKind.Constructor } containingMember && (object)containingMember != primaryCtor)) && // We are in a non-primary instance constructor
2175bool capture = (this.ContainingMember() is MethodSymbol containingMethod && (object)primaryCtor != containingMethod);
2196this.ContainingMemberOrLambda is MethodSymbol { MethodKind: MethodKind.AnonymousFunction or MethodKind.LocalFunction } &&
2652MethodSymbol symbolOpt = GetWellKnownTypeMember(WellKnownMember.System_Index__ctor, diagnostics, syntax: node) as MethodSymbol;
2662MethodSymbol symbolOpt = null;
2687symbolOpt = (MethodSymbol)GetWellKnownTypeMember(
2696symbolOpt = (MethodSymbol)GetWellKnownTypeMember(
2817ImmutableArray<MethodSymbol> originalUserDefinedConversions = conversion.OriginalUserDefinedConversions;
3309&& ((MethodSymbol)containingSymbol).IsAsync
4798MethodSymbol constructor,
4822MethodSymbol constructor,
4958MemberResolutionResult<MethodSymbol> memberResolutionResult;
4959ImmutableArray<MethodSymbol> candidateConstructors;
4984MethodSymbol constructor,
4992MemberResolutionResult<MethodSymbol> memberResolutionResult,
4993ImmutableArray<MethodSymbol> candidateConstructors,
5003this.CheckAndCoerceArguments<MethodSymbol>(nonNullSyntax, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, out argsToParamsOpt);
5012MethodSymbol resultMember = memberResolutionResult.Member;
5131static void validateRecordCopyConstructor(MethodSymbol constructor, NamedTypeSymbol baseType, MethodSymbol resultMember, Location errorLocation, BindingDiagnosticBag diagnostics)
5182internal static bool IsUserDefinedRecordCopyConstructor(MethodSymbol constructor)
6162private static ImmutableSegmentedDictionary<string, Symbol> GetMembersRequiringInitialization(MethodSymbol constructor)
6174MethodSymbol constructor,
6509applicableMethods: ImmutableArray<MethodSymbol>.Empty,
6633internal ImmutableArray<MethodSymbol> FilterInaccessibleConstructors(ImmutableArray<MethodSymbol> constructors, bool allowProtectedConstructorsOfBaseType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
6635ArrayBuilder<MethodSymbol> builder = null;
6639MethodSymbol constructor = constructors[i];
6645builder = ArrayBuilder<MethodSymbol>.GetInstance();
6658private bool IsConstructorAccessible(MethodSymbol constructor, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool allowProtectedConstructorsOfBaseType = false)
6728OverloadResolutionResult<MethodSymbol> overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
6729ImmutableArray<MethodSymbol> accessibleConstructors = GetAccessibleConstructorsForOverloadResolution(type, ref useSiteInfo);
6778out MemberResolutionResult<MethodSymbol> memberResolutionResult,
6779out ImmutableArray<MethodSymbol> candidateConstructors,
6798MemberResolutionResult<MethodSymbol> memberResolutionResult,
6799ImmutableArray<MethodSymbol> candidateConstructors,
6818this.CheckAndCoerceArguments<MethodSymbol>(node, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, out argToParams);
6825var method = memberResolutionResult.Member;
6883MemberResolutionResult<MethodSymbol> memberResolutionResult,
6884ImmutableArray<MethodSymbol> candidateConstructors,
6900this.CheckAndCoerceArguments<MethodSymbol>(node, memberResolutionResult, analyzedArguments, diagnostics, receiver: null, invokedAsExtensionMethod: false, argsToParamsOpt: out _);
7183out MemberResolutionResult<MethodSymbol> memberResolutionResult,
7184out ImmutableArray<MethodSymbol> candidateConstructors,
7190ImmutableArray<MethodSymbol> allInstanceConstructors;
7194OverloadResolutionResult<MethodSymbol> result = OverloadResolutionResult<MethodSymbol>.GetInstance();
7215OverloadResolutionResult<MethodSymbol> inaccessibleResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
7233default(MemberResolutionResult<MethodSymbol>); // Invalid results are not interesting - we have enough info in candidateConstructors.
7304private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
7306ImmutableArray<MethodSymbol> allInstanceConstructors;
7310private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, bool allowProtectedConstructorsOfBaseType, out ImmutableArray<MethodSymbol> allInstanceConstructors, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
8002var method = resolution.MethodGroup.Methods[0];
8172lookupResult.Symbols.All(s => s.Kind == SymbolKind.Method) ? lookupResult.Symbols.SelectAsArray(s_toMethodSymbolFunc) : ImmutableArray<MethodSymbol>.Empty,
8311var builder = ArrayBuilder<MethodSymbol>.GetInstance();
8314var m = s as MethodSymbol;
8758MethodSymbol method = methodGroup.Methods[i];
8799var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
8876MethodSymbol representativeMethod = methodResult.OverloadResolutionResult is { } methodResolution
9644else if (convertedIndex is BoundObjectCreationExpression { Constructor: MethodSymbol constructor, Arguments: { Length: 2 } arguments, ArgsToParamsOpt: { IsDefaultOrEmpty: true }, InitializerExpressionOpt: null } &&
10456var substring = (MethodSymbol)GetSpecialTypeMember(SpecialMember.System_String__Substring, diagnostics, syntax);
10487candidate is MethodSymbol method &&
10504void makeCall(SyntaxNode syntax, BoundExpression receiver, MethodSymbol method,
10530internal static bool MethodHasValidSliceSignature(MethodSymbol method)
10597property.GetOwnOrInheritedGetMethod()?.OriginalDefinition is MethodSymbol getMethod &&
10785var method = node.LookupSymbolOpt as MethodSymbol;
10823var result = OverloadResolutionResult<MethodSymbol>.GetInstance();
10849var method = GetUniqueSignatureFromMethodGroup(node, out bool useParams);
10866private MethodSymbol? GetUniqueSignatureFromMethodGroup_CSharp10(BoundMethodGroup node, out bool useParams)
10868MethodSymbol? method = null;
10869var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: node.Methods.Length);
10870foreach (var m in node.Methods)
10895foreach (var m in methods)
10933if (extensionMember is MethodSymbol m)
10938var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true);
10978foreach (var reduced in methods)
11012static bool isCandidateUnique(ref MethodSymbol? method, MethodSymbol candidate)
11030bool memberCountsAsStatic = extensionMember is MethodSymbol { IsExtensionMethod: true } ? false : extensionMember.IsStatic;
11047private MethodSymbol? GetUniqueSignatureFromMethodGroup(BoundMethodGroup node, out bool useParams)
11055MethodSymbol? foundMethod = null;
11062var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: node.Methods.Length);
11063foreach (var memberMethod in node.Methods)
11087var substituted = typeArguments.IsDefaultOrEmpty ? memberMethod : memberMethod.Construct(typeArguments);
11102foreach (var substituted in methods)
11135var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: singleLookupResults.Count);
11147if (extensionMember is MethodSymbol)
11149var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true);
11164foreach (var method in methods)
11190static bool isCandidateUnique(ref MethodSymbol? foundMethod, MethodSymbol candidate)
11205bool satisfiesConstraintChecks(MethodSymbol method)
11232MethodSymbol methodSymbol,
11352MethodSymbol invoke = possibleDelegateType.DelegateInvokeMethod();
11483return 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;
1389var method = property.GetMethod ?? property.SetMethod;
1400internal ThreeState ReceiverIsSubjectToCloning(BoundExpression? receiver, MethodSymbol method)
1459if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_UnknownWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1468if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_DispatchWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1899internal bool CheckImplicitThisCopyInReadOnlyMember(BoundExpression receiver, MethodSymbol method, BindingDiagnosticBag diagnostics)
1905ContainingMemberOrLambda is MethodSymbol containingMethod &&
2035ImmutableArray<MethodSymbol> methods,
2043MethodSymbol method;
2047var constructedMethods = ArrayBuilder<MethodSymbol>.GetInstance();
2048foreach (var m in methods)
2050MethodSymbol constructedMethod;
2090private static bool IsUnboundGeneric(MethodSymbol method)
2110private ImmutableArray<BoundExpression> BuildArgumentsForErrorRecovery(AnalyzedArguments analyzedArguments, ImmutableArray<MethodSymbol> methods, BindingDiagnosticBag diagnostics)
2113foreach (var m in methods)
2321MethodSymbol method = new ErrorMethodSymbol(methodContainer, returnType, string.Empty);
2326var originalMethods = (expr.Kind == BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty;
2550BuildArgumentsForErrorRecovery(analyzedArguments, StaticCast<MethodSymbol>.From(methods), BindingDiagnosticBag.Discarded),
Binder\Binder_Operators.cs (79)
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;
1013ImmutableArray<MethodSymbol> originalUserDefinedOperators;
1140out ImmutableArray<MethodSymbol> originalUserDefinedOperators, out BinaryOperatorSignature resultSignature, out BinaryOperatorAnalysisResult best)
1145originalUserDefinedOperators = default(ImmutableArray<MethodSymbol>);
1164ref ImmutableArray<MethodSymbol> originalUserDefinedOperators,
1229ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
1477ImmutableArray<MethodSymbol> originalUserDefinedOperators;
1483originalUserDefinedOperators = default(ImmutableArray<MethodSymbol>);
1599private bool IsValidDynamicCondition(BoundExpression left, bool isNegative, BindingDiagnosticBag diagnostics, out MethodSymbol userDefinedOperator)
1673bool hasApplicableBooleanOperator(NamedTypeSymbol containingType, string name, TypeSymbol argumentType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out MethodSymbol @operator)
1675var operators = ArrayBuilder<MethodSymbol>.GetInstance();
1683var op = operators[i];
1797MethodSymbol definition;
2070out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2088out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2102ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
2129out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2189out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2209private static BinaryOperatorAnalysisResult BinaryOperatorAnalyzeOverloadResolutionResult(BinaryOperatorOverloadResolutionResult result, out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2215var builder = ArrayBuilder<MethodSymbol>.GetInstance();
2218MethodSymbol method = analysisResult.Signature.Method;
2241originalUserDefinedOperators = ImmutableArray<MethodSymbol>.Empty;
2248private void ReportObsoleteAndFeatureAvailabilityDiagnostics(MethodSymbol operatorMethod, CSharpSyntaxNode node, BindingDiagnosticBag diagnostics)
2291out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2308ImmutableArray<MethodSymbol> extensionOriginalUserDefinedOperators;
2333out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2361out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
2367var builder = ArrayBuilder<MethodSymbol>.GetInstance();
2370MethodSymbol method = analysisResult.Signature.Method;
2409originalUserDefinedOperators = ImmutableArray<MethodSymbol>.Empty;
2440out ImmutableArray<MethodSymbol> originalUserDefinedOperators)
3322originalUserDefinedOperatorsOpt: default(ImmutableArray<MethodSymbol>),
3348ImmutableArray<MethodSymbol> originalUserDefinedOperators;
3362ImmutableArray<MethodSymbol> staticExtensionOriginalUserDefinedOperators;
3512ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceOperators(
3544ArrayBuilder<MethodSymbol> methods,
3553var overloadResolutionResult = OverloadResolutionResult<MethodSymbol>.GetInstance();
3591var method = overloadResolutionResult.ValidResult.Member;
3635ImmutableArray<MethodSymbol>.Empty,
3642ImmutableArray<MethodSymbol> methodsArray = methods.ToImmutableAndFree();
3699out ImmutableArray<MethodSymbol> staticOriginalUserDefinedOperators)
3785ArrayBuilder<MethodSymbol>? methods = LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
3801private ArrayBuilder<MethodSymbol>? LookupUserDefinedInstanceOperators(TypeSymbol lookupInType, string? checkedName, string ordinaryName, int parameterCount, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3806ArrayBuilder<MethodSymbol>? methods = null;
3814methods = ArrayBuilder<MethodSymbol>.GetInstance(lookupResult.Symbols.Count);
3827methods = ArrayBuilder<MethodSymbol>.GetInstance(lookupResult.Symbols.Count);
3832var existing = new HashSet<MethodSymbol>(PairedOperatorComparer.Instance);
3834foreach (var method in methods)
3839foreach (MethodSymbol method in lookupResult.Symbols)
3853static void appendViableMethods(LookupResult lookupResult, int parameterCount, ArrayBuilder<MethodSymbol> methods)
3855foreach (MethodSymbol method in lookupResult.Symbols)
3865private static bool IsViableInstanceOperator(MethodSymbol method, int parameterCount)
3872private ArrayBuilder<MethodSymbol>? LookupUserDefinedInstanceExtensionOperatorsInSingleScope(
3879ArrayBuilder<MethodSymbol>? checkedMethods = null;
3887ArrayBuilder<MethodSymbol>? ordinaryMethods = null;
3898var existing = new HashSet<MethodSymbol>(OverloadResolution.PairedExtensionOperatorSignatureComparer.Instance);
3901foreach (MethodSymbol method in ordinaryMethods)
3917ref ArrayBuilder<MethodSymbol>? methods)
3924var typeOperators = ArrayBuilder<MethodSymbol>.GetInstance();
3927foreach (MethodSymbol op in typeOperators)
3949methods ??= ArrayBuilder<MethodSymbol>.GetInstance();
3958private class PairedOperatorComparer : IEqualityComparer<MethodSymbol>
3964public bool Equals(MethodSymbol x, MethodSymbol y)
3977public int GetHashCode([DisallowNull] MethodSymbol method)
3998private bool CheckConstraintLanguageVersionAndRuntimeSupportForOperator(SyntaxNode node, MethodSymbol? methodOpt, bool isUnsignedRightShift, TypeSymbol? constrainedToTypeOpt, BindingDiagnosticBag diagnostics)
4390ImmutableArray<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)
750/// Checks for a Dispose method on <paramref name="expr"/> and returns its <see cref="MethodSymbol"/> if found.
755/// <returns>The <see cref="MethodSymbol"/> of the Dispose method if one is found, otherwise null.</returns>
756internal MethodSymbol TryFindDisposePatternMethod(BoundExpression expr, SyntaxNode syntaxNode, bool hasAwait, BindingDiagnosticBag diagnostics, out bool isExpanded)
766out var disposeMethod,
1243MethodSymbol fixedPatternMethod = null;
1320private MethodSymbol GetFixedPatternMethodOpt(BoundExpression initializer, BindingDiagnosticBag additionalDiagnostics)
1329var result = PerformPatternMethodLookup(initializer, methodName, initializer.Syntax, additionalDiagnostics, out var patternMethodSymbol, out bool isExpanded);
1357MethodSymbol patternMethodOpt,
1832return (member as MethodSymbol)?.MethodKind == (isStatic ?
1937ImmutableArray<MethodSymbol>.CastUp(GetDeclaredLocalFunctionsForScope(node)),
2309ImmutableArray<MethodSymbol> originalUserDefinedConversions = conversion.OriginalUserDefinedConversions;
2746var best = this.UnaryOperatorOverloadResolution(UnaryOperatorKind.True, expr, node, diagnostics, ref discardedOperatorResolutionForReporting, out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators);
2972protected static bool IsInAsyncMethod(MethodSymbol method)
2979return IsInAsyncMethod(this.ContainingMemberOrLambda as MethodSymbol);
2985return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningTask(this.Compilation);
2991return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningGenericTask(this.Compilation);
2999var method = (MethodSymbol)symbol;
3008var symbol = this.ContainingMemberOrLambda as MethodSymbol;
3565var inferringLambda = this.ContainingMemberOrLambda is MethodSymbol method && (object)method.ReturnType == LambdaSymbol.ReturnTypeIsBeingInferred;
3748BoundExpression initializerInvocation = GetBinder(initializer).BindConstructorInitializer(initializer.ArgumentList, (MethodSymbol)this.ContainingMember(), diagnostics);
3769if (isInstanceConstructor(out MethodSymbol constructorSymbol) &&
3800bool isInstanceConstructor(out MethodSymbol constructorSymbol)
3802if (this.ContainingMember() is MethodSymbol { IsStatic: false } method)
3814BoundExpression initializerInvocation = GetBinder(initializer).BindConstructorInitializer(initializer.ArgumentList, (MethodSymbol)this.ContainingMember(), diagnostics);
3826initializerInvocation = BindImplicitConstructorInitializer((MethodSymbol)this.ContainingMember(), diagnostics, Compilation);
3834var constructorInitializer = new BoundExpressionStatement(ctorSyntax, initializerInvocation) { WasCompilerGenerated = ((MethodSymbol)ContainingMember()).IsImplicitlyDeclared };
3847MethodSymbol constructor, BindingDiagnosticBag diagnostics, CSharpCompilation compilation)
3954internal static BoundCall? GenerateBaseParameterlessConstructorInitializer(MethodSymbol constructor, BindingDiagnosticBag diagnostics)
3957MethodSymbol? baseConstructor = null;
3961foreach (MethodSymbol ctor in baseType.InstanceConstructors)
4023MethodSymbol? baseConstructor = SynthesizedRecordCopyCtor.FindCopyConstructor(baseType, containingType, ref useSiteInfo);
4137SyntaxNode syntaxNode, BindingDiagnosticBag diagnostics, out MethodSymbol result, out bool isExpanded)
4201var 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,
1462return ((MethodSymbol)member).HidesBaseMethodsByName;
1738ArrayBuilder<MemberResolutionResult<MethodSymbol>> results,
1739ImmutableArray<MethodSymbol> constructors,
1752foreach (MethodSymbol constructor in constructors)
1768RemoveLowerPriorityMembers<MemberResolutionResult<MethodSymbol>, MethodSymbol>(results);
3281MethodSymbol invoke;
3568MethodSymbol invoke1 = d1.DelegateInvokeMethod;
3569MethodSymbol invoke2 = d2.DelegateInvokeMethod;
3696MethodSymbol invoke1 = d1.DelegateInvokeMethod;
3697MethodSymbol invoke2 = d2.DelegateInvokeMethod;
4388if (member is MethodSymbol method)
4463(MethodSymbol)(Symbol)member,
4585Debug.Assert(candidate is MethodSymbol { MethodKind: MethodKind.UserDefinedOperator });
4781return (TMember)(Symbol)(member as MethodSymbol).ConstructedFrom;
BoundTree\BoundObjectCreationExpression.cs (6)
12public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt,
15: this(syntax, constructor, ImmutableArray<MethodSymbol>.Empty, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, defaultArguments, constantValueOpt, initializerExpressionOpt, wasTargetTyped: false, type, hasErrors)
18public BoundObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded,
21return this.Update(constructor, ImmutableArray<MethodSymbol>.Empty, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, defaultArguments, constantValueOpt, initializerExpressionOpt, this.WasTargetTyped, type);
24public BoundObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<MethodSymbol> constructorsGroup, ImmutableArray<BoundExpression> arguments,
BoundTree\Constructors.cs (21)
90MethodSymbol method,
108MethodSymbol method,
124MethodSymbol method,
130ImmutableArray<MethodSymbol> originalMethods,
170public BoundCall Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments)
175public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method)
180public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, BoundExpression arg0)
185public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, BoundExpression arg0, BoundExpression arg1)
190public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt = default)
237static ImmutableArray<RefKind> getArgumentRefKinds(MethodSymbol method)
260public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, params BoundExpression[] arguments)
264public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments)
413MethodSymbol? methodOpt,
416ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt,
434MethodSymbol? methodOpt,
447MethodSymbol? methodOpt,
592: this(syntax, locals, ImmutableArray<MethodSymbol>.Empty, hasUnsafeModifier: false, instrumentation: null, statements, hasErrors)
683MethodSymbol? methodOpt,
695MethodSymbol? methodOpt,
708MethodSymbol? methodOpt,
721public BoundIncrementOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, BoundValuePlaceholder? operandPlaceholder, BoundExpression? operandConversion, BoundValuePlaceholder? resultPlaceholder, BoundExpression? resultConversion, LookupResultKind resultKind, TypeSymbol type)
CodeGen\EmitArrayInitializer.cs (8)
462var rosPointerCtor = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_ReadOnlySpan_T__ctor_Pointer, _diagnostics, syntax: wrappedExpression.Syntax, isOptional: true);
608MethodSymbol? createSpan = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__CreateSpanRuntimeFieldHandle, _diagnostics, syntax: wrappedExpression.Syntax, isOptional: true);
632if (!tryGetReadOnlySpanArrayCtor(wrappedExpression.Syntax, out var rosArrayCtor))
696if (!tryGetReadOnlySpanArrayCtor(arrayCreation.Syntax, out var rosArrayCtor))
775bool tryGetReadOnlySpanArrayCtor(SyntaxNode syntax, [NotNullWhen(true)] out MethodSymbol? rosArrayCtor)
777rosArrayCtor = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_ReadOnlySpan_T__ctor_Array, _diagnostics, syntax: syntax, isOptional: true);
CodeGen\EmitStatement.cs (18)
1566var sequenceEqualsTMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1572var sequenceEqualsCharMethod = sequenceEqualsTMethod.Construct(Binder.GetSpecialType(_module.Compilation, SpecialType.System_Char, syntaxNode, _diagnostics));
1575var asSpanMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_MemoryExtensions__AsSpan_String, _diagnostics, syntax: syntaxNode);
1581var stringEqualityMethod = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__op_Equality) as MethodSymbol;
1662var spanTLengthMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1667var spanCharLengthMethod = spanTLengthMethod.AsMember((NamedTypeSymbol)keyType);
1672var stringLengthMethod = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__Length) as MethodSymbol;
1686var spanTIndexerMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_module.Compilation,
1692var spanCharLengthMethod = spanTIndexerMethod.AsMember((NamedTypeSymbol)keyType);
1698var stringCharsIndexer = _module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__Chars) as MethodSymbol;
1728Debug.Assert(stringEqualityMethodRef == _module.Translate((MethodSymbol)_module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__op_Equality), (CSharpSyntaxNode)syntaxNode, assertDiagnostics));
Compilation\CSharpCompilation.cs (34)
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 }:
3501var methodSymbol = eventAssignment.IsAddition ? eventSymbol.AddMethod : eventSymbol.RemoveMethod;
3532var symbol = conversion.SymbolOpt;
3630memberGroup = dynamicInvocation.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3638memberGroup = collectionInit.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3658memberGroup = objectCreation.ApplicableMethods.Cast<MethodSymbol, Symbol>();
3677memberGroup = boundObjectCreation.ConstructorsGroup.Cast<MethodSymbol, Symbol>();
3738return new ThisParameterSymbol(containingMember as MethodSymbol, typeOfThis);
3757thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, containingType);
3764thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, containingType);
3792thisParam = new ThisParameterSymbol(containingMember as MethodSymbol, typeOfThis);
3946private static void GetSymbolsAndResultKind(BoundExpression node, Symbol symbolOpt, ImmutableArray<MethodSymbol> originalCandidates, out OneOrMany<Symbol> symbols, out LookupResultKind resultKind)
3977MethodSymbol constructor = null;
4023MethodSymbol constructorOpt,
4040ImmutableArray<MethodSymbol> candidateConstructors;
4061candidateConstructors = ImmutableArray<MethodSymbol>.Empty;
4076memberGroup = candidateConstructors.Cast<MethodSymbol, Symbol>();
4202private static ImmutableArray<MethodSymbol> FilterOverriddenOrHiddenMethods(ImmutableArray<MethodSymbol> methods)
4211foreach (MethodSymbol method in methods)
4304MethodSymbol method = null;
4333symbols = OneOrMany.Create(dynamicInvocation.ApplicableMethods.Cast<MethodSymbol, Symbol>());
4581ImmutableArray<MethodSymbol> nonHiddenMethods = FilterOverriddenOrHiddenMethods(node.Methods);
4584foreach (var method in nonHiddenMethods)
4643if (singleLookupResult.Symbol is not (MethodSymbol or PropertySymbol))
4770foreach (var method in FilterOverriddenOrHiddenMethods(methods))
4785var method = call.Method;
4792MethodSymbol reduced = method.ReduceExtensionMethod(receiver.Type, Compilation);
4802var method = delegateCreation.MethodOpt;
4807MethodSymbol reduced = method.ReduceExtensionMethod(receiverOpt.Type, Compilation);
5211if (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;
902public override object VisitMethod(MethodSymbol symbol, TypeCompilationState arg)
923MethodSymbol methodSymbol,
1411private void EmitSkeletonMethodInExtension(MethodSymbol methodSymbol)
1423var ctor = (MethodSymbol)Binder.GetWellKnownTypeMember(_compilation, WellKnownMember.System_NotSupportedException__ctor, _diagnostics, syntax: syntax, isOptional: false);
1469private static MethodSymbol GetSymbolForEmittedBody(MethodSymbol methodSymbol)
1476MethodSymbol method,
1626MethodSymbol method,
1667MethodSymbol kickoffMethod;
1750MethodSymbol methodBodyParentSymbol = GetSymbolForEmittedBody(method);
1860internal static BoundBlock? BindSynthesizedMethodBody(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
1877MethodSymbol method,
2476private static BoundStatement BindImplicitConstructorInitializerIfAny(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
2500private 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)
2122protected virtual void PropertySetter(BoundExpression node, BoundExpression receiver, MethodSymbol setter, BoundExpression value = null)
2149var method = GetWriteMethod(property);
2204var readMethod = GetReadMethod(property);
2223var writeMethod = GetWriteMethod(property);
2283var method = GetReadMethod(property);
2840var readMethod = GetReadMethod(property);
2841var writeMethod = GetWriteMethod(property);
3044var method = conversion.Method;
3621MethodSymbol method = null;
3722private static MethodSymbol GetReadMethod(PropertySymbol property) =>
3725private static MethodSymbol GetWriteMethod(PropertySymbol property) =>
3749var readMethod = property.GetOwnOrInheritedGetMethod();
3807var 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)
1164public BoundUnaryOperator(SyntaxNode syntax, UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1184public MethodSymbol? MethodOpt { get; }
1187public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1192public BoundUnaryOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
1206public BoundIncrementOperator(SyntaxNode syntax, UnaryOperatorKind operatorKind, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, BoundValuePlaceholder? operandPlaceholder, BoundExpression? operandConversion, BoundValuePlaceholder? resultPlaceholder, BoundExpression? resultConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1228public MethodSymbol? MethodOpt { get; }
1235public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1240public BoundIncrementOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, BoundValuePlaceholder? operandPlaceholder, BoundExpression? operandConversion, BoundValuePlaceholder? resultPlaceholder, BoundExpression? resultConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
1315public BoundFunctionPointerLoad(SyntaxNode syntax, MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type, bool hasErrors)
1326public BoundFunctionPointerLoad(SyntaxNode syntax, MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type)
1337public MethodSymbol TargetMethod { get; }
1344public BoundFunctionPointerLoad Update(MethodSymbol targetMethod, TypeSymbol? constrainedToTypeOpt, TypeSymbol type)
1464public BoundRefTypeOperator(SyntaxNode syntax, BoundExpression operand, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors = false)
1477public MethodSymbol? GetTypeFromHandle { get; }
1482public BoundRefTypeOperator Update(BoundExpression operand, MethodSymbol? getTypeFromHandle, TypeSymbol type)
1558public BoundFromEndIndexExpression(SyntaxNode syntax, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
1571public MethodSymbol? MethodOpt { get; }
1576public BoundFromEndIndexExpression Update(BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol type)
1590public BoundRangeExpression(SyntaxNode syntax, BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
1604public MethodSymbol? MethodOpt { get; }
1609public BoundRangeExpression Update(BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type)
1718public 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)
1745public MethodSymbol LogicalOperator { get; }
1746public MethodSymbol TrueOperator { get; }
1747public MethodSymbol FalseOperator { get; }
1752public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1757public 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)
1771public 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)
1799public ImmutableArray<MethodSymbol> OriginalUserDefinedOperatorsOpt { get; }
1804public BoundCompoundAssignmentOperator Update(BinaryOperatorSignature @operator, BoundExpression left, BoundExpression right, BoundValuePlaceholder? leftPlaceholder, BoundExpression? leftConversion, BoundValuePlaceholder? finalPlaceholder, BoundExpression? finalConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
2134public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder, bool hasErrors = false)
2154public MethodSymbol? GetResult { get; }
2161public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder)
2210protected BoundTypeOf(BoundKind kind, SyntaxNode syntax, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors)
2219protected BoundTypeOf(BoundKind kind, SyntaxNode syntax, MethodSymbol? getTypeFromHandle, TypeSymbol type)
2229public MethodSymbol? GetTypeFromHandle { get; }
2234public BoundTypeOfOperator(SyntaxNode syntax, BoundTypeExpression sourceType, MethodSymbol? getTypeFromHandle, TypeSymbol type, bool hasErrors = false)
2249public BoundTypeOfOperator Update(BoundTypeExpression sourceType, MethodSymbol? getTypeFromHandle, TypeSymbol type)
2295public BoundMethodDefIndex(SyntaxNode syntax, MethodSymbol method, TypeSymbol type, bool hasErrors)
2309public BoundMethodDefIndex(SyntaxNode syntax, MethodSymbol method, TypeSymbol type)
2320public MethodSymbol Method { get; }
2325public BoundMethodDefIndex Update(MethodSymbol method, TypeSymbol type)
2713public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type, bool hasErrors)
2724public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
2736public MethodSymbol Method { get; }
2737public MethodSymbol? GetMethodFromHandle { get; }
2742public BoundMethodInfo Update(MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
2756public BoundFieldInfo(SyntaxNode syntax, FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type, bool hasErrors)
2767public BoundFieldInfo(SyntaxNode syntax, FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type)
2780public MethodSymbol? GetFieldFromHandle { get; }
2785public BoundFieldInfo Update(FieldSymbol field, MethodSymbol? getFieldFromHandle, TypeSymbol type)
2999public BoundReadOnlySpanFromArray(SyntaxNode syntax, BoundExpression operand, MethodSymbol conversionMethod, TypeSymbol type, bool hasErrors = false)
3013public MethodSymbol ConversionMethod { get; }
3018public BoundReadOnlySpanFromArray Update(BoundExpression operand, MethodSymbol conversionMethod, TypeSymbol type)
3098public BoundFixedLocalCollectionInitializer(SyntaxNode syntax, TypeSymbol elementPointerType, BoundValuePlaceholder? elementPointerPlaceholder, BoundExpression? elementPointerConversion, BoundExpression expression, MethodSymbol? getPinnableOpt, TypeSymbol type, bool hasErrors = false)
3118public MethodSymbol? GetPinnableOpt { get; }
3123public BoundFixedLocalCollectionInitializer Update(TypeSymbol elementPointerType, BoundValuePlaceholder? elementPointerPlaceholder, BoundExpression? elementPointerConversion, BoundExpression expression, MethodSymbol? getPinnableOpt, TypeSymbol type)
3308public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3323public ImmutableArray<MethodSymbol> LocalFunctions { get; }
3330public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements)
3510public BoundLocalFunctionStatement(SyntaxNode syntax, MethodSymbol symbol, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false)
3521public MethodSymbol Symbol { get; }
3528public BoundLocalFunctionStatement Update(MethodSymbol symbol, BoundBlock? blockBody, BoundBlock? expressionBody)
3778public BoundSwitchStatement(SyntaxNode syntax, BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<MethodSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, LabelSymbol breakLabel, bool hasErrors = false)
3800public ImmutableArray<MethodSymbol> InnerLocalFunctions { get; }
3809public BoundSwitchStatement Update(BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<MethodSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, LabelSymbol breakLabel)
5390public BoundDagDeconstructEvaluation(SyntaxNode syntax, MethodSymbol deconstructMethod, BoundDagTemp input, bool hasErrors = false)
5400public MethodSymbol DeconstructMethod { get; }
5405public BoundDagDeconstructEvaluation Update(MethodSymbol deconstructMethod, BoundDagTemp input)
5899public BoundDynamicInvocation(SyntaxNode syntax, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false)
5916public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
5921public BoundDynamicInvocation Update(ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type)
5968public BoundLoweredConditionalAccess(SyntaxNode syntax, BoundExpression receiver, MethodSymbol? hasValueMethodOpt, BoundExpression whenNotNull, BoundExpression? whenNullOpt, int id, bool forceCopyOfNullableValueType, TypeSymbol type, bool hasErrors = false)
5986public MethodSymbol? HasValueMethodOpt { get; }
5995public BoundLoweredConditionalAccess Update(BoundExpression receiver, MethodSymbol? hasValueMethodOpt, BoundExpression whenNotNull, BoundExpression? whenNullOpt, int id, bool forceCopyOfNullableValueType, TypeSymbol type)
6080public 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)
6098public ImmutableArray<MethodSymbol> Methods { get; }
6107public BoundMethodGroup Update(ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, string name, ImmutableArray<MethodSymbol> methods, Symbol? lookupSymbolOpt, DiagnosticInfo? lookupError, BoundMethodGroupFlags? flags, FunctionTypeSymbol? functionType, BoundExpression? receiverOpt, LookupResultKind resultKind)
6149public 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)
6179public MethodSymbol Method { get; }
6189public ImmutableArray<MethodSymbol> OriginalMethodsOpt { get; }
6194public 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)
6247public 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)
6266public MethodSymbol? Constructor { get; }
6278public BoundAttribute Update(MethodSymbol? constructor, ImmutableArray<BoundExpression> constructorArguments, ImmutableArray<string?> constructorArgumentNamesOpt, ImmutableArray<int> constructorArgumentsToParamsOpt, bool constructorExpanded, BitVector constructorDefaultArguments, ImmutableArray<BoundAssignmentOperator> namedArguments, LookupResultKind resultKind, TypeSymbol type)
6351public 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)
6373public override MethodSymbol Constructor { get; }
6374public ImmutableArray<MethodSymbol> ConstructorsGroup { get; }
6388public 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)
6443public 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)
6465public MethodSymbol? CollectionBuilderMethod { get; }
6474public BoundCollectionExpression Update(CollectionExpressionTypeKind collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundValuePlaceholder? collectionBuilderInvocationPlaceholder, BoundExpression? collectionBuilderInvocationConversion, bool wasTargetTyped, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type)
6631public 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)
6654public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
6660public BoundDynamicObjectCreationExpression Update(string name, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, ImmutableArray<MethodSymbol> applicableMethods, bool wasTargetTyped, TypeSymbol type)
6875public 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)
6894public MethodSymbol AddMethod { get; }
6906public BoundCollectionElementInitializer Update(MethodSymbol addMethod, ImmutableArray<BoundExpression> arguments, BoundExpression? implicitReceiverOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, bool invokedAsExtensionMethod, LookupResultKind resultKind, TypeSymbol type)
6920public BoundDynamicCollectionElementInitializer(SyntaxNode syntax, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false)
6933public ImmutableArray<MethodSymbol> ApplicableMethods { get; }
6938public BoundDynamicCollectionElementInitializer Update(ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type)
6987public BoundAnonymousObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<BoundAnonymousPropertyDeclaration> declarations, TypeSymbol type, bool hasErrors = false)
7002public MethodSymbol Constructor { get; }
7009public BoundAnonymousObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<BoundAnonymousPropertyDeclaration> declarations, TypeSymbol type)
7093public BoundDelegateCreationExpression(SyntaxNode syntax, BoundExpression argument, MethodSymbol? methodOpt, bool isExtensionMethod, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false)
7108public MethodSymbol? MethodOpt { get; }
7115public BoundDelegateCreationExpression Update(BoundExpression argument, MethodSymbol? methodOpt, bool isExtensionMethod, bool wasTargetTyped, TypeSymbol type)
7602public BoundLambda(SyntaxNode syntax, UnboundLambda unboundLambda, MethodSymbol symbol, BoundBlock body, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics, Binder binder, TypeSymbol? type, bool hasErrors = false)
7619public MethodSymbol Symbol { get; }
7628public BoundLambda Update(UnboundLambda unboundLambda, MethodSymbol symbol, BoundBlock body, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics, Binder binder, TypeSymbol? type)
8157public 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)
8176public MethodSymbol? DeconstructMethod { get; }
8184public BoundRecursivePattern Update(BoundTypeExpression? declaredType, MethodSymbol? deconstructMethod, ImmutableArray<BoundPositionalSubpattern> deconstruction, ImmutableArray<BoundPropertySubpattern> properties, bool isExplicitNotNullTest, Symbol? variable, BoundExpression? variableAccess, TypeSymbol inputType, TypeSymbol narrowedType)
8281public BoundITuplePattern(SyntaxNode syntax, MethodSymbol getLengthMethod, MethodSymbol getItemMethod, ImmutableArray<BoundPositionalSubpattern> subpatterns, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false)
8300public MethodSymbol GetLengthMethod { get; }
8301public MethodSymbol GetItemMethod { get; }
8307public BoundITuplePattern Update(MethodSymbol getLengthMethod, MethodSymbol getItemMethod, ImmutableArray<BoundPositionalSubpattern> subpatterns, TypeSymbol inputType, TypeSymbol narrowedType)
8837public BoundWithExpression(SyntaxNode syntax, BoundExpression receiver, MethodSymbol? cloneMethod, BoundObjectInitializerExpressionBase initializerExpression, TypeSymbol type, bool hasErrors = false)
8852public MethodSymbol? CloneMethod { get; }
8858public BoundWithExpression Update(BoundExpression receiver, MethodSymbol? cloneMethod, BoundObjectInitializerExpressionBase initializerExpression, TypeSymbol type)
10989MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
10990ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
10998MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
10999ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11023MethodSymbol targetMethod = this.VisitMethodSymbol(node.TargetMethod);
11050MethodSymbol? getTypeFromHandle = this.VisitMethodSymbol(node.GetTypeFromHandle);
11069MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11076MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
11098MethodSymbol logicalOperator = this.VisitMethodSymbol(node.LogicalOperator);
11099MethodSymbol trueOperator = this.VisitMethodSymbol(node.TrueOperator);
11100MethodSymbol falseOperator = this.VisitMethodSymbol(node.FalseOperator);
11101ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11112ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalUserDefinedOperatorsOpt);
11191MethodSymbol? getResult = this.VisitMethodSymbol(node.GetResult);
11207MethodSymbol? getTypeFromHandle = this.VisitMethodSymbol(node.GetTypeFromHandle);
11221MethodSymbol method = this.VisitMethodSymbol(node.Method);
11281MethodSymbol method = this.VisitMethodSymbol(node.Method);
11282MethodSymbol? getMethodFromHandle = this.VisitMethodSymbol(node.GetMethodFromHandle);
11289MethodSymbol? getFieldFromHandle = this.VisitMethodSymbol(node.GetFieldFromHandle);
11334MethodSymbol conversionMethod = this.VisitMethodSymbol(node.ConversionMethod);
11352MethodSymbol? getPinnableOpt = this.VisitMethodSymbol(node.GetPinnableOpt);
11376ImmutableArray<MethodSymbol> localFunctions = this.VisitDeclaredLocalFunctions(node.LocalFunctions);
11414MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
11454ImmutableArray<MethodSymbol> innerLocalFunctions = this.VisitDeclaredLocalFunctions(node.InnerLocalFunctions);
11747MethodSymbol deconstructMethod = this.VisitMethodSymbol(node.DeconstructMethod);
11845ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
11860MethodSymbol? hasValueMethodOpt = this.VisitMethodSymbol(node.HasValueMethodOpt);
11881ImmutableArray<MethodSymbol> methods = this.VisitSymbols<MethodSymbol>(node.Methods);
11897MethodSymbol method = this.VisitMethodSymbol(node.Method);
11898ImmutableArray<MethodSymbol> originalMethodsOpt = this.VisitSymbols<MethodSymbol>(node.OriginalMethodsOpt);
11914MethodSymbol? constructor = this.VisitMethodSymbol(node.Constructor);
11928MethodSymbol constructor = this.VisitMethodSymbol(node.Constructor);
11929ImmutableArray<MethodSymbol> constructorsGroup = this.VisitSymbols<MethodSymbol>(node.ConstructorsGroup);
11943MethodSymbol? collectionBuilderMethod = this.VisitMethodSymbol(node.CollectionBuilderMethod);
11983ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
12025MethodSymbol addMethod = this.VisitMethodSymbol(node.AddMethod);
12033ImmutableArray<MethodSymbol> applicableMethods = this.VisitSymbols<MethodSymbol>(node.ApplicableMethods);
12046MethodSymbol constructor = this.VisitMethodSymbol(node.Constructor);
12066MethodSymbol? methodOpt = this.VisitMethodSymbol(node.MethodOpt);
12164MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
12261MethodSymbol? deconstructMethod = this.VisitMethodSymbol(node.DeconstructMethod);
12296MethodSymbol getLengthMethod = this.VisitMethodSymbol(node.GetLengthMethod);
12297MethodSymbol getItemMethod = this.VisitMethodSymbol(node.GetItemMethod);
12404MethodSymbol? cloneMethod = this.VisitMethodSymbol(node.CloneMethod);
12706MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12708ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12726MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12728ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt);
12784MethodSymbol targetMethod = GetUpdatedSymbol(node, node.TargetMethod);
12855MethodSymbol? getTypeFromHandle = GetUpdatedSymbol(node, node.GetTypeFromHandle);
12907MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
12925MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
13128MethodSymbol? getResult = GetUpdatedSymbol(node, node.GetResult);
13156MethodSymbol? getTypeFromHandle = GetUpdatedSymbol(node, node.GetTypeFromHandle);
13182MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13331MethodSymbol method = GetUpdatedSymbol(node, node.Method);
13332MethodSymbol? getMethodFromHandle = GetUpdatedSymbol(node, node.GetMethodFromHandle);
13350MethodSymbol? getFieldFromHandle = GetUpdatedSymbol(node, node.GetFieldFromHandle);
13468MethodSymbol conversionMethod = GetUpdatedSymbol(node, node.ConversionMethod);
13516MethodSymbol? getPinnableOpt = GetUpdatedSymbol(node, node.GetPinnableOpt);
13537ImmutableArray<MethodSymbol> localFunctions = GetUpdatedArray(node, node.LocalFunctions);
13568MethodSymbol symbol = GetUpdatedSymbol(node, node.Symbol);
13577ImmutableArray<MethodSymbol> innerLocalFunctions = GetUpdatedArray(node, node.InnerLocalFunctions);
13857MethodSymbol deconstructMethod = GetUpdatedSymbol(node, node.DeconstructMethod);
13987ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14024MethodSymbol? hasValueMethodOpt = GetUpdatedSymbol(node, node.HasValueMethodOpt);
14074ImmutableArray<MethodSymbol> methods = GetUpdatedArray(node, node.Methods);
14112MethodSymbol method = GetUpdatedSymbol(node, node.Method);
14113ImmutableArray<MethodSymbol> originalMethodsOpt = GetUpdatedArray(node, node.OriginalMethodsOpt);
14151MethodSymbol? constructor = GetUpdatedSymbol(node, node.Constructor);
14187MethodSymbol constructor = GetUpdatedSymbol(node, node.Constructor);
14188ImmutableArray<MethodSymbol> constructorsGroup = GetUpdatedArray(node, node.ConstructorsGroup);
14224MethodSymbol? collectionBuilderMethod = GetUpdatedSymbol(node, node.CollectionBuilderMethod);
14294ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14402MethodSymbol addMethod = GetUpdatedSymbol(node, node.AddMethod);
14421ImmutableArray<MethodSymbol> applicableMethods = GetUpdatedArray(node, node.ApplicableMethods);
14452MethodSymbol constructor = GetUpdatedSymbol(node, node.Constructor);
14505MethodSymbol? methodOpt = GetUpdatedSymbol(node, node.MethodOpt);
14724MethodSymbol symbol = GetUpdatedSymbol(node, node.Symbol);
14919MethodSymbol? deconstructMethod = GetUpdatedSymbol(node, node.DeconstructMethod);
14957MethodSymbol getLengthMethod = GetUpdatedSymbol(node, node.GetLengthMethod);
14958MethodSymbol getItemMethod = GetUpdatedSymbol(node, node.GetItemMethod);
15113MethodSymbol? 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)
386private static WellKnownMember GetBinaryOperatorFactory(BinaryOperatorKind opKind, MethodSymbol methodOpt, out bool isChecked, out bool isLifted, out bool requiresLifted)
482static bool useCheckedFactory(bool isChecked, MethodSymbol methodOpt)
488private BoundExpression VisitBinaryOperator(BinaryOperatorKind opKind, MethodSymbol methodOpt, TypeSymbol type, BoundExpression left, BoundExpression right)
568private BoundExpression MakeBinary(MethodSymbol methodOpt, TypeSymbol type, bool isLifted, bool requiresLifted, WellKnownMember opFactory, BoundExpression loweredLeft, BoundExpression loweredRight)
647var method = node.Method;
700var method = node.SymbolOpt;
758private BoundExpression DelegateCreation(BoundExpression receiver, MethodSymbol method, TypeSymbol delegateType, bool requiresInstanceReceiver)
763var createDelegate = _bound.WellKnownMethod(WellKnownMember.System_Reflection_MethodInfo__CreateDelegate, isOptional: true);
1105var getMethod = node.PropertySymbol.GetOwnOrInheritedGetMethod();
Lowering\DiagnosticsPass_ExpressionTrees.cs (13)
26private readonly MethodSymbol _containingSymbol;
31public static void IssueDiagnostics(CSharpCompilation compilation, BoundNode node, BindingDiagnosticBag diagnostics, MethodSymbol containingSymbol)
49private DiagnosticsPass(CSharpCompilation compilation, BindingDiagnosticBag diagnostics, MethodSymbol containingSymbol)
221private void CheckReferenceToMethodIfLocalFunction(BoundExpression node, MethodSymbol method)
305MethodSymbol method,
566var method = indexer.GetOwnOrInheritedGetMethod() ?? indexer.GetOwnOrInheritedSetMethod();
608var lambda = node.Symbol;
751var binary = node.LogicalOperator;
752var unary = node.OperatorKind.Operator() == BinaryOperatorKind.And ? node.FalseOperator : node.TrueOperator;
801if (_inExpressionLambda && node.MethodOpt is MethodSymbol method && (method.IsAbstract || method.IsVirtual) && method.IsStatic)
898if (_inExpressionLambda && node.Conversion.Method is MethodSymbol method && (method.IsAbstract || method.IsVirtual) && method.IsStatic)
931private void CheckMethodGroup(BoundMethodGroup node, MethodSymbol method, bool isExtensionMethod, bool parentIsConversion, TypeSymbol convertedToType)
940if ((node.LookupSymbolOpt as MethodSymbol)?.MethodKind == MethodKind.LocalFunction)
Lowering\ExtensionMethodBodyRewriter.cs (14)
32public ExtensionMethodBodyRewriter(MethodSymbol sourceMethod, SourceExtensionImplementationMethodSymbol implementationMethod)
51private (RewrittenMethodSymbol, ImmutableDictionary<Symbol, Symbol>) EnterMethod(MethodSymbol symbol, RewrittenMethodSymbol rewritten, ReadOnlySpan<ParameterSymbol> rewrittenParameters)
73private (RewrittenMethodSymbol, ImmutableDictionary<Symbol, Symbol>) EnterMethod(MethodSymbol symbol, RewrittenLambdaOrLocalFunctionSymbol rewritten)
78protected override MethodSymbol CurrentMethod => _rewrittenContainingMethod;
110MethodSymbol symbol = this.VisitMethodSymbol(node.Symbol);
129foreach (var localFunction in node.LocalFunctions)
143protected override ImmutableArray<MethodSymbol> VisitDeclaredLocalFunctions(ImmutableArray<MethodSymbol> localFunctions)
145return localFunctions.SelectAsArray(static (l, map) => (MethodSymbol)map[l], _symbolMap);
149public override MethodSymbol? VisitMethodSymbol(MethodSymbol? symbol)
154return (MethodSymbol)_symbolMap[symbol];
159return (MethodSymbol)_symbolMap[symbol];
162return ((MethodSymbol)_symbolMap[symbol.OriginalDefinition]).ConstructIfGeneric(TypeMap.SubstituteTypes(symbol.TypeArgumentsWithAnnotations));
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (16)
26private readonly MethodSymbol _method;
28private readonly MethodSymbol _createPayloadForMethodsSpanningSingleFile;
29private readonly MethodSymbol _createPayloadForMethodsSpanningMultipleFiles;
40MethodSymbol method,
63MethodSymbol createPayloadForMethodsSpanningSingleFile = GetCreatePayloadOverload(
69MethodSymbol createPayloadForMethodsSpanningMultipleFiles = GetCreatePayloadOverload(
102MethodSymbol method,
105MethodSymbol createPayloadForMethodsSpanningSingleFile,
106MethodSymbol createPayloadForMethodsSpanningMultipleFiles,
123var oldMethod = methodBodyFactory.CurrentFunction;
141private static bool IsExcludedFromCodeCoverage(MethodSymbol method)
169MethodSymbol createPayloadForMethodsSpanningSingleFile,
170MethodSymbol createPayloadForMethodsSpanningMultipleFiles,
177MethodSymbol createPayloadOverload;
564private static MethodSymbol GetCreatePayloadOverload(CSharpCompilation compilation, WellKnownMember overload, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
566return (MethodSymbol)Binder.GetWellKnownTypeMember(compilation, overload, diagnostics, syntax: syntax);
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (15)
153MethodSymbol method,
204private MethodSymbol? GetLocalOrParameterStoreLogger(TypeSymbol variableType, Symbol targetSymbol, bool? refAssignmentSourceIsLocal, SyntaxNode syntax)
263var symbol = GetWellKnownMethodSymbol(overload, syntax);
268private MethodSymbol? GetWellKnownMethodSymbol(WellKnownMember overload, SyntaxNode syntax)
269=> (MethodSymbol?)Binder.GetWellKnownTypeMember(_factory.Compilation, overload, _diagnostics, syntax: syntax, isOptional: false);
271private MethodSymbol? GetSpecialMethodSymbol(SpecialMember overload, SyntaxNode syntax)
272=> (MethodSymbol?)Binder.GetSpecialTypeMember(_factory.Compilation, overload, _diagnostics, syntax: syntax);
312var parameterLogger = GetLocalOrParameterStoreLogger(parameter.Type, parameter, refAssignmentSourceIsLocal: null, _factory.Syntax);
347var entryLogger = GetWellKnownMethodSymbol(entryOverload, _factory.Syntax);
351var returnLogger = GetWellKnownMethodSymbol(WellKnownMember.Microsoft_CodeAnalysis_Runtime_LocalStoreTracker__LogReturn, _factory.Syntax);
398var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal, original.Syntax);
469var toStringMethod = GetSpecialMethodSymbol(SpecialMember.System_Object__ToString, value.Syntax);
530var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, original.Syntax);
551MethodSymbol method = original.Method;
608var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, invocation.Syntax);
Lowering\LocalRewriter\DelegateCacheContainer.cs (8)
19private readonly Dictionary<(TypeSymbol?, TypeSymbol, MethodSymbol), FieldSymbol> _delegateFields = new(CLRSignatureComparer.Instance);
36TypeMap.ConcatMethodTypeParameters((MethodSymbol)owner, stopAt: null)))
40Debug.Assert(owner is NamedTypeSymbol { Arity: > 0 } or MethodSymbol { Arity: > 0 });
62var targetMethod = boundDelegateCreation.MethodOpt;
93private sealed class CLRSignatureComparer : IEqualityComparer<(TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod)>
97public bool Equals((TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) x, (TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) y)
106public int GetHashCode((TypeSymbol? constrainedToTypeOpt, TypeSymbol delegateType, MethodSymbol targetMethod) conversion)
Lowering\LocalRewriter\LocalRewriter.cs (18)
57MethodSymbol containingMethod,
86MethodSymbol method,
333delegateType.DelegateInvokeMethod() is MethodSymbol delegateInvoke &&
351var lambda = node.Symbol;
354var oldContainingSymbol = _factory.CurrentFunction;
384var localFunction = node.Symbol;
415static bool hasReturnTypeOrParameter(MethodSymbol localFunction, Func<TypeWithAnnotations, bool> predicate) =>
419var oldContainingSymbol = _factory.CurrentFunction;
606/// Recommendation: Do not use, use <see cref="TryGetSpecialTypeMethod(SyntaxNode, SpecialMember, out MethodSymbol, bool)"/> instead!
609private MethodSymbol UnsafeGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember)
616/// Recommendation: Do not use, use <see cref="TryGetSpecialTypeMethod(SyntaxNode, SpecialMember, CSharpCompilation, BindingDiagnosticBag, out MethodSymbol, bool)"/> instead!
619private static MethodSymbol UnsafeGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, CSharpCompilation compilation, BindingDiagnosticBag diagnostics)
621MethodSymbol method;
636private bool TryGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, out MethodSymbol method, bool isOptional = false)
641private static bool TryGetSpecialTypeMethod(SyntaxNode syntax, SpecialMember specialMember, CSharpCompilation compilation, BindingDiagnosticBag diagnostics, out MethodSymbol method, bool isOptional = false)
657MethodSymbol? getTypeFromHandle;
687MethodSymbol? getTypeFromHandle;
1130private void CheckRefReadOnlySymbols(MethodSymbol symbol)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (23)
187MethodSymbol? method,
203MethodSymbol? method,
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);
539var constructMethod = node.CollectionBuilderMethod;
616: WellKnownMember.System_Span_T__ctor_ref_T, isOptional: true) is MethodSymbol spanRefConstructor)
622var constructor = spanRefConstructor.AsMember(spanType);
634MethodSymbol elementRef = _factory.ModuleBuilderOpt.EnsureInlineArrayElementRefExists(syntax, intType, _diagnostics.DiagnosticBag).
661MethodSymbol inlineArrayAsSpan = asReadOnlySpan ?
737&& tryGetToArrayMethod(spreadTypeOriginalDefinition, WellKnownType.System_Collections_Generic_List_T, WellKnownMember.System_Collections_Generic_List_T__ToArray, out MethodSymbol? listToArrayMethod))
748var linqToArrayMethod = linqToArrayMethodGeneric.Construct([arrayType.ElementTypeWithAnnotations]);
757&& TryGetSpanConversion(spreadExpression.Type, writableOnly: false, out var asSpanMethod))
760if (tryGetToArrayMethod(spanType, WellKnownType.System_ReadOnlySpan_T, WellKnownMember.System_ReadOnlySpan_T__ToArray, out var toArrayMethod)
768bool tryGetToArrayMethod(TypeSymbol spreadTypeOriginalDefinition, WellKnownType wellKnownType, WellKnownMember wellKnownMember, [NotNullWhen(true)] out MethodSymbol? toArrayMethod)
926private bool TryGetSpanConversion(TypeSymbol type, bool writableOnly, out MethodSymbol? asSpanMethod)
976if (!TryGetSpanConversion(type, writableOnly, out var asSpanMethod))
986private BoundExpression CallAsSpanMethod(BoundExpression spreadExpression, MethodSymbol? asSpanMethod)
992if (asSpanMethod is MethodSymbol { MethodKind: MethodKind.Constructor } constructor)
996else if (asSpanMethod is MethodSymbol { IsStatic: true, ParameterCount: 1 })
1010private (MethodSymbol spanSliceMethod, BoundExpression spreadElementAsSpan, MethodSymbol getLengthMethod, MethodSymbol copyToMethod)? PrepareCopyToOptimization(
1035(MethodSymbol getLengthMethod, MethodSymbol copyToMethod)? getSpanMethodsForSpread(
1057MethodSymbol spanSliceMethod,
1059MethodSymbol getLengthMethod,
1060MethodSymbol copyToMethod)
1106MethodSymbol? setCount = null;
1107MethodSymbol? asSpan = null;
1112setCount = ((MethodSymbol?)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_CollectionsMarshal__SetCount_T))?.Construct(typeArguments);
1113asSpan = ((MethodSymbol?)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_CollectionsMarshal__AsSpan_T))?.Construct(typeArguments);
1128var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ctorInt32)).AsMember(collectionType);
1152var constructor = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ctor)).AsMember(collectionType);
1178var spanGetItem = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Span_T__get_Item)).AsMember((NamedTypeSymbol)spanTemp.Type);
1232var addMethod = _factory.WellKnownMethod(WellKnownMember.System_Collections_Generic_List_T__Add).AsMember(collectionType);
1233var addRangeMethod = _factory.WellKnownMethod(WellKnownMember.System_Collections_Generic_List_T__AddRange, isOptional: true)?.AsMember(collectionType);
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (24)
109if (!TryGetWellKnownTypeMember<MethodSymbol>(node.Syntax, WellKnownMember.System_ReadOnlySpan_T__ctor_Array_Start_Length, out MethodSymbol? ctor))
551MethodSymbol? symbolOpt = oldNodeOpt.SymbolOpt;
564var method = oldNodeOpt.SymbolOpt;
597MethodSymbol createSpan;
631MethodSymbol method = methodDefinition.AsMember(destinationType);
654MethodSymbol implicitOperator = implicitOperatorDefinition.AsMember((NamedTypeSymbol)sourceType);
667MethodSymbol castUpMethod = castUpMethodDefinition.AsMember(destinationType).Construct([sourceElementType]);
688MethodSymbol method = methodDefinition.AsMember(destinationType).Construct([sourceElementType]);
743delegateType.DelegateInvokeMethod() is MethodSymbol delegateInvoke &&
1066MethodSymbol ctor = UnsafeGetNullableMethod(syntax, rewrittenType, SpecialMember.System_Nullable_T__ctor);
1082MethodSymbol get_Value = UnsafeGetNullableMethod(syntax, rewrittenOperandType, SpecialMember.System_Nullable_T_get_Value);
1128if (!TryGetSpecialTypeMethod(syntax, DecimalConversionMethod(typeFromUnderlying, typeToUnderlying), out MethodSymbol method))
1169MethodSymbol getValueOrDefault;
1386MethodSymbol ctor = UnsafeGetNullableMethod(call.Syntax, resultType, SpecialMember.System_Nullable_T__ctor);
1437MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, boundTemp.Type, SpecialMember.System_Nullable_T_GetValueOrDefault);
1499MethodSymbol method;
1732if (!TryGetSpecialTypeMethod(syntax, member, out MethodSymbol method))
1762var meth = conversion.Method;
1794MethodSymbol method;
1808MethodSymbol method;
1825MethodSymbol method;
1838MethodSymbol method;
1866private Conversion TryMakeUserDefinedConversion(SyntaxNode syntax, MethodSymbol meth, TypeSymbol fromType, TypeSymbol toType, bool @checked, bool isImplicit)
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (23)
61else if (node.EnumeratorInfoOpt?.MoveNextAwaitableInfo is null && CanRewriteForEachAsFor(node.Syntax, nodeExpressionType, out var indexerGet, out var lengthGetter))
71private bool CanRewriteForEachAsFor(SyntaxNode forEachSyntax, TypeSymbol nodeExpressionType, [NotNullWhen(true)] out MethodSymbol? indexerGet, [NotNullWhen(true)] out MethodSymbol? lengthGet)
76internal static bool CanRewriteForEachAsFor(CSharpCompilation compilation, SyntaxNode forEachSyntax, TypeSymbol nodeExpressionType, [NotNullWhen(true)] out MethodSymbol? indexerGet, [NotNullWhen(true)] out MethodSymbol? lengthGet, BindingDiagnosticBag diagnostics)
89lengthGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_Span_T__get_Length, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
90indexerGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_Span_T__get_Item, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
95lengthGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_ReadOnlySpan_T__get_Length, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
96indexerGet = (MethodSymbol?)Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_ReadOnlySpan_T__get_Item, diagnostics, syntax: forEachSyntax, isOptional: true)?.SymbolAsMember(spanType);
294private bool TryGetDisposeMethod(SyntaxNode forEachSyntax, ForEachEnumeratorInfo enumeratorInfo, out MethodSymbol disposeMethod)
298disposeMethod = (MethodSymbol)Binder.GetWellKnownTypeMember(_compilation, WellKnownMember.System_IAsyncDisposable__DisposeAsync, _diagnostics, syntax: forEachSyntax);
328MethodSymbol? disposeMethod = enumeratorInfo.PatternDisposeInfo?.Method; // pattern-based
499private BoundExpression ConvertReceiverForInvocation(CSharpSyntaxNode syntax, BoundExpression receiver, MethodSymbol method, Conversion receiverConversion, TypeSymbol convertedReceiverType)
702private BoundStatement RewriteForEachStatementAsFor(BoundForEachStatement node, MethodSymbol indexerGet, MethodSymbol lengthGet)
706getItem: static (LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, BoundLocal boundArrayVar, BoundLocal boundPositionVar, (MethodSymbol indexerGet, MethodSymbol lengthGet) arg) =>
715getLength: static (LocalRewriter rewriter, SyntaxNode syntax, BoundLocal boundArrayVar, (MethodSymbol indexerGet, MethodSymbol lengthGet) arg) =>
760MethodSymbol elementRef;
1058MethodSymbol getLowerBoundMethod = UnsafeGetSpecialTypeMethod(forEachSyntax, SpecialMember.System_Array__GetLowerBound);
1059MethodSymbol getUpperBoundMethod = UnsafeGetSpecialTypeMethod(forEachSyntax, SpecialMember.System_Array__GetUpperBound);
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (11)
158var getMethod = indexer.GetOwnOrInheritedGetMethod();
254var getItemOrSliceHelper = (MethodSymbol?)_compilation.GetWellKnownTypeMember(node.GetItemOrSliceHelper);
282MethodSymbol createSpan = getCreateSpanHelper(node, spanType: getItemOrSliceHelper.ContainingType, intType: (NamedTypeSymbol)getItemOrSliceHelper.Parameters[0].Type);
360MethodSymbol getCreateSpanHelper(BoundInlineArrayAccess node, NamedTypeSymbol spanType, NamedTypeSymbol intType)
364MethodSymbol createSpan;
377BoundExpression getElementRef(BoundInlineArrayAccess node, BoundExpression rewrittenReceiver, BoundExpression index, MethodSymbol getItemOrSliceHelper, int length)
389MethodSymbol elementRef;
408MethodSymbol elementRef;
431MethodSymbol createSpan = getCreateSpanHelper(node, spanType, intType);
769else if (unloweredExpr is BoundObjectCreationExpression { Constructor: MethodSymbol constructor, Arguments: { Length: 2 } arguments, ArgsToParamsOpt: { IsDefaultOrEmpty: true }, InitializerExpressionOpt: null } &&
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (4)
140TryGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeft.Type, SpecialMember.System_Nullable_T_GetValueOrDefault, out MethodSymbol? getValueOrDefault, isOptional: true))
147TryGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeft.Type, SpecialMember.System_Nullable_T_GetValueOrDefaultDefaultValue, out MethodSymbol? getValueOrDefaultDefaultValue, isOptional: true))
199var method = boundCall.Method;
257MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeftType, SpecialMember.System_Nullable_T_GetValueOrDefault);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (22)
156if (!TryGetSpecialTypeMethod(originalSyntax, concatMember, out var spanConcat, isOptional: true)
157|| !TryGetNeededToSpanMembers(this, originalSyntax, needsImplicitConversionFromStringToSpan, charType, out var readOnlySpanCtorRefParamChar, out var stringImplicitConversionToReadOnlySpan))
194var method = UnsafeGetSpecialTypeMethod(originalSyntax, concatMember);
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)
746var ctor = type.InstanceConstructors.Single(c => c.ParameterCount == args.Length);
750public BoundObjectCreationExpression New(MethodSymbol ctor, params BoundExpression[] args)
755var ctor = type.InstanceConstructors.Single(c => c.ParameterCount == args.Length);
759public BoundObjectCreationExpression New(MethodSymbol ctor, ImmutableArray<BoundExpression> args)
762public BoundObjectCreationExpression New(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKinds)
779var ctor = WellKnownMethod(wm);
798public BoundExpression StaticCall(TypeSymbol receiver, MethodSymbol method, params BoundExpression[] args)
808public BoundExpression StaticCall(MethodSymbol method, ImmutableArray<BoundExpression> args)
813MethodSymbol methodSymbol = WellKnownMethod(method);
821MethodSymbol methodSymbol = WellKnownMethod(method);
832MethodSymbol methodSymbol = SpecialMethod(method);
837public BoundCall Call(BoundExpression? receiver, MethodSymbol method)
842public BoundCall Call(BoundExpression? receiver, MethodSymbol method, BoundExpression arg0, bool useStrictArgumentRefKinds = false)
847public BoundCall Call(BoundExpression? receiver, MethodSymbol method, BoundExpression arg0, BoundExpression arg1, bool useStrictArgumentRefKinds = false)
852public BoundCall Call(BoundExpression? receiver, MethodSymbol method, params BoundExpression[] args)
860public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<BoundExpression> args, bool useStrictArgumentRefKinds = false)
872public static ImmutableArray<RefKind> ArgumentRefKindsFromParameterRefKinds(MethodSymbol method, bool useStrictArgumentRefKinds)
902public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<RefKind> refKinds, ImmutableArray<BoundExpression> args)
1206var ctor = baseType.InstanceConstructors.Single(c => c.ParameterCount == 0);
1271MethodSymbol getTypeFromHandle;
1313internal BoundExpression ConstructorInfo(MethodSymbol ctor)
1331public BoundExpression MethodDefIndex(MethodSymbol method)
1413public BoundExpression MethodInfo(MethodSymbol method, TypeSymbol systemReflectionMethodInfo)
1448private MethodSymbol GetMethodFromHandleMethod(NamedTypeSymbol methodContainer, TypeSymbol systemReflectionMethodOrConstructorInfo)
1472private MethodSymbol GetFieldFromHandleMethod(NamedTypeSymbol fieldContainer)
1553MethodSymbol? arrayEmpty = SpecialMethod(CodeAnalysis.SpecialMember.System_Array__Empty, isOptional: true);
1662MethodSymbol? containingMethod = this.CurrentFunction;
Symbols\Compilation_WellKnownMembers.cs (13)
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 &&
4113(prevMethod.IsPartialImplementation || (prevMethod.OtherPartOfPartial is MethodSymbol otherImplementation && (object)otherImplementation != currentMethod)))
4119(prevMethod.IsPartialDefinition || (prevMethod.OtherPartOfPartial is MethodSymbol otherDefinition && (object)otherDefinition != currentMethod)))
4357MethodSymbol accessor = getNotSet ? propertySymbol.GetMethod : propertySymbol.SetMethod;
4382var methodSymbol = (MethodSymbol)symbol;
4421var methodSymbol = (MethodSymbol)symbol;
4574var meth = (MethodSymbol)member;
4636var meth = (MethodSymbol)member;
4683var m = s as MethodSymbol;
4728if (hasInitializers && !builder.NonTypeMembersWithPartialImplementations.Any(member => member is MethodSymbol { MethodKind: MethodKind.Constructor }))
4780case MethodSymbol { MethodKind: not (MethodKind.Ordinary or MethodKind.Constructor) }:
4836var thisEquals = addThisEquals(equalityContract);
4844var getHashCode = addGetHashCode(equalityContract);
4852var printMembers = addPrintMembersMethod(membersSoFar);
4890ImmutableArray<MethodSymbol>.Empty);
4898var deconstruct = (MethodSymbol)existingDeconstructMethod;
4938ImmutableArray<MethodSymbol>.Empty);
4952var constructor = (MethodSymbol)existingConstructor;
4971MethodSymbol addPrintMembersMethod(IEnumerable<Symbol> userDefinedMembers)
4990explicitInterfaceImplementations: ImmutableArray<MethodSymbol>.Empty);
4992MethodSymbol printMembersMethod;
5000printMembersMethod = (MethodSymbol)existingPrintMembersMethod;
5031void addToStringMethod(MethodSymbol printMethod)
5045explicitInterfaceImplementations: ImmutableArray<MethodSymbol>.Empty);
5047var baseToStringMethod = getBaseToStringMethod();
5074var toStringMethod = (MethodSymbol)existingToStringMethod;
5085MethodSymbol? getBaseToStringMethod()
5093if (member is not MethodSymbol method)
5200void addObjectEquals(MethodSymbol thisEquals)
5205MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5219ImmutableArray<MethodSymbol>.Empty);
5221MethodSymbol getHashCode;
5230getHashCode = (MethodSymbol)existingHashCodeMethod;
5298MethodSymbol addThisEquals(PropertySymbol? equalityContract)
5318ImmutableArray<MethodSymbol>.Empty);
5320MethodSymbol thisEquals;
5329thisEquals = (MethodSymbol)existingEqualsMethod;
5392var method = (MethodSymbol)member;
5848private void AddAccessorIfAvailable(ArrayBuilder<Symbol> symbols, MethodSymbol? accessorOpt)
6013if (member is MethodSymbol { MethodKind: MethodKind.Ordinary })
6041ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)>.Empty);
6044public readonly ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> MethodImpls;
6048ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> methodImpls)
6056ImmutableArray<(MethodSymbol Body, MethodSymbol Implemented)> methodImpls)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (62)
18internal delegate void ReportMismatchInReturnType<TArg>(BindingDiagnosticBag bag, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, bool topLevel, TArg arg);
19internal delegate void ReportMismatchInParameterType<TArg>(BindingDiagnosticBag bag, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, ParameterSymbol parameter, bool topLevel, TArg arg);
73internal sealed override IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls()
115var methodImpls = ArrayBuilder<(MethodSymbol Body, MethodSymbol Implemented)>.GetInstance();
237var associatedPropertyOrEvent = interfaceMemberKind == SymbolKind.Method ? ((MethodSymbol)interfaceMember).AssociatedSymbol : null;
536var method = (MethodSymbol)member;
537if (MethodSymbol.CanOverrideOrHide(method.MethodKind) && !method.IsAccessor())
558MethodSymbol overridden = method.GetFirstRuntimeOverriddenMethodIgnoringNewSlot(out _);
572var getMethod = property.GetMethod;
573var setMethod = property.SetMethod;
613var addMethod = @event.AddMethod;
614var removeMethod = @event.RemoveMethod;
704if (hiddenMember.Kind == SymbolKind.Method && !((MethodSymbol)hiddenMember).CanBeHiddenByMember(symbol))
782associatedPropertyOrEvent = ((MethodSymbol)overridingMember).AssociatedSymbol;
791? ((MethodSymbol)overridingMember).ParameterTypesWithAnnotations
855if (!this.ContainingAssembly.RuntimeSupportsCovariantReturnsOfClasses && overridingMember is MethodSymbol overridingMethod)
860var ambiguousMethod = overridingMethod.OverriddenMethod;
892!(overridingMemberIsMethod && ((MethodSymbol)overriddenMember).MethodKind == MethodKind.Destructor)) //destructors are metadata virtual
921else if (overriddenMember is MethodSymbol overridden && overridden.IsOperator() != ((MethodSymbol)overridingMember).IsOperator())
983var overridingMethod = (MethodSymbol)overridingMember;
984var overriddenMethod = (MethodSymbol)overriddenMember;
1102MethodSymbol overriddenGetMethod = overriddenProperty.GetOwnOrInheritedGetMethod();
1112var ownOrInheritedOverriddenSetMethod = overriddenProperty.GetOwnOrInheritedSetMethod();
1133MethodSymbol ownOrInheritedGetMethod = overridingProperty.GetOwnOrInheritedGetMethod();
1140MethodSymbol ownOrInheritedSetMethod = overridingProperty.GetOwnOrInheritedSetMethod();
1153MethodSymbol overriddenMethod,
1154MethodSymbol overridingMethod,
1222(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, bool topLevel, Location location)
1229(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, ParameterSymbol overridingParameter, bool topLevel, Location location)
1240MethodSymbol baseMethod,
1241MethodSymbol overrideMethod,
1381internal static bool RequiresValidScopedOverrideForRefSafety(MethodSymbol? method, ParameterSymbol? overrideThisParameter)
1440internal static bool ReportInvalidScopedOverrideAsError(MethodSymbol baseMethod, MethodSymbol overrideMethod)
1451MethodSymbol? baseMethod,
1452MethodSymbol? overrideMethod,
1504MethodSymbol? baseMethod,
1505MethodSymbol? overrideMethod,
1633if (hidingMember is MethodSymbol hidingMethod && hiddenMembers[0] is MethodSymbol hiddenMethod)
1693var associatedPropertyOrEvent = ((MethodSymbol)hidingMember).AssociatedSymbol;
1811private (SynthesizedExplicitImplementationForwardingMethod? ForwardingMethod, (MethodSymbol Body, MethodSymbol Implemented)? MethodImpl)
1830MethodSymbol interfaceMethod = (MethodSymbol)interfaceMember;
1831MethodSymbol implementingMethod = (MethodSymbol)implementingMember;
1841MethodSymbol implementingMethodOriginalDefinition = implementingMethod.OriginalDefinition;
1860else if (implementingMethod.IsMetadataVirtual(MethodSymbol.IsMetadataVirtualOption.IgnoreInterfaceImplementationChanges))
1913private static bool IsPossibleImplementationUnderRuntimeRules(MethodSymbol implementingMethod, NamedTypeSymbol @interface)
1937private static bool IsOverrideOfPossibleImplementationUnderRuntimeRules(MethodSymbol implementingMethod, NamedTypeSymbol @interface)
1939MethodSymbol curr = implementingMethod;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (62)
322(MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_IEnumerable__GetEnumerator),
342(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__CopyTo)!,
347(PropertySymbol)((MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__get_Item)!).AssociatedSymbol,
363(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Add)!,
368(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Clear)!,
373(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Contains)!,
378(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IndexOf)!,
383(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Insert)!,
388(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__Remove)!,
393(MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__RemoveAt)!,
398((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerable_T__GetEnumerator)!).AsMember(iEnumerableT),
410((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyList_T__get_Item)!).AssociatedSymbol).AsMember(iReadOnlyListT),
426((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Add)!).AsMember(iCollectionT),
431((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Clear)!).AsMember(iCollectionT),
436((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Contains)!).AsMember(iCollectionT),
441((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__CopyTo)!).AsMember(iCollectionT),
446((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Remove)!).AsMember(iCollectionT),
451((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__get_Item)!).AssociatedSymbol).AsMember(iListT),
457((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__IndexOf)!).AsMember(iListT),
462((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__Insert)!).AsMember(iListT),
467((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__RemoveAt)!).AsMember(iListT),
472static BoundStatement generateGetEnumerator(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
497static BoundStatement generateCount(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
525static BoundStatement generateIsSynchronized(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
532static BoundStatement generateSyncRoot(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
542static BoundStatement generateIsFixedSize(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
549static BoundStatement generateIsReadOnly(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
556static BoundStatement generateContains(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
582var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__Contains);
592static BoundStatement generateCopyTo(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
604var arraySetValueMethod = (MethodSymbol)method.DeclaringCompilation.GetSpecialTypeMember(SpecialMember.System_Array__SetValue)!;
637var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__CopyTo);
649static BoundStatement generateIndexer(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
660var constructor = (MethodSymbol)method.DeclaringCompilation.GetWellKnownTypeMember(WellKnownMember.System_IndexOutOfRangeException__ctor)!;
676var listMember = (PropertySymbol)((MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__get_Item)).AssociatedSymbol;
683static BoundStatement generateIndexOf(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
713var listMember = (MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__IndexOf);
722static BoundStatement generateNotSupportedException(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
724var constructor = (MethodSymbol)method.DeclaringCompilation.GetWellKnownTypeMember(WellKnownMember.System_NotSupportedException__ctor)!;
744var equalityComparer_get_Default = f.WellKnownMethod(
746var equalityComparer_Equals = f.WellKnownMethod(
958internal override IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls() => SpecializedCollections.EmptyEnumerable<(MethodSymbol Body, MethodSymbol Implemented)>();
Symbols\TypeSymbol.cs (64)
85internal ImmutableDictionary<MethodSymbol, MethodSymbol>? synthesizedMethodImplMap;
865if (checkPendingExplicitImplementations && interfaceMember is MethodSymbol interfaceMethod &&
869MethodSymbol bodyOfSynthesizedMethodImpl = currType.GetBodyOfSynthesizedInterfaceMethodImpl(interfaceMethod);
943if (implementingTypeIsFromSomeCompilation && implicitImpl is MethodSymbol implicitImplMethod && implicitImplMethod.IsOperator() != ((MethodSymbol)interfaceMember).IsOperator())
955CheckForImplementationOfCorrespondingPropertyOrEvent((MethodSymbol)interfaceMember, implementingType, implementingTypeIsFromSomeCompilation, ref implicitImpl);
1062(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1087static bool stopLookup(MethodSymbol interfaceAccessor, TypeSymbol implementingType)
1114(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1170(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1402private static (MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) GetImplementableAccessors(Symbol interfaceMember)
1404MethodSymbol interfaceAccessor1;
1405MethodSymbol interfaceAccessor2;
1465(MethodSymbol interfaceAccessor1, MethodSymbol interfaceAccessor2) = GetImplementableAccessors(interfaceMember);
1500private static bool TryGetExplicitImplementationAssociatedPropertyOrEvent(bool checkPendingExplicitImplementations, MethodSymbol interfaceAccessor, TypeSymbol currType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out Symbol associated)
1511? ((MethodSymbol)implementation).AssociatedSymbol
1520MethodSymbol bodyOfSynthesizedMethodImpl = currType.GetBodyOfSynthesizedInterfaceMethodImpl(interfaceAccessor);
1544private static void CheckForImplementationOfCorrespondingPropertyOrEvent(MethodSymbol interfaceMethod, TypeSymbol implementingType, bool implementingTypeIsFromSomeCompilation,
1564MethodSymbol correspondingImplementingAccessor = null;
1605MethodSymbol interfaceAccessorWithImplementationName = new SignatureOnlyMethodSymbol(
1681var interfaceMethod = (MethodSymbol)interfaceMember;
1695var implicitImplMethod = (MethodSymbol)implicitImpl;
1802MethodSymbol implementedMethod,
1803MethodSymbol implementingMethod,
1920var implementingGetMethod = implementedProperty.GetMethod.IsImplementable() ?
1923var implementingSetMethod = implementedProperty.SetMethod.IsImplementable() ?
1947var implementingMethod = (MethodSymbol)implementingMember;
1948var implementedMethod = (MethodSymbol)interfaceMember;
2013var method = (MethodSymbol)interfaceMember;
2033hasRefReturnMismatch = ((MethodSymbol)closestMismatch).RefKind != interfaceMemberRefKind;
2052else if (interfaceMember is MethodSymbol interfaceMethod &&
2053interfaceMethod.IsOperator() != ((MethodSymbol)closestMismatch).IsOperator())
2066if (!(one is MethodSymbol oneMethod))
2071if (!(other is MethodSymbol otherMethod))
2096private static bool ReportAnyMismatchedConstraints(MethodSymbol interfaceMethod, TypeSymbol implementingType, MethodSymbol implicitImpl, BindingDiagnosticBag diagnostics)
2183if (interfaceMember is MethodSymbol { IsStatic: true } interfaceMethod)
2193(((MethodSymbol)member).MethodKind is MethodKind.UserDefinedOperator or MethodKind.Conversion) != isOperator.GetValueOrDefault())
2297Debug.Assert(interfaceMember.Kind != SymbolKind.Method || (object)interfaceMember == ((MethodSymbol)interfaceMember).ConstructedFrom);
2308/// <see cref="MethodSymbol.ExplicitInterfaceImplementations"/> API, this method returns the "Body" part
2316protected MethodSymbol? GetBodyOfSynthesizedInterfaceMethodImpl(MethodSymbol interfaceMethod)
2329if (info.synthesizedMethodImplMap.TryGetValue(interfaceMethod, out MethodSymbol? result))
2336ImmutableDictionary<MethodSymbol, MethodSymbol> makeSynthesizedMethodImplMap()
2338var map = ImmutableDictionary.CreateBuilder<MethodSymbol, MethodSymbol>(ExplicitInterfaceImplementationTargetMemberEqualityComparer.Instance);
2339foreach ((MethodSymbol body, MethodSymbol implemented) in this.SynthesizedInterfaceMethodImpls())
2351/// <see cref="MethodSymbol.ExplicitInterfaceImplementations"/> API. The "Body" is the method that
2358internal abstract IEnumerable<(MethodSymbol Body, MethodSymbol Implemented)> SynthesizedInterfaceMethodImpls();
2414overriddenMember = ((MethodSymbol)member).OverriddenMethod;