4 implementations of IMethodSymbol
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (1)
18internal abstract class CodeGenerationAbstractMethodSymbol : CodeGenerationSymbol, IMethodSymbol
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\MethodSymbol.cs (1)
16internal sealed class MethodSymbol : Symbol, IMethodSymbol
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\MethodSymbol.vb (1)
16Implements IMethodSymbol, IMethodSymbolInternal
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (1)
18internal abstract class CodeGenerationAbstractMethodSymbol : CodeGenerationSymbol, IMethodSymbol
4832 references to IMethodSymbol
ConfigurationSchemaGenerator (18)
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (10)
84IMethodSymbol targetMethod = invocation.Operation.TargetMethod; 579private bool ConstructorParametersContainUnsupportedType(IMethodSymbol ctor) 600IMethodSymbol? ctor = null; 604IMethodSymbol? parameterlessCtor = null; 605IMethodSymbol? parameterizedCtor = null; 608foreach (IMethodSymbol candidate in typeSymbol.InstanceConstructors) 860member is IMethodSymbol { Parameters.Length: 1 } method && 876member is IMethodSymbol { Parameters.Length: 2 } method && 942_emitGenericParseEnum = _typeSymbols.Enum.GetMembers("Parse").Any(m => m is IMethodSymbol methodSymbol && methodSymbol.IsGenericMethod); 956if (throwIfNullMethod is IMethodSymbol throwIfNullMethodSymbol && throwIfNullMethodSymbol.IsStatic && throwIfNullMethodSymbol.Parameters.Length == 2)
RuntimeSource\Configuration.Binder\Parser\BinderInvocation.cs (1)
54if (operation.TargetMethod is not IMethodSymbol
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (2)
136IMethodSymbol targetMethod = operation.TargetMethod; 191IMethodSymbol targetMethod = operation.TargetMethod;
RuntimeSource\Configuration.Binder\Parser\OptionsBuilderConfigurationExtensions.cs (3)
17IMethodSymbol targetMethod = invocation.Operation.TargetMethod; 45IMethodSymbol targetMethod = operation.TargetMethod; 72IMethodSymbol targetMethod = invocation.Operation.TargetMethod;
RuntimeSource\Configuration.Binder\Parser\OptionsConfigurationServiceCollectionExtensions.cs (1)
18IMethodSymbol targetMethod = operation.TargetMethod;
RuntimeSource\Configuration.Binder\Specs\Members\PropertySpec.cs (1)
13IMethodSymbol? setMethod = property.SetMethod;
ILLink.RoslynAnalyzer (136)
COMAnalyzer.cs (1)
41 var targetMethod = invocationOperation.TargetMethod;
DataFlow\DynamicallyAccessedMembersBinder.cs (13)
33 foreach (var c in typeDefinition.GetConstructorsOnType (filter: null, bindingFlags: BindingFlags.NonPublic)) 38 foreach (var c in typeDefinition.GetConstructorsOnType (filter: null, bindingFlags: BindingFlags.Public)) 43 foreach (var c in typeDefinition.GetConstructorsOnType (filter: m => (m.DeclaredAccessibility == Accessibility.Public) && m.Parameters.Length == 0)) 48 foreach (var m in typeDefinition.GetMethodsOnTypeHierarchy (filter: null, bindingFlags: BindingFlags.NonPublic | declaredOnlyFlags)) 53 foreach (var m in typeDefinition.GetMethodsOnTypeHierarchy (filter: null, bindingFlags: BindingFlags.Public | declaredOnlyFlags)) 112 public static IEnumerable<IMethodSymbol> GetConstructorsOnType (this ITypeSymbol type, Func<IMethodSymbol, bool>? filter, BindingFlags? bindingFlags = null) 114 foreach (var method in type.GetMembers ().OfType<IMethodSymbol> ()) { 138 public static IEnumerable<IMethodSymbol> GetMethodsOnTypeHierarchy (this ITypeSymbol thisType, Func<IMethodSymbol, bool>? filter, BindingFlags? bindingFlags = null) 143 foreach (var method in type.GetMembers ().OfType<IMethodSymbol> ()) {
DataFlow\LocalDataFlowAnalysis.cs (1)
81 Debug.Assert (Context.OwningSymbol is not IMethodSymbol methodSymbol ||
DataFlow\LocalDataFlowVisitor.cs (23)
103 Debug.Assert (OwningSymbol is IMethodSymbol or IFieldSymbol or IPropertySymbol, 111 Debug.Assert (OwningSymbol is IMethodSymbol, 163 IMethodSymbol calledMethod, 179 var method = assemblyType.GetMembers (methodName).OfType<IMethodSymbol> ().SingleOrDefault (); 204 Debug.Assert (local.ContainingSymbol is IMethodSymbol or IFieldSymbol, // backing field for property initializers 262 IMethodSymbol? setMethod = propertyRef.Property.GetSetMethod (); 306 IMethodSymbol? setMethod = property.GetSetMethod (); 435 IMethodSymbol? addMethod = eventReference.Event.AddMethod; 441 IMethodSymbol? removeMethod = eventReference.Event.RemoveMethod; 559 IMethodSymbol? targetMethodSymbol = null; 570 IMethodSymbol methodDefinition = methodReference.Method.OriginalDefinition; 571 if (methodDefinition.ContainingSymbol is IMethodSymbol) { 573 var localFunction = methodDefinition; 595 public abstract TValue HandleDelegateCreation (IMethodSymbol methodReference, IOperation operation, in TContext context); 611 IMethodSymbol? getMethod = operation.Property.GetGetMethod (); 651 IMethodSymbol getMethod = indexerProperty.GetGetMethod ()!; 715 Debug.Assert (operation.Symbol.ContainingSymbol is IMethodSymbol or IFieldSymbol); 716 var lambda = operation.Symbol; 724 IMethodSymbol calledMethod, 801 IMethodSymbol method, 822 if (method.OriginalDefinition.ContainingSymbol is IMethodSymbol) { 823 var localFunction = method.OriginalDefinition;
DataFlow\MethodBodyValue.cs (1)
23 Debug.Assert (owningSymbol is (IMethodSymbol or IFieldSymbol or IPropertySymbol));
DynamicallyAccessedMembersAnalyzer.cs (18)
135 VerifyDamOnPropertyAndAccessorMatch (context, (IMethodSymbol) context.Symbol); 136 VerifyDamOnDerivedAndBaseMethodsMatch (context, (IMethodSymbol) context.Symbol); 155 else if (member is IMethodSymbol method) { 169 static void VerifyDamOnDerivedAndBaseMethodsMatch (SymbolAnalysisContext context, IMethodSymbol methodSymbol) 171 if (methodSymbol.TryGetOverriddenMember (out var overriddenSymbol) && overriddenSymbol is IMethodSymbol overriddenMethod 172 && context.Symbol is IMethodSymbol method) { 177 static void VerifyDamOnMethodsMatch (SymbolAnalysisContext context, IMethodSymbol overrideMethod, IMethodSymbol baseMethod, ISymbol? origin = null) 183 (IMethodSymbol attributableMethod, DynamicallyAccessedMemberTypes missingAttribute) = GetTargetAndRequirements (overrideMethod, 205 (IMethodSymbol attributableMethod, DynamicallyAccessedMemberTypes missingAttribute) = GetTargetAndRequirements (overrideMethod, 229 (IMethodSymbol attributableMethod, DynamicallyAccessedMemberTypes missingAttribute) = GetTargetAndRequirements (overrideMethod, baseMethod, methodTypeParameterAnnotation, overriddenMethodTypeParameterAnnotation); 265 if (implementationMember is IMethodSymbol implementationMethod && interfaceMember is IMethodSymbol interfaceMethod) { 279 static void VerifyDamOnPropertyAndAccessorMatch (SymbolAnalysisContext context, IMethodSymbol methodSymbol) 303 private static (IMethodSymbol Method, DynamicallyAccessedMemberTypes Requirements) GetTargetAndRequirements (IMethodSymbol method, IMethodSymbol overriddenMethod, DynamicallyAccessedMemberTypes methodAnnotation, DynamicallyAccessedMemberTypes overriddenMethodAnnotation) 306 IMethodSymbol paramNeedsAttributes;
IMethodSymbolExtensions.cs (7)
12 public static bool HasImplicitThis (this IMethodSymbol method) 20 public static ParameterProxyEnumerable GetParameters (this IMethodSymbol method) 28 public static ParameterProxyEnumerable GetMetadataParameters (this IMethodSymbol method) 38 public static ParameterProxy GetParameter (this IMethodSymbol method, ParameterIndex index) 49 public static ParameterProxy? TryGetParameter (this IMethodSymbol method, ParameterIndex index) 59 public static int GetMetadataParametersCount (this IMethodSymbol method) 67 public static int GetParametersCount (this IMethodSymbol method)
IOperationExtensions.cs (3)
177 var containingMethod = TryGetContainingAnonymousFunctionOrLocalFunction (operation) ?? (containingSymbol as IMethodSymbol); 181 public static IMethodSymbol? TryGetContainingAnonymousFunctionOrLocalFunction (this IOperation? operation)
IPropertySymbolExtensions.cs (4)
10 public static IMethodSymbol? GetGetMethod (this IPropertySymbol property) 13 IMethodSymbol? getMethod; 21 public static IMethodSymbol? GetSetMethod (this IPropertySymbol property) 24 IMethodSymbol? setMethod;
ISymbolExtensions.cs (8)
64 internal static DynamicallyAccessedMemberTypes GetDynamicallyAccessedMemberTypesOnReturnType (this IMethodSymbol methodSymbol) 90 internal static bool TryGetReturnAttribute (this IMethodSymbol member, string attributeName, [NotNullWhen (returnValue: true)] out AttributeData? attribute) 103 internal static DynamicallyAccessedMemberTypes GetDynamicallyAccessedMemberTypesOnAssociatedSymbol (this IMethodSymbol methodSymbol) => 109 IMethodSymbol method => method.OverriddenMethod, 149 case IMethodSymbol methodSymbol when methodSymbol.IsStaticConstructor (): 154 case IMethodSymbol methodSymbol: 202 => (symbol as IMethodSymbol)?.MethodKind is MethodKind.Constructor or MethodKind.StaticConstructor; 205 => (symbol as IMethodSymbol)?.MethodKind == MethodKind.StaticConstructor;
RequiresAnalyzerBase.cs (8)
53 var methodSymbol = (IMethodSymbol) symbolAnalysisContext.Symbol; 78 case IMethodSymbol methodSymbol: 94 foreach (var instanceCtor in typeArgCtors) { 130 IMethodSymbol method => method.ContainingType, 164 while (member is IMethodSymbol method && method.OverriddenMethod != null && SymbolEqualityComparer.Default.Equals (method.ReturnType, method.OverriddenMethod.ReturnType)) 233 private void ReportRequiresOnStaticCtorDiagnostic (SymbolAnalysisContext symbolAnalysisContext, IMethodSymbol ctor) 352 IMethodSymbol calledMethod,
RequiresAssemblyFilesAnalyzer.cs (3)
89 dangerousPatternsBuilder.AddRange (assemblyType.GetMembers ("GetFile").OfType<IMethodSymbol> ()); 90 dangerousPatternsBuilder.AddRange (assemblyType.GetMembers ("GetFiles").OfType<IMethodSymbol> ()); 107 if (member is IMethodSymbol method) {
RequiresDynamicCodeAnalyzer.cs (1)
46 internal override bool IsIntrinsicallyHandled (IMethodSymbol calledMethod, MultiValue instance, ImmutableArray<MultiValue> arguments) {
RequiresISymbolExtensions.cs (4)
21 if (member is IMethodSymbol { AssociatedSymbol: { } associated } && associated.TryGetAttribute (requiresAttribute, out requiresAttributeData)) 53 if (member.ContainingSymbol is not IMethodSymbol method) 61 if (member is IMethodSymbol { AssociatedSymbol: { } associated } && associated.TryGetAttribute (attributeName, out requiresAttribute)) 66 foreach (var constructor in field.ContainingType.InstanceConstructors) {
RequiresUnreferencedCodeAnalyzer.cs (1)
88 if (member is IMethodSymbol method && Intrinsics.GetIntrinsicIdForMethod (new MethodProxy (method)) != IntrinsicId.None) {
TrimAnalysis\DiagnosticContext.cs (1)
70 && symbol is IMethodSymbol method
TrimAnalysis\FlowAnnotations.cs (7)
25 public static bool RequiresDataFlowAnalysis (IMethodSymbol method) 40 IMethodSymbol method => ShouldWarnWhenAccessedForReflection (method), 45 static bool ShouldWarnWhenAccessedForReflection (IMethodSymbol method) 96 static bool HasParameterAnnotation (IMethodSymbol method) { 152 var parameterMethod = (IMethodSymbol) parameter.ContainingSymbol; 170 public static DynamicallyAccessedMemberTypes GetMethodReturnValueAnnotation (IMethodSymbol method)
TrimAnalysis\GenericArgumentDataFlow.cs (2)
20 public static void ProcessGenericArgumentDataFlow (Location location, IMethodSymbol method, Action<Diagnostic> reportDiagnostic) 72 public static bool RequiresGenericArgumentDataFlow (IMethodSymbol method)
TrimAnalysis\HandleCallAction.cs (1)
166 foreach (var method in type.Type.GetMethodsOnTypeHierarchy (m => m.Name == name, bindingFlags))
TrimAnalysis\MethodParameterValue.cs (2)
14 public MethodParameterValue (IMethodSymbol methodSymbol, ParameterIndex parameterIndex, DynamicallyAccessedMemberTypes dynamicallyAccessedMemberTypes) 29 public IMethodSymbol MethodSymbol => Parameter.Method.Method;
TrimAnalysis\MethodProxy.cs (2)
12 public MethodProxy (IMethodSymbol method) => Method = method; 14 public readonly IMethodSymbol Method;
TrimAnalysis\MethodReturnValue.cs (3)
15 public MethodReturnValue (IMethodSymbol methodSymbol, bool isNewObj) 20 public MethodReturnValue (IMethodSymbol methodSymbol, bool isNewObj, DynamicallyAccessedMemberTypes dynamicallyAccessedMemberTypes) 28 public readonly IMethodSymbol MethodSymbol;
TrimAnalysis\ParameterProxy.cs (1)
14 Method = new ((IMethodSymbol) parameter.ContainingSymbol);
TrimAnalysis\ReflectionAccessAnalyzer.cs (6)
32 case IMethodSymbol method: 76 foreach (var c in typeSymbol.GetConstructorsOnType (filter: parameterCount.HasValue ? c => c.Parameters.Length == parameterCount.Value : null, bindingFlags: bindingFlags)) 82 foreach (var c in typeSymbol.GetConstructorsOnType (filter: m => (m.DeclaredAccessibility == Accessibility.Public) && m.Parameters.Length == 0)) 94 internal void GetReflectionAccessDiagnosticsForMethod (Location location, IMethodSymbol methodSymbol) 110 Debug.Assert (member is IMethodSymbol or IFieldSymbol); 151 internal void GetDiagnosticsForReflectionAccessToDAMOnMethod (Location location, IMethodSymbol methodSymbol)
TrimAnalysis\TrimAnalysisGenericInstantiationPattern.cs (1)
57 case IMethodSymbol method:
TrimAnalysis\TrimAnalysisMethodCallPattern.cs (2)
17 public IMethodSymbol CalledMethod { get; init; } 25 IMethodSymbol calledMethod,
TrimAnalysis\TrimAnalysisReflectionAccessPattern.cs (2)
14 public IMethodSymbol ReferencedMethod { get; init; } 20 IMethodSymbol referencedMethod,
TrimAnalysis\TrimAnalysisVisitor.cs (10)
124 if (operation.OperatorMethod is IMethodSymbol method) 149 if (OwningSymbol is IMethodSymbol method && !method.IsStatic) 278 IMethodSymbol calledMethod, 320 IMethodSymbol calledMethod, 343 Debug.Assert (OwningSymbol is IMethodSymbol); 344 if (OwningSymbol is not IMethodSymbol method) 358 Debug.Assert (OwningSymbol is IMethodSymbol); 359 if (OwningSymbol is not IMethodSymbol method) 378 public override MultiValue HandleDelegateCreation (IMethodSymbol method, IOperation operation, in FeatureContext featureContext) 392 private void ProcessGenericArgumentDataFlow (IMethodSymbol method, IOperation operation, in FeatureContext featureContext)
Microsoft.Analyzers.Extra (56)
AsyncMethodWithoutCancellation.cs (6)
73var methodSymbol = (IMethodSymbol)analysisContext.ContainingSymbol!; 114bool IsReturnTypeTask(IMethodSymbol method) 138private static bool IsImplementationOfInterface(IMethodSymbol method) 143if (@interface.GetMembers().OfType<IMethodSymbol>() 154private static bool MethodParametersContainKnownTypes(IMethodSymbol method, HashSet<ITypeSymbol> typeSymbols)
CallAnalysis\Arrays.cs (4)
86foreach (var method in freezer.GetMembers("ToFrozenDictionary").OfType<IMethodSymbol>().Where(m => m.TypeParameters.Length == 2)) 95foreach (var method in freezer.GetMembers("ToFrozenSet").OfType<IMethodSymbol>().Where(m => m.TypeParameters.Length == 1))
CallAnalysis\CallAnalyzer.Handlers.cs (1)
24var target = op.TargetMethod;
CallAnalysis\CallAnalyzer.Registrar.cs (8)
33public void RegisterMethod(IMethodSymbol method, Action<OperationAnalysisContext, IInvocationOperation> action) 75foreach (var method in type.GetMembers(m).OfType<IMethodSymbol>()) 87public void RegisterConstructor(IMethodSymbol ctor, Action<OperationAnalysisContext, IObjectCreationOperation> action) 116foreach (var ctor in type.Constructors) 165public void RegisterInterfaceMethod(IMethodSymbol method, Action<OperationAnalysisContext, IInvocationOperation> action) 209foreach (var method in type.GetMembers(m).OfType<IMethodSymbol>())
CallAnalysis\CallAnalyzer.State.cs (4)
16public readonly Dictionary<IMethodSymbol, List<Action<OperationAnalysisContext, IInvocationOperation>>> Methods = new(SymbolEqualityComparer.Default); 17public readonly Dictionary<IMethodSymbol, List<Action<OperationAnalysisContext, IObjectCreationOperation>>> Ctors = new(SymbolEqualityComparer.Default); 26public MethodHandlers(IMethodSymbol method) 31public IMethodSymbol Method { get; }
CallAnalysis\Fixers\LegacyLoggingFixer.cs (5)
45internal Func<SemanticModel, BaseMethodDeclarationSyntax, CancellationToken, IMethodSymbol?> GetDeclaredSymbol = (sm, m, t) => sm.GetDeclaredSymbol(m, t); 103var method = invocationOp.TargetMethod; 171var methodSymbol = GetDeclaredSymbol(sm, method, cancellationToken); 635foreach (var methodSymbol in targetClassSymbol.GetMembers().Where(m => m.Kind == SymbolKind.Method).OfType<IMethodSymbol>())
CallAnalysis\Fixers\LegacyLoggingFixer.FixDetails.cs (2)
35IMethodSymbol method, 190private static (int message, int exception, int eventId, int logLevel, int args) IdentifyParameters(IMethodSymbol method)
CallAnalysis\LegacyLogging.cs (9)
21var legacyMethods = new List<IMethodSymbol>(); 22legacyMethods.AddRange(loggerExtensions.GetMembers("LogTrace").OfType<IMethodSymbol>()); 23legacyMethods.AddRange(loggerExtensions.GetMembers("LogDebug").OfType<IMethodSymbol>()); 24legacyMethods.AddRange(loggerExtensions.GetMembers("LogInformation").OfType<IMethodSymbol>()); 25legacyMethods.AddRange(loggerExtensions.GetMembers("LogWarning").OfType<IMethodSymbol>()); 26legacyMethods.AddRange(loggerExtensions.GetMembers("LogError").OfType<IMethodSymbol>()); 27legacyMethods.AddRange(loggerExtensions.GetMembers("LogCritical").OfType<IMethodSymbol>()); 28legacyMethods.AddRange(loggerExtensions.GetMembers("Log").OfType<IMethodSymbol>()); 30foreach (var method in legacyMethods)
CallAnalysis\StartsEndsWith.cs (4)
22var startsWith = stringType.GetMembers("StartsWith").OfType<IMethodSymbol>() 28var endsWith = stringType.GetMembers("EndsWith").OfType<IMethodSymbol>() 34foreach (var m in startsWith) 39foreach (var m in endsWith)
CallAnalysis\ValueTuple.cs (2)
32foreach (var method in type.GetMembers("Create").OfType<IMethodSymbol>())
CoalesceAnalyzer.cs (4)
42var method = pr.Parameter.ContainingSymbol as IMethodSymbol; 69var method = pr.Parameter.ContainingSymbol as IMethodSymbol;
ConditionalAccessAnalyzer.cs (2)
101var method = pr.Parameter.ContainingSymbol as IMethodSymbol;
Utilities\SymbolExtensions.cs (3)
61public static bool ImplementsPublicInterface(this IMethodSymbol method) 67foreach (var member in iface.GetMembers().OfType<IMethodSymbol>())
Utilities\SyntaxNodeExtensions.cs (2)
49var memberSymbol = semanticModel.GetSymbolInfo(invocationExpression.Expression).Symbol as IMethodSymbol;
Microsoft.Analyzers.Local (18)
ApiLifecycle\AssemblyAnalysis.cs (3)
207var method = (IMethodSymbol)member; 217if (member is IMethodSymbol methodSymbol)
CallAnalysis\CallAnalyzer.Handlers.cs (1)
24var target = op.TargetMethod;
CallAnalysis\CallAnalyzer.Registrar.cs (8)
33public void RegisterMethod(IMethodSymbol method, Action<OperationAnalysisContext, IInvocationOperation> action) 75foreach (var method in type.GetMembers(m).OfType<IMethodSymbol>()) 87public void RegisterConstructor(IMethodSymbol ctor, Action<OperationAnalysisContext, IObjectCreationOperation> action) 116foreach (var ctor in type.Constructors) 165public void RegisterInterfaceMethod(IMethodSymbol method, Action<OperationAnalysisContext, IInvocationOperation> action) 209foreach (var method in type.GetMembers(m).OfType<IMethodSymbol>())
CallAnalysis\CallAnalyzer.State.cs (4)
16public readonly Dictionary<IMethodSymbol, List<Action<OperationAnalysisContext, IInvocationOperation>>> Methods = new(SymbolEqualityComparer.Default); 17public readonly Dictionary<IMethodSymbol, List<Action<OperationAnalysisContext, IObjectCreationOperation>>> Ctors = new(SymbolEqualityComparer.Default); 26public MethodHandlers(IMethodSymbol method) 31public IMethodSymbol Method { get; }
CallAnalysis\ToInvariantString.cs (2)
30foreach (var method in reg.Compilation.GetSpecialType(type).GetMembers("ToString").OfType<IMethodSymbol>())
Microsoft.AspNetCore.Analyzers (30)
CompilationFeatureDetector.cs (1)
33var configureMethod = configureMethods[i];
ConfigureMethodVisitor.cs (4)
11public static List<IMethodSymbol> FindConfigureMethods(StartupSymbols symbols, IAssemblySymbol assembly) 19private readonly List<IMethodSymbol> _methods; 24_methods = new List<IMethodSymbol>(); 53public override void VisitMethod(IMethodSymbol symbol)
MiddlewareAnalysis.cs (2)
11public MiddlewareAnalysis(IMethodSymbol configureMethod, ImmutableArray<MiddlewareItem> middleware) 19public IMethodSymbol ConfigureMethod { get; }
MiddlewareAnalyzer.cs (2)
22var configureMethod = (IMethodSymbol)context.OwningSymbol;
MiddlewareItem.cs (1)
18public IMethodSymbol UseMethod => Operation.TargetMethod;
OptionsAnalysis.cs (2)
11public OptionsAnalysis(IMethodSymbol configureServicesMethod, ImmutableArray<OptionsItem> options) 19public IMethodSymbol ConfigureServicesMethod { get; }
OptionsAnalyzer.cs (2)
23var configureServicesMethod = (IMethodSymbol)context.OwningSymbol;
ServicesAnalysis.cs (2)
11public ServicesAnalysis(IMethodSymbol configureServicesMethod, ImmutableArray<ServicesItem> services) 19public IMethodSymbol ConfigureServicesMethod { get; }
ServicesAnalyzer.cs (2)
22var configureServicesMethod = (IMethodSymbol)context.OwningSymbol;
ServicesItem.cs (1)
18public IMethodSymbol UseMethod => Operation.TargetMethod;
StartupAnalyzer.cs (3)
39var entryPoint = context.Compilation.GetEntryPoint(context.CancellationToken); 65var method = (IMethodSymbol)context.OwningSymbol;
StartupAnalyzer.Events.cs (4)
13internal event EventHandler<IMethodSymbol>? ConfigureServicesMethodFound; 15internal void OnConfigureServicesMethodFound(IMethodSymbol method) 34internal event EventHandler<IMethodSymbol>? ConfigureMethodFound; 36internal void OnConfigureMethodFound(IMethodSymbol method)
StartupFacts.cs (4)
33if (members[i] is IMethodSymbol method && (IsConfigureServices(symbols, method) || IsConfigure(symbols, method))) 53public static bool IsConfigureServices(StartupSymbols symbols, IMethodSymbol symbol) 91public static bool IsConfigure(StartupSymbols symbols, IMethodSymbol symbol) 129public static bool IsSignalRConfigureMethodGesture(IMethodSymbol symbol)
Microsoft.AspNetCore.Analyzers.Test (16)
MinimalStartupTest.cs (4)
19ConfigureServicesMethods = new ConcurrentBag<IMethodSymbol>(); 20ConfigureMethods = new ConcurrentBag<IMethodSymbol>(); 32internal ConcurrentBag<IMethodSymbol> ConfigureServicesMethods { get; } 34internal ConcurrentBag<IMethodSymbol> ConfigureMethods { get; }
StartupAnalyzerTest.cs (4)
17ConfigureServicesMethods = new ConcurrentBag<IMethodSymbol>(); 18ConfigureMethods = new ConcurrentBag<IMethodSymbol>(); 30internal ConcurrentBag<IMethodSymbol> ConfigureServicesMethods { get; } 32internal ConcurrentBag<IMethodSymbol> ConfigureMethods { get; }
StartupFactsTest.cs (8)
119var methods = type.GetMembers(methodName).Cast<IMethodSymbol>(); 121foreach (var method in methods) 144var methods = type.GetMembers(methodName).Cast<IMethodSymbol>(); 146foreach (var method in methods) 167var methods = type.GetMembers(methodName).Cast<IMethodSymbol>(); 169foreach (var method in methods) 189var methods = type.GetMembers(methodName).Cast<IMethodSymbol>(); 191foreach (var method in methods)
Microsoft.AspNetCore.App.Analyzers (77)
Authorization\AddAuthorizationBuilderAnalyzer.cs (2)
44var addAuthorizationMethod = policyServiceCollectionExtensions.GetMembers() 45.OfType<IMethodSymbol>()
Authorization\AuthorizationOptionsTypes.cs (2)
31GetPolicy = authorizationOptionsMembers.OfType<IMethodSymbol>() 40public IMethodSymbol? GetPolicy { get; }
Http\HeaderDictionaryAddAnalyzer.cs (1)
44private static bool IsAddMethod(IMethodSymbol method)
Mvc\DetectAmbiguousActionRoutes.cs (6)
101public IMethodSymbol ActionSymbol { get; } 108public ActionRouteGroupKey(IMethodSymbol actionSymbol, RoutePatternTree routePattern, ImmutableArray<string> httpMethods, bool controllerHasActionToken, WellKnownTypes wellKnownTypes) 120private static string GetActionName(IMethodSymbol actionSymbol, WellKnownTypes wellKnownTypes) 148private static bool CanMatchActions(WellKnownTypes wellKnownTypes, IMethodSymbol actionSymbol1, IMethodSymbol actionSymbol2) 214private static bool HasUnknownAttribute(IMethodSymbol actionSymbol, WellKnownTypes wellKnownTypes)
Mvc\DetectOverriddenAuthorizeAttribute.cs (3)
57IMethodSymbol actionSymbol, List<AttributeInfo> authorizeAttributes, string? allowAnonClass) 62var currentMethod = actionSymbol; 197var isTargetingMethod = symbol is IMethodSymbol;
Mvc\MvcAnalyzer.cs (4)
62if (member is IMethodSymbol methodSymbol && MvcDetector.IsAction(methodSymbol, wellKnownTypes)) 91private static void PopulateActionRoutes(SymbolAnalysisContext context, WellKnownTypes wellKnownTypes, RouteUsageCache routeUsageCache, List<ActionRoute> actionRoutes, IMethodSymbol methodSymbol) 119private static ImmutableArray<string> GetUnroutedMethodHttpMethods(WellKnownTypes wellKnownTypes, IMethodSymbol methodSymbol) 190private record struct ActionRoute(IMethodSymbol ActionSymbol, RouteUsageModel RouteUsageModel, ImmutableArray<string> HttpMethods);
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (1)
59private static bool IsRenderTreeBuilderMethodWithSequenceParameter(WellKnownTypes wellKnownTypes, IMethodSymbol targetMethod)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (2)
196var methodSymbol = semanticModel.GetDeclaredSymbol(methodSyntax, context.CancellationToken); 399else if (parameterTypeSymbol is IMethodSymbol)
RouteEmbeddedLanguage\Infrastructure\MvcDetector.cs (3)
28public static bool IsAction(IMethodSymbol methodSymbol, WellKnownTypes wellKnownTypes) 32var idisposableDispose = (IMethodSymbol)members[0];
RouteEmbeddedLanguage\Infrastructure\RoutePatternParametersDetector.cs (1)
70IMethodSymbol methodSymbol => methodSymbol.Parameters.As<ISymbol>(),
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (13)
35IMethodSymbol? MethodSymbol, 51IMethodSymbol Method, 92var mapMethodSymbol = GetMethodInfo(semanticModel, mapMethodParts.Value.DelegateExpression, cancellationToken); 115var methodSymbol = semanticModel.GetDeclaredSymbol(methodDeclarationSyntax, cancellationToken); 117var actionMethodSymbol = FindMvcMethod(wellKnownTypes, methodSymbol); 154private static ImmutableArray<string> CalculateHttpMethods(WellKnownTypes wellKnownTypes, IMethodSymbol mapMethodSymbol) 212private static IMethodSymbol? FindMvcMethod(WellKnownTypes wellKnownTypes, IMethodSymbol? methodSymbol) 247if (symbol is IMethodSymbol methodSymbol) 260private static MapMethodParts? FindValidMapMethodParts(SemanticModel semanticModel, WellKnownTypes wellKnownTypes, BaseArgumentListSyntax argumentList, IMethodSymbol method) 308private static ArgumentSyntax? GetArgumentSyntax(BaseArgumentListSyntax argumentList, IMethodSymbol methodSymbol, IParameterSymbol parameterSymbol) 333private static IMethodSymbol? GetMethodInfo(SemanticModel semanticModel, SyntaxNode syntaxNode, CancellationToken cancellationToken) 342return delegateSymbol as IMethodSymbol;
RouteEmbeddedLanguage\RoutePatternHighlighter.cs (1)
72private static void HighlightSymbol(SemanticModel semanticModel, IMethodSymbol methodSymbol, IList<AspNetCoreHighlightSpan> highlightSpans, ISymbol matchingParameter, CancellationToken cancellationToken)
RouteHandlers\AtMostOneFromBodyAttribute.cs (1)
20IMethodSymbol methodSymbol)
RouteHandlers\DetectAmbiguousRoutes.cs (2)
95var method = invocationOperation.TargetMethod; 235private static bool AreArgumentsEqual(IMethodSymbol method, ImmutableArray<IArgumentOperation> arguments1, ImmutableArray<IArgumentOperation> arguments2)
RouteHandlers\DetectMismatchedParameterOptionality.cs (2)
16IMethodSymbol methodSymbol) 19foreach (var method in allDeclarations)
RouteHandlers\DetectMisplacedLambdaAttribute.cs (2)
35if (GetReturnedInvocation(blockOperation) is not IMethodSymbol methodSymbol) 71static IMethodSymbol? GetReturnedInvocation(IBlockOperation blockOperation)
RouteHandlers\DisallowMvcBindArgumentsOnParameters.cs (1)
20IMethodSymbol methodSymbol)
RouteHandlers\DisallowNonParsableComplexTypesOnParameters.cs (1)
22IMethodSymbol methodSymbol)
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (1)
30IMethodSymbol methodSymbol,
RouteHandlers\RouteHandlerAnalyzer.cs (3)
71var targetMethod = invocation.TargetMethod; 198IMethodSymbol targetMethod) 206static bool IsCompatibleDelegateType(WellKnownTypes wellKnownTypes, IMethodSymbol targetMethod)
src\Shared\Roslyn\CodeAnalysisExtensions.cs (5)
18public static bool HasAttribute(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 32public static IEnumerable<AttributeData> GetAttributes(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 37IMethodSymbol? current = methodSymbol; 155public static IEnumerable<IMethodSymbol> GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method)
src\Shared\Roslyn\MvcFacts.cs (5)
57public static bool IsControllerAction(IMethodSymbol method, INamedTypeSymbol nonActionAttribute, IMethodSymbol disposableDispose) 101private static INamedTypeSymbol GetDeclaringType(IMethodSymbol method) 116private static bool IsIDisposableDispose(IMethodSymbol method, IMethodSymbol disposableDispose)
src\Shared\RoslynUtils\ParsabilityHelper.cs (10)
20private static readonly BoundedCacheWithFactory<ITypeSymbol, (BindabilityMethod?, IMethodSymbol?)> BindabilityCache = new(); 76.OfType<IMethodSymbol>(); 94private static bool IsTryParse(IMethodSymbol methodSymbol) 104private static bool IsTryParseWithFormat(IMethodSymbol methodSymbol, WellKnownTypes wellKnownTypes) 134private static bool IsBindAsync(IMethodSymbol methodSymbol, ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 145private static bool IsBindAsyncWithParameter(IMethodSymbol methodSymbol, ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 162internal static Bindability GetBindability(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, out BindabilityMethod? bindabilityMethod, out IMethodSymbol? bindMethodSymbol) 166IMethodSymbol? bindAsyncMethod = null; 171IMethodSymbol? bindMethodSymbol = null; 185if (methodSymbolCandidate is IMethodSymbol methodSymbol)
src\Shared\RoslynUtils\SymbolExtensions.cs (2)
156IMethodSymbol methodSymbol => methodSymbol.Parameters, 220if (parameterSymbol is { ContainingSymbol: IMethodSymbol constructor })
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (3)
75var targetMethod = invocation.TargetMethod; 314IMethodSymbol methodSymbol, 339IMethodSymbol methodSymbol,
Microsoft.AspNetCore.App.CodeFixes (2)
Dependencies\AddPackageFixer.cs (1)
69IMethodSymbol methodSymbol => methodSymbol.ReturnType,
Dependencies\ExtensionMethodsCompletionProvider.cs (1)
66IMethodSymbol methodSymbol => methodSymbol.ReturnType,
Microsoft.AspNetCore.Components.Analyzers (1)
InternalUsageAnalyzer.cs (1)
96case IMethodSymbol method:
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
InternalUsageAnalyzer.cs (1)
96case IMethodSymbol method:
Microsoft.AspNetCore.Http.RequestDelegateGenerator (21)
src\Shared\RoslynUtils\ParsabilityHelper.cs (10)
20private static readonly BoundedCacheWithFactory<ITypeSymbol, (BindabilityMethod?, IMethodSymbol?)> BindabilityCache = new(); 76.OfType<IMethodSymbol>(); 94private static bool IsTryParse(IMethodSymbol methodSymbol) 104private static bool IsTryParseWithFormat(IMethodSymbol methodSymbol, WellKnownTypes wellKnownTypes) 134private static bool IsBindAsync(IMethodSymbol methodSymbol, ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 145private static bool IsBindAsyncWithParameter(IMethodSymbol methodSymbol, ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 162internal static Bindability GetBindability(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, out BindabilityMethod? bindabilityMethod, out IMethodSymbol? bindMethodSymbol) 166IMethodSymbol? bindAsyncMethod = null; 171IMethodSymbol? bindMethodSymbol = null; 185if (methodSymbolCandidate is IMethodSymbol methodSymbol)
src\Shared\RoslynUtils\SymbolExtensions.cs (2)
156IMethodSymbol methodSymbol => methodSymbol.Parameters, 220if (parameterSymbol is { ContainingSymbol: IMethodSymbol constructor })
StaticRouteHandlerModel\Endpoint.cs (1)
29if (!operation.TryGetRouteHandlerMethod(semanticModel, out var method))
StaticRouteHandlerModel\EndpointParameter.cs (4)
218else if (HasBindAsync(Type, wellKnownTypes, out var bindMethod, out var bindMethodSymbol)) 302public IMethodSymbol? BindableMethodSymbol { get; set; } 304private static bool HasBindAsync(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, [NotNullWhen(true)] out BindabilityMethod? bindMethod, [NotNullWhen(true)] out IMethodSymbol? bindMethodSymbol) 528var targetConstructor = constructors.Single();
StaticRouteHandlerModel\EndpointResponse.cs (2)
27internal EndpointResponse(IMethodSymbol method, WellKnownTypes wellKnownTypes) 44private ITypeSymbol? UnwrapResponseType(IMethodSymbol method, out bool isAwaitable, out bool awaitableIsVoid)
StaticRouteHandlerModel\InvocationOperationExtensions.cs (2)
42public static bool TryGetRouteHandlerMethod(this IInvocationOperation invocation, SemanticModel semanticModel, [NotNullWhen(true)] out IMethodSymbol? method) 83private static IMethodSymbol? ResolveMethodFromOperation(IOperation operation, SemanticModel semanticModel) => operation switch
Microsoft.AspNetCore.Mvc.Analyzers (30)
AttributesShouldNotBeAppliedToPageModelAnalyzer.cs (5)
40var method = (IMethodSymbol)context.Symbol; 67private static bool IsPageHandlerMethod(IMethodSymbol method) 96private static void ReportRouteDiagnostic(SymbolAnalysisContext context, IMethodSymbol method, INamedTypeSymbol routeAttribute) 110private static void ReportFilterDiagnostic(SymbolAnalysisContext context, IMethodSymbol method, INamedTypeSymbol filterAttribute)
AvoidHtmlPartialAnalyzer.cs (1)
23var method = ((IInvocationOperation)context.Operation).TargetMethod;
src\Shared\Roslyn\CodeAnalysisExtensions.cs (5)
18public static bool HasAttribute(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 32public static IEnumerable<AttributeData> GetAttributes(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 37IMethodSymbol? current = methodSymbol; 155public static IEnumerable<IMethodSymbol> GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method)
src\Shared\Roslyn\MvcFacts.cs (5)
57public static bool IsControllerAction(IMethodSymbol method, INamedTypeSymbol nonActionAttribute, IMethodSymbol disposableDispose) 101private static INamedTypeSymbol GetDeclaringType(IMethodSymbol method) 116private static bool IsIDisposableDispose(IMethodSymbol method, IMethodSymbol disposableDispose)
TagHelpersInCodeBlocksAnalyzer.cs (7)
71var methodSymbol = (IMethodSymbol?)(parent switch 103private static bool IsTagHelperRunnerRunAsync(IMethodSymbol method, SymbolCache symbolCache) 136IMethodSymbol tagHelperRunnerRunAsyncMethodSymbol, 143public IMethodSymbol TagHelperRunnerRunAsyncMethodSymbol { get; } 167var tagHelperRunnerRunAsyncMethod = (IMethodSymbol)members[0];
TopLevelParameterNameAnalyzer.cs (6)
40var method = (IMethodSymbol)context.Symbol; 220IMethodSymbol disposableDispose) 279var idisposableDispose = (IMethodSymbol?)members?[0]; 313public IMethodSymbol IDisposableDispose { get; }
ViewFeaturesAnalyzerContext.cs (1)
28public bool IsHtmlHelperExtensionMethod(IMethodSymbol method)
Microsoft.AspNetCore.Mvc.Api.Analyzers (40)
AddResponseTypeAttributeCodeFixAction.cs (3)
133var method = semanticModel.GetDeclaredSymbol(methodSyntax, cancellationToken); 257IMethodSymbol method, 274public IMethodSymbol Method { get; }
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (1)
77if (context.ContainingSymbol is not IMethodSymbol methodSymbol)
ApiControllerFacts.cs (1)
11public static bool IsApiControllerAction(ApiControllerSymbolCache symbolCache, IMethodSymbol method)
ApiControllerSymbolCache.cs (4)
99var iDisposableDispose = (IMethodSymbol?)members?[0]; 142IMethodSymbol disposableDispose, 187public IMethodSymbol IDisposableDispose { get; }
ApiConventionAnalyzer.cs (2)
41var method = (IMethodSymbol)context.ContainingSymbol;
DeclaredApiResponseMetadata.cs (4)
14public static DeclaredApiResponseMetadata ForProducesResponseType(int statusCode, AttributeData attributeData, IMethodSymbol attributeSource) 19public static DeclaredApiResponseMetadata ForProducesDefaultResponse(AttributeData attributeData, IMethodSymbol attributeSource) 27IMethodSymbol? attributeSource, 42public IMethodSymbol? AttributeSource { get; }
src\Shared\Roslyn\CodeAnalysisExtensions.cs (5)
18public static bool HasAttribute(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 32public static IEnumerable<AttributeData> GetAttributes(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 37IMethodSymbol? current = methodSymbol; 155public static IEnumerable<IMethodSymbol> GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method)
src\Shared\Roslyn\MvcFacts.cs (5)
57public static bool IsControllerAction(IMethodSymbol method, INamedTypeSymbol nonActionAttribute, IMethodSymbol disposableDispose) 101private static INamedTypeSymbol GetDeclaringType(IMethodSymbol method) 116private static bool IsIDisposableDispose(IMethodSymbol method, IMethodSymbol disposableDispose)
SymbolApiConventionMatcher.cs (2)
12internal static bool IsMatch(ApiControllerSymbolCache symbolCache, IMethodSymbol method, IMethodSymbol conventionMethod)
SymbolApiResponseMetadataProvider.cs (13)
22IMethodSymbol method) 45IMethodSymbol method) 66IMethodSymbol method, 69var conventionMethod = GetMethodFromConventionMethodAttribute(symbolCache, method); 83private static IMethodSymbol? GetMethodFromConventionMethodAttribute(in ApiControllerSymbolCache symbolCache, IMethodSymbol method) 113return (IMethodSymbol)conventionMethod; 116private static IMethodSymbol? MatchConventionMethod( 118IMethodSymbol method, 123foreach (var conventionMethod in conventionType.GetMembers().OfType<IMethodSymbol>()) 140private static IList<DeclaredApiResponseMetadata> GetResponseMetadataFromMethodAttributes(in ApiControllerSymbolCache symbolCache, IMethodSymbol methodSymbol) 161internal static IReadOnlyList<ITypeSymbol> GetConventionTypes(in ApiControllerSymbolCache symbolCache, IMethodSymbol method)
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (15)
HubClientProxyGenerator.Parser.cs (8)
50private static bool IsExtensionMethodSignatureValid(IMethodSymbol symbol, SourceProductionContext context) 149if (ModelExtensions.GetSymbolInfo(context.SemanticModel, memberAccessExpressionSyntax).Symbol is not IMethodSymbol 209var registerCallbackProviderMethodSymbol = (IMethodSymbol)registerCallbackProviderSemanticModel.GetDeclaredSymbol(methodDeclarationSyntax); 286.Select(member => (IMethodSymbol)member) 287.Union<IMethodSymbol>(providerSymbol.AllInterfaces.SelectMany(x => x 290.Select(member => (IMethodSymbol)member)), SymbolEqualityComparer.Default).ToList(); 293foreach (var member in members)
HubServerProxyGenerator.Parser.cs (7)
50private static bool IsExtensionMethodSignatureValid(IMethodSymbol symbol, SourceProductionContext context) 139if (ModelExtensions.GetSymbolInfo(context.SemanticModel, memberAccessExpressionSyntax).Symbol is not IMethodSymbol 198var getProxyMethodSymbol = (IMethodSymbol)getProxySemanticModel.GetDeclaredSymbol(methodDeclarationSyntax); 263.Select(member => (IMethodSymbol)member) 267.Select(member => (IMethodSymbol)member))); 270foreach (var member in members)
Microsoft.CodeAnalysis (193)
CodeGen\CompilationTestData.cs (2)
127IMethodSymbol iMethod = (IMethodSymbol)methodSymbol.GetISymbol();
Compilation\Compilation.cs (18)
945public IMethodSymbol? GetEntryPoint(CancellationToken cancellationToken) 950protected abstract IMethodSymbol? CommonGetEntryPoint(CancellationToken cancellationToken); 1523/// Creates an <see cref="IMethodSymbol"/> whose <see cref="IMethodSymbol.MethodKind"/> is <see 1532public IMethodSymbol CreateBuiltinOperator(string name, ITypeSymbol returnType, ITypeSymbol leftType, ITypeSymbol rightType) 1548protected abstract IMethodSymbol CommonCreateBuiltinOperator(string name, ITypeSymbol returnType, ITypeSymbol leftType, ITypeSymbol rightType); 1551/// Creates an <see cref="IMethodSymbol"/> whose <see cref="IMethodSymbol.MethodKind"/> is <see 1559public IMethodSymbol CreateBuiltinOperator(string name, ITypeSymbol returnType, ITypeSymbol operandType) 1572protected abstract IMethodSymbol CommonCreateBuiltinOperator(string name, ITypeSymbol returnType, ITypeSymbol operandType); 2457IMethodSymbol? debugEntryPoint, 2690IMethodSymbol debugEntryPoint, 2714IMethodSymbol? debugEntryPoint, 2775IMethodSymbol? debugEntryPoint = null, 2803IMethodSymbol? debugEntryPoint, 2921IMethodSymbol? debugEntryPoint, 3136IMethodSymbol? debugEntryPoint, 3186internal abstract void ValidateDebugEntryPoint(IMethodSymbol debugEntryPoint, DiagnosticBag diagnostics);
Compilation\DataFlowAnalysis.cs (1)
107public abstract ImmutableArray<IMethodSymbol> UsedLocalFunctions { get; }
Compilation\SemanticModel.cs (2)
410/// for the type, and the <see cref="IMethodSymbol"/> for the primary constructor will be returned.</item> 431/// for the type, and the <see cref="IMethodSymbol"/> for the primary constructor will be returned.</item>
DiagnosticAnalyzer\AnalyzerManager.AnalyzerExecutionContext.cs (1)
207if (member is IMethodSymbol { PartialImplementationPart: { } methodImplementation })
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (9)
190foreach (var method in GetMatchingMethods(candidateMembers, arity, parameters, returnType)) 504var methodContext = bindingContext as IMethodSymbol; 546var methodContext = bindingContext as IMethodSymbol; 738private ImmutableArray<IMethodSymbol> GetMatchingMethods(ImmutableArray<ISymbol> candidateMembers, int? arity, ParameterInfo[] parameters, TypeInfo? returnType) 740var builder = new ArrayBuilder<IMethodSymbol>(); 744var methodSymbol = symbol as IMethodSymbol;
DocumentationCommentId.cs (9)
369public override void VisitMethod(IMethodSymbol symbol) 455public override bool VisitMethod(IMethodSymbol symbol) 657Debug.Assert(symbol.ContainingSymbol is null or INamedTypeSymbol or IMethodSymbol); 985var methodContext = typeParameterContext as IMethodSymbol; 1000var methodContext = typeParameterContext as IMethodSymbol; 1238var methodSymbol = symbol as IMethodSymbol;
Emit\CommonPEModuleBuilder.cs (2)
314Debug.Assert(((IMethodSymbol)methodSymbol.GetISymbol()).PartialDefinitionPart == null); // Must be definition. 331Debug.Assert(((IMethodSymbol)methodSymbol.GetISymbol()).PartialDefinitionPart == null); // Must be definition.
Emit\EditAndContinue\SymbolChanges.cs (2)
381Debug.Assert(edit.OldSymbol is IMethodSymbol or IPropertySymbol or IEventSymbol); 423Debug.Assert(edit.OldSymbol == null || ((IMethodSymbol)edit.OldSymbol).PartialImplementationPart == null);
Emit\SemanticEdit.cs (10)
57/// If not empty, <see cref="OldSymbol"/> and <see cref="NewSymbol"/> must be non-null <see cref="IMethodSymbol"/>s, and 134if (oldSymbol is not IMethodSymbol) 139if (newSymbol is not IMethodSymbol) 145if (oldSymbol is IMethodSymbol { PartialImplementationPart: not null } or IPropertySymbol { PartialImplementationPart: not null }) 150if (newSymbol is IMethodSymbol { PartialImplementationPart: not null } or IPropertySymbol { PartialImplementationPart: not null }) 155if (kind == SemanticEditKind.Delete && oldSymbol is not (IMethodSymbol or IPropertySymbol or IEventSymbol)) 172if (oldSymbol is not IMethodSymbol) 177if (newSymbol is not IMethodSymbol) 206internal SemanticEdit(IMethodSymbol oldSymbol, IMethodSymbol newSymbol, ImmutableArray<InstrumentationKind> instrumentationKinds)
Generated\FlowAnalysis.Generated.cs (1)
144IMethodSymbol Symbol { get; }
Generated\Operations.Generated.cs (40)
577IMethodSymbol Symbol { get; } 713IMethodSymbol? OperatorMethod { get; } 776IMethodSymbol TargetMethod { get; } 969IMethodSymbol Method { get; } 1076IMethodSymbol? OperatorMethod { get; } 1134IMethodSymbol? OperatorMethod { get; } 1247IMethodSymbol Symbol { get; } 1276IMethodSymbol? Constructor { get; } 1525IMethodSymbol? OperatorMethod { get; } 1777IMethodSymbol AddMethod { get; } 2195IMethodSymbol? OperatorMethod { get; } 3144IMethodSymbol? Method { get; } 3618IMethodSymbol? CloneMethod { get; } 3949IMethodSymbol? ConstructMethod { get; } 4915internal LocalFunctionOperation(IMethodSymbol symbol, IBlockOperation? body, IBlockOperation? ignoredBody, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4922public IMethodSymbol Symbol { get; } 5151internal InvocationOperation(IMethodSymbol targetMethod, ITypeSymbol? constrainedToType, IOperation? instance, bool isVirtual, ImmutableArray<IArgumentOperation> arguments, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5161public IMethodSymbol TargetMethod { get; } 5397internal MethodReferenceOperation(IMethodSymbol method, ITypeSymbol? constrainedToType, bool isVirtual, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5405public IMethodSymbol Method { get; } 5576internal UnaryOperation(UnaryOperatorKind operatorKind, IOperation operand, bool isLifted, bool isChecked, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5592public IMethodSymbol? OperatorMethod { get; } 5639internal BinaryOperation(BinaryOperatorKind operatorKind, IOperation leftOperand, IOperation rightOperand, bool isLifted, bool isChecked, bool isCompareText, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, IMethodSymbol? unaryOperatorMethod, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5660public IMethodSymbol? OperatorMethod { get; } 5662public IMethodSymbol? UnaryOperatorMethod { get; } 5861internal AnonymousFunctionOperation(IMethodSymbol symbol, IBlockOperation body, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 5867public IMethodSymbol Symbol { get; } 5914internal ObjectCreationOperation(IMethodSymbol? constructor, IObjectOrCollectionInitializerOperation? initializer, ImmutableArray<IArgumentOperation> arguments, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5923public IMethodSymbol? Constructor { get; } 6303internal CompoundAssignmentOperation(IConvertibleConversion inConversion, IConvertibleConversion outConversion, BinaryOperatorKind operatorKind, bool isLifted, bool isChecked, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6322public IMethodSymbol? OperatorMethod { get; } 7253internal IncrementOrDecrementOperation(bool isPostfix, bool isLifted, bool isChecked, IOperation target, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, OperationKind kind, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7269public IMethodSymbol? OperatorMethod { get; } 9034internal RangeOperation(IOperation? leftOperand, IOperation? rightOperand, bool isLifted, IMethodSymbol? method, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 9046public IMethodSymbol? Method { get; } 10021internal WithOperation(IOperation operand, IMethodSymbol? cloneMethod, IObjectOrCollectionInitializerOperation initializer, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10030public IMethodSymbol? CloneMethod { get; } 10668internal CollectionExpressionOperation(IMethodSymbol? constructMethod, ImmutableArray<IOperation> elements, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10675public IMethodSymbol? ConstructMethod { get; }
Operations\CommonConversion.cs (2)
32internal CommonConversion(bool exists, bool isIdentity, bool isNumeric, bool isReference, bool isImplicit, bool isNullable, IMethodSymbol? methodSymbol, ITypeSymbol? constrainedToType) 81public IMethodSymbol? MethodSymbol { get; }
Operations\ControlFlowGraph.cs (7)
27private readonly ImmutableDictionary<IMethodSymbol, (ControlFlowRegion region, ILocalFunctionOperation operation, int ordinal)> _localFunctionsMap; 36ImmutableArray<IMethodSymbol> localFunctions, 37ImmutableDictionary<IMethodSymbol, (ControlFlowRegion region, ILocalFunctionOperation operation, int ordinal)> localFunctionsMap, 55foreach (IMethodSymbol method in localFunctions) 222public ImmutableArray<IMethodSymbol> LocalFunctions { get; } 227public ControlFlowGraph GetLocalFunctionControlFlowGraph(IMethodSymbol localFunction, CancellationToken cancellationToken = default) 244internal bool TryGetLocalFunctionControlFlowGraph(IMethodSymbol localFunction, [NotNullWhen(true)] out ControlFlowGraph? controlFlowGraph)
Operations\ControlFlowGraphBuilder.cs (23)
149var localFunctions = ArrayBuilder<IMethodSymbol>.GetInstance(); 150var localFunctionsMap = ImmutableDictionary.CreateBuilder<IMethodSymbol, (ControlFlowRegion, ILocalFunctionOperation, int)>(); 2466IMethodSymbol? unaryOperatorMethod = ((BinaryOperation)binOp).UnaryOperatorMethod; 2568IMethodSymbol? unaryOperatorMethod = ((BinaryOperation)binOp).UnaryOperatorMethod; 3328var method = (IMethodSymbol?)_compilation.CommonGetSpecialTypeMember(nullableMember)?.GetISymbol(); 3336method = (IMethodSymbol)candidate; 3949private void HandleUsingOperationParts(IOperation resources, IOperation body, IMethodSymbol? disposeMethod, ImmutableArray<IArgumentOperation> disposeArguments, ImmutableArray<ILocalSymbol> locals, bool isAsynchronous, 4106private void AddDisposingFinally(IOperation resource, bool requiresRuntimeConversion, ITypeSymbol iDisposable, IMethodSymbol? disposeMethod, ImmutableArray<IArgumentOperation> disposeArguments, bool isAsynchronous) 4165var method = disposeMethod ?? (isAsynchronous 4166? (IMethodSymbol?)_compilation.CommonGetWellKnownTypeMember(WellKnownMember.System_IAsyncDisposable__DisposeAsync)?.GetISymbol() 4167: (IMethodSymbol?)_compilation.CommonGetSpecialTypeMember(SpecialMember.System_IDisposable__Dispose)?.GetISymbol()); 4321var enterMethod = (IMethodSymbol?)_compilation.CommonGetWellKnownTypeMember(WellKnownMember.System_Threading_Monitor__Enter2)?.GetISymbol(); 4327enterMethod = (IMethodSymbol?)_compilation.CommonGetWellKnownTypeMember(WellKnownMember.System_Threading_Monitor__Enter)?.GetISymbol(); 4410var exitMethod = (IMethodSymbol?)_compilation.CommonGetWellKnownTypeMember(WellKnownMember.System_Threading_Monitor__Exit)?.GetISymbol(); 4689InvocationOperation makeInvocationDroppingInstanceForStaticMethods(IMethodSymbol method, IOperation instance, ImmutableArray<IArgumentOperation> arguments) 4694InvocationOperation makeInvocation(SyntaxNode syntax, IMethodSymbol method, IOperation? instanceOpt, ImmutableArray<IArgumentOperation> arguments) 4782var method = (IMethodSymbol?)_compilation.CommonGetWellKnownTypeMember(helper)?.GetISymbol(); 7757var matchFailureCtor = 7758(IMethodSymbol?)(_compilation.CommonGetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_SwitchExpressionException__ctor) ??
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (11)
24public ArrayBuilder<(IMethodSymbol, ILocalFunctionOperation)>? LocalFunctions = null; 94public void Add(IMethodSymbol symbol, ILocalFunctionOperation operation) 102LocalFunctions = ArrayBuilder<(IMethodSymbol, ILocalFunctionOperation)>.GetInstance(); 108public void AddRange(ArrayBuilder<(IMethodSymbol, ILocalFunctionOperation)>? others) 117Debug.Assert(others.All(((IMethodSymbol m, ILocalFunctionOperation _) tuple) => tuple.m.MethodKind == MethodKind.LocalFunction)); 121LocalFunctions = ArrayBuilder<(IMethodSymbol, ILocalFunctionOperation)>.GetInstance(); 297ArrayBuilder<IMethodSymbol> localFunctions, 298ImmutableDictionary<IMethodSymbol, (ControlFlowRegion region, ILocalFunctionOperation operation, int ordinal)>.Builder localFunctionsMap, 311foreach ((IMethodSymbol method, IOperation _) in LocalFunctions) 339LocalFunctions?.SelectAsArray(((IMethodSymbol, ILocalFunctionOperation) tuple) => tuple.Item1) ?? default, 346foreach ((IMethodSymbol method, ILocalFunctionOperation operation) in LocalFunctions)
Operations\ControlFlowGraphExtensions.cs (1)
17public static ControlFlowGraph GetLocalFunctionControlFlowGraphInScope(this ControlFlowGraph controlFlowGraph, IMethodSymbol localFunction, CancellationToken cancellationToken = default)
Operations\ControlFlowRegion.cs (2)
56public ImmutableArray<IMethodSymbol> LocalFunctions { get; } 66ImmutableArray<IMethodSymbol> methods,
Operations\DisposeOperationInfo.cs (2)
10public readonly IMethodSymbol? DisposeMethod; 14public DisposeOperationInfo(IMethodSymbol? disposeMethod, ImmutableArray<IArgumentOperation> disposeArguments)
Operations\Loops\ForEachLoopOperationInfo.cs (6)
17public readonly IMethodSymbol GetEnumeratorMethod; 19public readonly IMethodSymbol MoveNextMethod; 26public readonly IMethodSymbol? PatternDisposeMethod; 45IMethodSymbol getEnumeratorMethod, 47IMethodSymbol moveNextMethod, 53IMethodSymbol? patternDisposeMethod,
Operations\OperationExtensions.cs (1)
20public static IMethodSymbol GetFunctionPointerSignature(this IFunctionPointerInvocationOperation functionPointer)
Operations\OperationNodes.cs (2)
81public IMethodSymbol? OperatorMethod => Conversion.MethodSymbol; 161public IMethodSymbol Symbol => Original.Symbol;
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithMetadataName.cs (1)
146addMatchingAttributes((symbol as IMethodSymbol)?.GetReturnTypeAttributes());
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (1)
192var ctor = attribute.AttributeConstructor;
SymbolDisplay\AbstractSymbolDisplayVisitor_Minimal.cs (1)
74arity = ((IMethodSymbol)candidate).Arity;
Symbols\Attributes\CommonAttributeData.cs (2)
33public IMethodSymbol? AttributeConstructor { get { return CommonAttributeConstructor; } } 34protected abstract IMethodSymbol? CommonAttributeConstructor { get; }
Symbols\IEventSymbol.cs (3)
37IMethodSymbol? AddMethod { get; } 42IMethodSymbol? RemoveMethod { get; } 47IMethodSymbol? RaiseMethod { get; }
Symbols\IFunctionPointerTypeSymbol.cs (1)
19public IMethodSymbol Signature { get; }
Symbols\ILabelSymbol.cs (2)
19/// Gets the immediately containing <see cref="IMethodSymbol"/> of this <see cref="ILocalSymbol"/>. 21IMethodSymbol ContainingMethod { get; }
Symbols\IMethodSymbol.cs (10)
133IMethodSymbol ConstructedFrom { get; } 153new IMethodSymbol OriginalDefinition { get; } 159IMethodSymbol? OverriddenMethod { get; } 175IMethodSymbol? ReducedFrom { get; } 191IMethodSymbol? ReduceExtensionMethod(ITypeSymbol receiverType); 200ImmutableArray<IMethodSymbol> ExplicitInterfaceImplementations { get; } 247IMethodSymbol Construct(params ITypeSymbol[] typeArguments); 252IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations); 258IMethodSymbol? PartialDefinitionPart { get; } 265IMethodSymbol? PartialImplementationPart { get; }
Symbols\INamedTypeSymbol.cs (4)
110IMethodSymbol? DelegateInvokeMethod { get; } 145ImmutableArray<IMethodSymbol> InstanceConstructors { get; } 150ImmutableArray<IMethodSymbol> StaticConstructors { get; } 155ImmutableArray<IMethodSymbol> Constructors { get; }
Symbols\IPropertySymbol.cs (2)
77IMethodSymbol? GetMethod { get; } 82IMethodSymbol? SetMethod { get; }
Symbols\ISymbolExtensions.cs (8)
17public static IMethodSymbol? GetConstructedReducedFrom(this IMethodSymbol method) 25var reducedFrom = method.ReducedFrom; 145IMethodSymbol? enterScopeMethod = TryFindPublicVoidParameterlessMethod(lockType, WellKnownMemberNames.EnterScopeMethodName); 158IMethodSymbol? disposeMethod = TryFindPublicVoidParameterlessMethod(scopeType, WellKnownMemberNames.DisposeMethodName); 172private static IMethodSymbol? TryFindPublicVoidParameterlessMethod(ITypeSymbol type, string name) 175IMethodSymbol? result = null; 178if (member is IMethodSymbol
Symbols\ITypeParameterSymbol.cs (1)
38IMethodSymbol? DeclaringMethod { get; }
Symbols\SymbolVisitor.cs (1)
63public virtual void VisitMethod(IMethodSymbol symbol)
Symbols\SymbolVisitor`1.cs (1)
66public virtual TResult? VisitMethod(IMethodSymbol symbol)
Symbols\SymbolVisitor`2.cs (1)
71public virtual TResult VisitMethod(IMethodSymbol symbol, TArgument argument)
Microsoft.CodeAnalysis.CodeStyle (267)
src\Analyzers\Core\Analyzers\Helpers\DeserializationConstructorCheck.cs (1)
17public bool IsDeserializationConstructor(IMethodSymbol methodSymbol)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (8)
20private readonly IMethodSymbol _objectGetHashCodeMethod; 26Compilation compilation, IMethodSymbol objectGetHashCodeMethod, 43if (objectType?.GetMembers(nameof(GetHashCode)).FirstOrDefault() is not IMethodSymbol objectGetHashCodeMethod) 64if (owningSymbol is not IMethodSymbol { Name: nameof(GetHashCode) } method) 90IMethodSymbol method, ImmutableArray<IOperation> statements) 113IMethodSymbol method, ImmutableArray<IOperation> statements) 211private bool OverridesSystemObject(IMethodSymbol? method) 213for (var current = method; current != null; current = current.OverriddenMethod)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (3)
22HashCodeAnalyzer analyzer, IMethodSymbol method, ILocalSymbol? hashCodeVariable) : IDisposable 25private readonly IMethodSymbol _method = method; 62var targetMethod = invocation.TargetMethod;
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (1)
123if (symbol is IMethodSymbol methodSymbol && methodSymbol.IsEntryPoint(compilation.TaskType(), compilation.TaskOfTType()))
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (1)
149return symbol == null || symbol.IsStatic || symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction };
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (8)
374var targetMethod = ((IInvocationOperation)operationContext.Operation).TargetMethod.OriginalDefinition; 423var constructor = ((IObjectCreationOperation)operationContext.Operation).Constructor?.OriginalDefinition; 450var entryPoint = symbolEndContext.Compilation.GetEntryPoint(cancellationToken); 558case IMethodSymbol: 726var methodSymbol = (IMethodSymbol)memberSymbol; 845private bool IsMethodWithSpecialAttribute(IMethodSymbol methodSymbol) 848private static bool IsShouldSerializeOrResetPropertyMethod(IMethodSymbol methodSymbol)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
112protected abstract bool MethodHasHandlesClause(IMethodSymbol method);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
431if (owningSymbol is IMethodSymbol method && 714if (context.OwningSymbol is not IMethodSymbol method)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (3)
36private readonly ConcurrentDictionary<IMethodSymbol, bool> _methodsUsedAsDelegates = []; 206parameter.ContainingSymbol is not IMethodSymbol method || 291IMethodSymbol method,
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
122private static bool IsObjectToStringOverride(IMethodSymbol method)
src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (10)
56if (!TryGetLinqWhereExtensionMethod(enumerableType, out var whereMethodSymbol)) 78static bool TryGetLinqWhereExtensionMethod(INamedTypeSymbol enumerableType, [NotNullWhen(true)] out IMethodSymbol? whereMethod) 80foreach (var whereMethodSymbol in enumerableType.GetMembers(nameof(Enumerable.Where)).OfType<IMethodSymbol>()) 96static bool TryGetLinqMethodsThatDoNotReturnEnumerables(INamedTypeSymbol enumerableType, out ImmutableArray<IMethodSymbol> linqMethods) 98using var _ = ArrayBuilder<IMethodSymbol>.GetInstance(out var linqMethodSymbolsBuilder); 99foreach (var method in enumerableType.GetMembers().OfType<IMethodSymbol>()) 113public void AnalyzeInvocationOperation(OperationAnalysisContext context, INamedTypeSymbol enumerableType, IMethodSymbol whereMethod, ImmutableArray<IMethodSymbol> linqMethods)
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (5)
79protected abstract TExpression? GetGetterExpression(IMethodSymbol getMethod, CancellationToken cancellationToken); 80protected abstract TExpression? GetSetterExpression(IMethodSymbol setMethod, SemanticModel semanticModel, CancellationToken cancellationToken); 293var setMethod = property.SetMethod; 326private IFieldSymbol? GetSetterField(SemanticModel semanticModel, IMethodSymbol setMethod, CancellationToken cancellationToken) 329private IFieldSymbol? GetGetterField(SemanticModel semanticModel, IMethodSymbol getMethod, CancellationToken cancellationToken)
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerAnalyzer.cs (1)
196return addMethods.Any(static m => m is IMethodSymbol methodSymbol && methodSymbol.Parameters.Any());
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (3)
235var method = this.SemanticModel.GetSymbolInfo(memberAccess, cancellationToken).GetAnySymbol() as IMethodSymbol; 262useSpread = method.GetOriginalUnreducedDefinition() is not IMethodSymbol { IsExtensionMethod: true, Parameters: [_, { Type: ITypeParameterSymbol }] };
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (3)
37var referenceEqualsMethod = objectType.GetMembers(nameof(ReferenceEquals)) 38.OfType<IMethodSymbol>() 56private void AnalyzeSyntax(SyntaxNodeAnalysisContext context, IMethodSymbol referenceEqualsMethod, bool unconstraintedGenericSupported)
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (6)
87var referenceEqualsMethod = objectType?.GetMembers(nameof(ReferenceEquals)) 88.OfType<IMethodSymbol>() 105IMethodSymbol? referenceEqualsMethod) 169if (semanticModel.GetSymbolInfo(name, cancellationToken).GetAnySymbol() is IMethodSymbol) 199IMethodSymbol? referenceEqualsMethod, 254IMethodSymbol? referenceEqualsMethod,
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer_IfStatement.cs (1)
30IMethodSymbol? referenceEqualsMethod)
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (4)
107var method = TryGetValidFormatMethodSymbol(symbolInfo); 280protected static IMethodSymbol? TryGetValidFormatMethodSymbol(SymbolInfo symbolInfo) 292if (((IMethodSymbol)symbolInfo.Symbol).MethodKind == MethodKind.LocalFunction) 308return (IMethodSymbol)symbolInfo.Symbol;
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (9)
190foreach (var method in GetMatchingMethods(candidateMembers, arity, parameters, returnType)) 504var methodContext = bindingContext as IMethodSymbol; 546var methodContext = bindingContext as IMethodSymbol; 738private ImmutableArray<IMethodSymbol> GetMatchingMethods(ImmutableArray<ISymbol> candidateMembers, int? arity, ParameterInfo[] parameters, TypeInfo? returnType) 740var builder = new ArrayBuilder<IMethodSymbol>(); 744var methodSymbol = symbol as IMethodSymbol;
src\Workspaces\Core\Portable\Editing\DeclarationModifiers.cs (3)
70IMethodSymbol or 75var method = symbol as IMethodSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CompilationExtensions.cs (2)
73public static IMethodSymbol? GetTopLevelStatementsMethod(this Compilation compilation) 79if (candidateMember is IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IMethodSymbolExtensions.cs (7)
20public static ImmutableArray<IMethodSymbol> GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method) 43public static bool HasEventHandlerSignature(this IMethodSymbol method, [NotNullWhen(returnValue: true)] INamedTypeSymbol? eventArgsType) 48public static bool TryGetPredefinedComparisonOperator(this IMethodSymbol symbol, out PredefinedOperator op) 72public static PredefinedOperator GetPredefinedOperator(this IMethodSymbol symbol) 102public static bool IsEntryPoint(this IMethodSymbol methodSymbol, INamedTypeSymbol? taskType, INamedTypeSymbol? genericTaskType) 113public static bool IsAsyncReturningVoidTask(this IMethodSymbol method, Compilation compilation)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (8)
122static bool IsAccessorImplemented(IMethodSymbol? accessor, INamedTypeSymbol classOrStructType) 170IMethodSymbol method => method.ExplicitInterfaceImplementations.Length > 0, 219static bool IsNonPublicImplementableAccessor(IMethodSymbol? accessor) 226if (member is IMethodSymbol { IsStatic: true, IsAbstract: true, MethodKind: MethodKind.UserDefinedOperator } method) 319private static bool IsInaccessibleImplementableAccessor(IMethodSymbol? accessor, ISymbol within) 425case IMethodSymbol method: 637IMethodSymbol { MethodKind: MethodKind.Ordinary, CanBeReferencedByName: true } => true, 656return member is IMethodSymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (2)
28ContainingSymbol: IMethodSymbol 60ContainingSymbol: IMethodSymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (39)
78IMethodSymbol method => method.OverriddenMethod, 88IMethodSymbol method => ImmutableArray<ISymbol>.CastUp(method.ExplicitInterfaceImplementations), 137var methodSymbol = (IMethodSymbol)symbol; 178=> symbol is IMethodSymbol { MethodKind: MethodKind.AnonymousFunction }; 205=> symbol is IMethodSymbol { MethodKind: MethodKind.ReducedExtension }; 211=> symbol is IMethodSymbol { IsExtensionMethod: true }; 214=> symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction }; 223=> symbol is IMethodSymbol { MethodKind: MethodKind.Constructor }; 226=> symbol is IMethodSymbol { MethodKind: MethodKind.StaticConstructor }; 229=> symbol is IMethodSymbol { MethodKind: MethodKind.Destructor }; 232=> symbol is IMethodSymbol { MethodKind: MethodKind.UserDefinedOperator }; 235=> symbol is IMethodSymbol { MethodKind: MethodKind.Conversion }; 238=> symbol is IMethodSymbol { MethodKind: MethodKind.Ordinary }; 241=> symbol is IMethodSymbol { MethodKind: MethodKind.Ordinary or MethodKind.LocalFunction }; 280IMethodSymbol methodSymbol => methodSymbol.ReturnType, 290SymbolKind.Method => ((IMethodSymbol)symbol).Arity, 305symbol = ((IMethodSymbol)symbol).GetConstructedReducedFrom(); 310if (symbol.ContainingSymbol is IMethodSymbol method) 328var method = parameter.ContainingSymbol as IMethodSymbol; 361IMethodSymbol m => m.Parameters, 369IMethodSymbol m => m.TypeParameters, 390IMethodSymbol m => m.TypeArguments, 435if (symbol is IMethodSymbol method && method.Parameters.All(p => p.RefKind == RefKind.None)) 550=> (symbol as IMethodSymbol)?.MethodKind.IsPropertyAccessor() == true; 553=> symbol is IMethodSymbol { MethodKind: MethodKind.EventAdd or MethodKind.EventRaise or MethodKind.EventRemove }; 579var methodSymbol = symbol as IMethodSymbol; 603var getAwaiters = potentialGetAwaiters.OfType<IMethodSymbol>().Where(x => !x.Parameters.Any()); 607public static bool IsValidGetAwaiter(this IMethodSymbol symbol) 611private static bool VerifyGetAwaiter(IMethodSymbol getAwaiter) 625var methods = returnType.GetMembers().OfType<IMethodSymbol>(); 641public static bool IsValidGetEnumerator(this IMethodSymbol symbol) 645private static bool VerifyGetEnumerator(IMethodSymbol getEnumerator) 665if (!members.OfType<IMethodSymbol>().Any(x => 681public static bool IsValidGetAsyncEnumerator(this IMethodSymbol symbol) 685private static bool VerifyGetAsyncEnumerator(IMethodSymbol getAsyncEnumerator) 708if (!members.OfType<IMethodSymbol>().Any(x => x.Name == WellKnownMemberNames.MoveNextAsyncMethodName))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
106public override bool VisitMethod(IMethodSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (4)
105var funcPtrSignature = ((IFunctionPointerTypeSymbol)symbol).Signature; 154((IMethodSymbol)symbol).MethodKind == MethodKind.BuiltinOperator && 163Debug.Assert(!(symbol.IsKind(SymbolKind.Method) && ((IMethodSymbol)symbol).MethodKind == MethodKind.BuiltinOperator && symbol.ContainingSymbol.IsKind(SymbolKind.FunctionPointerType))); 165((IMethodSymbol)symbol).MethodKind == MethodKind.BuiltinOperator &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (2)
409.SelectAccessibleMembers<IMethodSymbol>(WellKnownMemberNames.CollectionInitializerAddMethodName, within ?? typeSymbol) 410.OfType<IMethodSymbol>()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (3)
232var containingMethod = TryGetContainingAnonymousFunctionOrLocalFunction(operation) ?? (containingSymbol as IMethodSymbol); 236public static IMethodSymbol? TryGetContainingAnonymousFunctionOrLocalFunction(this IOperation? operation)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (3)
72protected abstract PooledHashSet<IMethodSymbol> LambdaOrLocalFunctionsBeingAnalyzed { get; } 91public BasicBlockAnalysisData AnalyzeLocalFunctionInvocation(IMethodSymbol localFunction, CancellationToken cancellationToken) 126protected abstract BasicBlockAnalysisData AnalyzeLocalFunctionInvocationCore(IMethodSymbol localFunction, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.cs (1)
43BasicBlockAnalysisData AnalyzeLocalFunction(IMethodSymbol localFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (2)
30IMethodSymbol lambdaOrLocalFunction, 52IMethodSymbol localFunctionOrLambda,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (12)
36private readonly Func<IMethodSymbol, ControlFlowGraph, AnalysisData, CancellationToken, BasicBlockAnalysisData> _analyzeLocalFunctionOrLambdaInvocation; 55private readonly PooledDictionary<IMethodSymbol, ControlFlowGraph> _localFunctionTargetsToAccessingCfgMap; 79PooledHashSet<IMethodSymbol> lambdaOrLocalFunctionsBeingAnalyzed, 80Func<IMethodSymbol, ControlFlowGraph, AnalysisData, CancellationToken, BasicBlockAnalysisData> analyzeLocalFunctionOrLambdaInvocation, 82PooledDictionary<IMethodSymbol, ControlFlowGraph> localFunctionTargetsToAccessingCfgMap, 112protected override PooledHashSet<IMethodSymbol> LambdaOrLocalFunctionsBeingAnalyzed { get; } 119Func<IMethodSymbol, ControlFlowGraph, AnalysisData, CancellationToken, BasicBlockAnalysisData> analyzeLocalFunctionOrLambdaInvocation) 132lambdaOrLocalFunctionsBeingAnalyzed: PooledHashSet<IMethodSymbol>.GetInstance(), 135localFunctionTargetsToAccessingCfgMap: PooledDictionary<IMethodSymbol, ControlFlowGraph>.GetInstance(), 141IMethodSymbol lambdaOrLocalFunction, 321ControlFlowGraph TryGetLocalFunctionControlFlowGraphInScope(IMethodSymbol localFunction) 486protected override BasicBlockAnalysisData AnalyzeLocalFunctionInvocationCore(IMethodSymbol localFunction, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.OperationTreeAnalysisData.cs (7)
21private readonly Func<IMethodSymbol, BasicBlockAnalysisData> _analyzeLocalFunction; 26PooledHashSet<IMethodSymbol> lambdaOrLocalFunctionsBeingAnalyzed, 27Func<IMethodSymbol, BasicBlockAnalysisData> analyzeLocalFunction) 39protected override PooledHashSet<IMethodSymbol> LambdaOrLocalFunctionsBeingAnalyzed { get; } 43Func<IMethodSymbol, BasicBlockAnalysisData> analyzeLocalFunction) 48lambdaOrLocalFunctionsBeingAnalyzed: PooledHashSet<IMethodSymbol>.GetInstance(), 52protected override BasicBlockAnalysisData AnalyzeLocalFunctionInvocationCore(IMethodSymbol localFunction, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
345private void AnalyzeLocalFunctionInvocation(IMethodSymbol localFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (1)
46if (symbol is IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (3)
172switch (((IMethodSymbol)currentSymbol).MethodKind) 368SymbolCategory.Method => symbol is IMethodSymbol method && method.MethodKind == (MethodKind)_kind, 503if (Modifier.IsAsync && kind == SymbolKind.Method && ((IMethodSymbol)symbol).IsAsync)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ForEachSymbols.cs (6)
11public readonly IMethodSymbol GetEnumeratorMethod; 12public readonly IMethodSymbol MoveNextMethod; 14public readonly IMethodSymbol DisposeMethod; 17internal ForEachSymbols(IMethodSymbol getEnumeratorMethod, 18IMethodSymbol moveNextMethod, 20IMethodSymbol disposeMethod,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFacts.cs (4)
84IMethodSymbol? GetGetAwaiterMethod(SemanticModel semanticModel, SyntaxNode node); 86ImmutableArray<IMethodSymbol> GetDeconstructionAssignmentMethods(SemanticModel semanticModel, SyntaxNode node); 88ImmutableArray<IMethodSymbol> GetDeconstructionForEachMethods(SemanticModel semanticModel, SyntaxNode node); 107ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (1)
112=> symbol is IMethodSymbol methodSymbol &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
63if (isAnonymousDelegateType && symbol is IMethodSymbol methodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BuiltinOperatorSymbolKey.cs (6)
13private sealed class BuiltinOperatorSymbolKey : AbstractSymbolKey<IMethodSymbol> 17public sealed override void Create(IMethodSymbol symbol, SymbolKeyWriter visitor) 25SymbolKeyReader reader, IMethodSymbol? contextualSymbol, out string? failureReason) 30using var parameterTypes = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 56var unaryOperator = reader.Compilation.CreateBuiltinOperator(name, returnTypeSymbol, parameterTypes[0]); 60var binaryOperator = reader.Compilation.CreateBuiltinOperator(name, returnTypeSymbol, parameterTypes[0], parameterTypes[1]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (5)
32/// <item>Two <see cref="IMethodSymbol"/>s are the "same" if they have 35/// equal <see cref="IMethodSymbol.Arity"/>, 36/// the "same" <see cref="IMethodSymbol.TypeArguments"/>, and have 73/// cref="IRangeVariableSymbol"/> and <see cref="MethodKind.LocalFunction"/> <see cref="IMethodSymbol"/>s can also 319IMethodSymbol { MethodKind: MethodKind.LocalFunction } => true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (19)
12private sealed class ReducedExtensionMethodSymbolKey : AbstractSymbolKey<IMethodSymbol> 16public sealed override void Create(IMethodSymbol symbol, SymbolKeyWriter visitor) 25SymbolKeyReader reader, IMethodSymbol? contextualMethod, out string? failureReason) 42using var result = PooledArrayBuilder<IMethodSymbol>.GetInstance(); 43foreach (var reducedFrom in reducedFromResolution.OfType<IMethodSymbol>()) 56private sealed class ConstructedMethodSymbolKey : AbstractSymbolKey<IMethodSymbol> 60public sealed override void Create(IMethodSymbol symbol, SymbolKeyWriter visitor) 67SymbolKeyReader reader, IMethodSymbol? contextualMethod, out string? failureReason) 71using var typeArguments = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 102using var result = PooledArrayBuilder<IMethodSymbol>.GetInstance(); 103foreach (var method in constructedFrom.OfType<IMethodSymbol>()) 124private sealed class MethodSymbolKey : AbstractSymbolKey<IMethodSymbol> 128public sealed override void Create(IMethodSymbol symbol, SymbolKeyWriter visitor) 161SymbolKeyReader reader, IMethodSymbol? contextualSymbol, out string? failureReason) 180using var methods = GetMembersOfNamedType<IMethodSymbol>(containingType, metadataName: null); 181IMethodSymbol? method = null; 224_ = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 244private static IMethodSymbol? Resolve( 245SymbolKeyReader reader, bool isPartialImplementationPart, IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ParameterSymbolKey.cs (2)
46case IMethodSymbol method: 65var delegateInvoke = (eventSymbol.Type as INamedTypeSymbol)?.DelegateInvokeMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (5)
331private readonly List<IMethodSymbol?> _methodSymbolStack = []; 409public MethodPopper PushMethod(IMethodSymbol? method) 415private void PopMethod(IMethodSymbol? method) 422public IMethodSymbol? ResolveMethod(int index) 441public readonly ref struct MethodPopper(SymbolKeyReader reader, IMethodSymbol? method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (5)
69private readonly List<IMethodSymbol> _methodSymbolStack = []; 359public override void VisitMethod(IMethodSymbol methodSymbol) 499var method = _methodSymbolStack[i]; 513public void PushMethod(IMethodSymbol method) 516public void PopMethod(IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterOrdinalSymbolKey.cs (1)
24var method = reader.ResolveMethod(methodIndex);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (12)
359symbol = ((IMethodSymbol)symbol).GetConstructedReducedFrom()!; 364newSymbol = ((IMethodSymbol)newSymbol).GetConstructedReducedFrom()!; 384if (symbol is IMethodSymbol methodSymbol && newSymbol is IMethodSymbol newMethodSymbol) 458if (symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } methodSymbol && 459newSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } newMethodSymbol) 780GetForEachSymbols(this.OriginalSemanticModel, forEachStatement, out var originalGetEnumerator, out var originalElementType); 781GetForEachSymbols(this.SpeculativeSemanticModel, newForEachStatement, out var newGetEnumerator, out var newElementType); 797protected abstract void GetForEachSymbols(SemanticModel model, TForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType); 799private bool ReplacementBreaksForEachGetEnumerator(IMethodSymbol getEnumerator, IMethodSymbol newGetEnumerator, TExpressionSyntax newForEachStatementExpression) 876((IMethodSymbol)symbol).MethodKind == MethodKind.DelegateInvoke;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (12)
41SymbolKind.Method => HaveSameSignature((IMethodSymbol)symbol1, (IMethodSymbol)symbol2, caseSensitive), 65private static bool BadPropertyAccessor(IMethodSymbol method1, IMethodSymbol method2) 71public bool HaveSameSignature(IMethodSymbol method1, 72IMethodSymbol method2, 151var method1 = (IMethodSymbol)symbol1; 152var method2 = (IMethodSymbol)symbol2; 198private bool HaveSameSignatureAndConstraintsAndReturnType(IMethodSymbol method1, IMethodSymbol method2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (6)
147public bool ReturnTypeEquals(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies = null) 192private static bool IsConstructedFromSelf(IMethodSymbol symbol) 198private static bool CheckContainingType(IMethodSymbol x) 229private static bool IsPartialMethodDefinitionPart(IMethodSymbol symbol) 232private static bool IsPartialMethodImplementationPart(IMethodSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (8)
123SymbolKind.Method => MethodsAreEquivalent((IMethodSymbol)x, (IMethodSymbol)y, equivalentTypesWithDifferingAssemblies), 169private bool MethodsAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies, bool considerReturnRefKinds = false) 178var rx = x.ReducedFrom; 179var ry = y.ReducedFrom; 486internal bool ReturnTypesAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
65SymbolKind.Method => CombineHashCodes((IMethodSymbol)x, currentHash), 109private int CombineHashCodes(IMethodSymbol x, int currentHash)
Microsoft.CodeAnalysis.CodeStyle.Fixes (282)
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
50if (symbol is IMethodSymbol or IPropertySymbol or IEventSymbol)
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (1)
61foreach (var candidateSymbol in candidateSymbols.OfType<IMethodSymbol>())
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (9)
78if (semanticModel.GetEnclosingSymbol(node.SpanStart, cancellationToken) is IMethodSymbol methodWithDiagnostic) 124var candidates = semanticModel.GetMemberGroup(expression, cancellationToken).OfType<IMethodSymbol>().ToImmutableArray(); 157IMethodSymbol methodSymbol => methodSymbol.ContainingType, // Implicit object creation expressions 188ImmutableArray<IMethodSymbol> methodCandidates) 193foreach (var method in methodCandidates.OrderBy(m => m.Parameters.Length)) 226private static int NonParamsParameterCount(IMethodSymbol method) 350private static string GetCodeFixTitle(string resourceString, IMethodSymbol methodToUpdate, bool includeParameters) 368IMethodSymbol method, 434IMethodSymbol method,
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (6)
26public static bool HasCascadingDeclarations(IMethodSymbol method) 75IMethodSymbol method, 147private static async Task<ImmutableArray<IMethodSymbol>> FindMethodDeclarationReferencesAsync( 148Document invocationDocument, IMethodSymbol method, CancellationToken cancellationToken) 154.OfType<IMethodSymbol>() 160IMethodSymbol method,
src\Analyzers\Core\CodeFixes\AddParameter\ArgumentInsertPositionData.cs (2)
7internal readonly struct ArgumentInsertPositionData<TArgumentSyntax>(IMethodSymbol methodToUpdate, TArgumentSyntax argumentToInsert, int argumentInsertionIndex) where TArgumentSyntax : SyntaxNode 9public IMethodSymbol MethodToUpdate { get; } = methodToUpdate;
src\Analyzers\Core\CodeFixes\AddParameter\CodeFixData.cs (2)
12IMethodSymbol method, 20public IMethodSymbol Method { get; } = method ?? throw new ArgumentNullException(nameof(method));
src\Analyzers\Core\CodeFixes\AddParameter\RegisterFixData.cs (1)
9internal class RegisterFixData<TArgumentSyntax>(SeparatedSyntaxList<TArgumentSyntax> arguments, ImmutableArray<IMethodSymbol> methodCandidates, bool isConstructorInitializer)
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (5)
43protected abstract IMethodSymbol GetCurrentConstructor(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken); 44protected abstract IMethodSymbol GetDelegatedConstructor(SemanticModel semanticModel, IMethodSymbol constructor, CancellationToken cancellationToken); 46protected bool WillCauseConstructorCycle(State state, SemanticDocument document, IMethodSymbol delegatedConstructor, CancellationToken cancellationToken) 50var currentConstructor = GetCurrentConstructor(document.SemanticModel, state.Token, cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (8)
54private IMethodSymbol? _delegatedConstructor; 154var delegatedConstructor = FindConstructorToDelegateTo(parameters, expressions, cancellationToken); 184private IMethodSymbol? FindConstructorToDelegateTo( 205private IMethodSymbol? FindConstructorToDelegateTo( 208ImmutableArray<IMethodSymbol> constructors, 213foreach (var constructor in constructors) 251private bool Matches(IMethodSymbol ctor, ISyntaxFactsService service) 594var constructor = CodeGenerationSymbolFactory.CreateConstructorSymbol(
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (4)
21IMethodSymbol constructor) 74IMethodSymbol constructor, 82var constructorInCompilation = (IMethodSymbol?)SymbolKey.Create(constructor).Resolve(semanticModel.Compilation).Symbol;
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.AbstractCodeAction.cs (5)
27private readonly IList<IMethodSymbol> _constructors; 35IList<IMethodSymbol> constructors, 60private IMethodSymbol CreateConstructorDefinition( 61IMethodSymbol baseConstructor) 82private static Accessibility DetermineAccessibility(IMethodSymbol baseConstructor, INamedTypeSymbol classType)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.CodeAction.cs (2)
15IMethodSymbol constructor) : AbstractCodeAction(document, state, [constructor], GetDisplayText(state, constructor)) 17private static string GetDisplayText(State state, IMethodSymbol constructor)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.CodeActionAll.cs (1)
15IList<IMethodSymbol> constructors)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (1)
40foreach (var constructor in state.UnimplementedConstructors)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (4)
21public ImmutableArray<IMethodSymbol> UnimplementedConstructors { get; private set; } 97var baseNoArgConstructor = baseType.Constructors.FirstOrDefault(c => c.Parameters.Length == 0); 119IMethodSymbol constructor, 120ImmutableArray<IMethodSymbol> classConstructors,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.cs (2)
26protected abstract bool TryInitializeImplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn); 27protected abstract bool TryInitializeExplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.State.cs (2)
62out var identifierToken, out var methodSymbol, out var typeToGenerateIn)) 86out var identifierToken, out var methodSymbol, out var typeToGenerateIn))
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.State.cs (1)
71var methodSymbol = CodeGenerationSymbolFactory.CreateMethodSymbol(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.cs (1)
26protected abstract bool TryInitializeExplicitInterfaceState(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.State.cs (2)
89out var identifierToken, out var methodSymbol, out var typeToGenerateIn)) 247private static IMethodSymbol CreateMethodSymbolWithReturnType(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs (2)
18IMethodSymbol methodSymbol, 21private readonly IMethodSymbol _methodSymbol = methodSymbol;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (4)
76var getMethod = CodeGenerationSymbolFactory.CreateAccessorSymbol( 81var setMethod = includeSetter ? getMethod : null; 96public async ValueTask<IMethodSymbol> GenerateMethodAsync( 111var method = CodeGenerationSymbolFactory.CreateMethodSymbol(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.State.cs (1)
83.OfType<IMethodSymbol>();
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (3)
69var getAccessor = CreateAccessor(_state.DetermineMaximalAccessibility()); 70var setAccessor = _isReadonly || _refKind != RefKind.None 106private IMethodSymbol CreateAccessor(Accessibility accessibility)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
212var containingMethod = state.ContainingMethod;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (4)
31public IMethodSymbol ContainingMethod { get; private set; } 397private static IMethodSymbol FindContainingMethodSymbol(int position, SemanticModel semanticModel, CancellationToken cancellationToken) 402if (symbol is IMethodSymbol method && !method.IsAnonymousFunction()) 480var enclosingMethodSymbol = _document.SemanticModel.GetEnclosingSymbol<IMethodSymbol>(SimpleNameOrMemberAccessExpressionOpt.SpanStart, cancellationToken);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (5)
169IMethodSymbol method => GenerateMethod(compilation, method, throughMember, modifiers, accessibility), 177Compilation compilation, IMethodSymbol method, ISymbol? throughMember, 248private IMethodSymbol? GetEventAddOrRemoveMethod( 249IEventSymbol @event, IMethodSymbol? accessor, ISymbol? throughMember, 267private bool ShouldGenerateAccessor([NotNullWhen(true)] IMethodSymbol? method)
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.cs (1)
26protected abstract string ToDisplayString(IMethodSymbol disposeImplMethod, SymbolDisplayFormat format);
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (4)
147case IMethodSymbol methodSymbol: 230var disposeMethod = TryGetIDisposableDispose(compilation); 246public static IMethodSymbol? TryGetIDisposableDispose(Compilation compilation) 254if (member is IMethodSymbol { IsStatic: false, ReturnsVoid: true, Arity: 0, Parameters.Length: 0 } disposeMethod)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (7)
259if (member is not IMethodSymbol method) 295if (member is IMethodSymbol method) 312var accessor = CodeGenerationSymbolFactory.CreateAccessorSymbol( 327private IMethodSymbol? GetAddOrRemoveMethod( 328IEventSymbol @event, bool generateInvisibly, IMethodSymbol accessor, string memberName, 364if (member is IMethodSymbol method1 && baseMember is IMethodSymbol method2)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_DisposePattern.cs (9)
55var disposeMethod = TryGetIDisposableDispose(compilation)!; 119IMethodSymbol disposeMethod, 122var disposeImplMethod = CreateDisposeImplementationMethod(compilation, disposeMethod, disposedValueField); 126var disposeInterfaceMethod = CreateDisposeInterfaceMethod( 135private IMethodSymbol CreateDisposeImplementationMethod( 137IMethodSymbol disposeMethod, 186private IMethodSymbol CreateDisposeInterfaceMethod( 188IMethodSymbol disposeMethod, 223var result = CodeGenerationSymbolFactory.CreateMethodSymbol(
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Method.cs (3)
24IMethodSymbol method, 33var updatedMethod = method.EnsureNonConflictingNames(State.ClassOrStructType, syntaxFacts); 50private SyntaxNode CreateStatement(Compilation compilation, IMethodSymbol method)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (6)
41var getAccessor = GenerateGetAccessor( 45var setAccessor = GenerateSetAccessor( 90private IMethodSymbol? GenerateSetAccessor( 110var setMethod = property.SetMethod.RemoveInaccessibleAttributesAndAttributesOfTypes( 123private IMethodSymbol? GenerateGetAccessor( 137var getMethod = property.GetMethod.RemoveInaccessibleAttributesAndAttributesOfTypes(
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (9)
29bool keepVoid, IMethodSymbol methodSymbol, SyntaxNode node, KnownTaskTypes knownTypes, CancellationToken cancellationToken); 58var methodSymbol = GetMethodSymbol(semanticModel, node, cancellationToken); 87private static IMethodSymbol? GetMethodSymbol(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken) 91return symbol as IMethodSymbol; 116var methodSymbol = GetMethodSymbol(semanticModel, node, cancellationToken); 158IMethodSymbol methodSymbol, 177var newMethod = (IMethodSymbol)semanticModel.GetRequiredDeclaredSymbol(newNode, cancellationToken); 187IMethodSymbol methodSymbol,
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (8)
25protected abstract SyntaxNode RemoveAsyncTokenAndFixReturnType(IMethodSymbol methodSymbol, SyntaxNode node, KnownTaskTypes knownTypes); 58var methodSymbol = (IMethodSymbol?)(semanticModel.GetDeclaredSymbol(node, cancellationToken) ?? semanticModel.GetSymbolInfo(node, cancellationToken).GetAnySymbol()); 73private async Task<Solution> RenameThenRemoveAsyncTokenAsync(Document document, SyntaxNode node, IMethodSymbol methodSymbol, CancellationToken cancellationToken) 89var newMethod = (IMethodSymbol)semanticModel.GetRequiredDeclaredSymbol(newNode, cancellationToken); 97Document document, IMethodSymbol methodSymbol, SyntaxNode node, CancellationToken cancellationToken) 128if (semanticModel.GetDeclaredSymbol(methodDeclaration, cancellationToken) is IMethodSymbol methodSymbol)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (5)
45var methodSymbol = GetMethodSymbol(node, semanticModel, cancellationToken); 85var methodSymbol = GetMethodSymbol(node, semanticModel, cancellationToken); 104private static IMethodSymbol? GetMethodSymbol(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken) 105=> semanticModel.GetSymbolInfo(node, cancellationToken).Symbol as IMethodSymbol ?? 106semanticModel.GetDeclaredSymbol(node, cancellationToken) as IMethodSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (7)
54public TDeclarationNode AddMethod<TDeclarationNode>(TDeclarationNode destination, IMethodSymbol method, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode 83public SyntaxNode? CreateMethodDeclaration(IMethodSymbol method, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken) 126protected abstract TDeclarationNode AddMethod<TDeclarationNode>(TDeclarationNode destination, IMethodSymbol method, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 148public abstract SyntaxNode? CreateMethodDeclaration(IMethodSymbol method, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken); 349IMethodSymbol method => CreateMethodDeclaration(method, codeGenerationDestination, info, cancellationToken), 367IMethodSymbol method => AddMethod(currentDestination, method, info, availableIndices, cancellationToken), 447public Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
43var ctor = attribute.AttributeConstructor;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (28)
38IMethodSymbol? addMethod = null, 39IMethodSymbol? removeMethod = null, 40IMethodSymbol? raiseMethod = null) 57IMethodSymbol? getMethod, 58IMethodSymbol? setMethod, 85ImmutableArray<IParameterSymbol> parameters, IMethodSymbol? getMethod, IMethodSymbol? setMethod, 123public static IMethodSymbol CreateConstructorSymbol( 142public static IMethodSymbol CreateDestructorSymbol( 151internal static IMethodSymbol CreateMethodSymbol( 158ImmutableArray<IMethodSymbol> explicitInterfaceImplementations, 176public static IMethodSymbol CreateMethodSymbol( 180ImmutableArray<IMethodSymbol> explicitInterfaceImplementations, 195public static IMethodSymbol CreateOperatorSymbol( 223public static IMethodSymbol CreateConversionSymbol( 248public static IMethodSymbol CreateConversionSymbol( 360internal static IMethodSymbol CreateAccessorSymbol( 361IMethodSymbol accessor, 364ImmutableArray<IMethodSymbol> explicitInterfaceImplementations = default, 386public static IMethodSymbol CreateAccessorSymbol( 474var invokeMethod = CreateMethodSymbol( 514internal static IMethodSymbol CreateMethodSymbol( 515IMethodSymbol method, 519ImmutableArray<IMethodSymbol> explicitInterfaceImplementations = default, 553IMethodSymbol? getMethod = null, 554IMethodSymbol? setMethod = null) 577IMethodSymbol? addMethod = null, 578IMethodSymbol? removeMethod = null)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerator.cs (1)
44public static Task<Document> AddMethodDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (3)
34SyntaxNode? CreateMethodDeclaration(IMethodSymbol method, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken); 64TDeclarationNode AddMethod<TDeclarationNode>(TDeclarationNode destination, IMethodSymbol method, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 144Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (10)
20public new IMethodSymbol OriginalDefinition { get; protected set; } 50public abstract IMethodSymbol ConstructedFrom { get; } 53public abstract IMethodSymbol OverriddenMethod { get; } 54public abstract IMethodSymbol ReducedFrom { get; } 56public abstract IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType); 57public abstract ImmutableArray<IMethodSymbol> ExplicitInterfaceImplementations { get; } 58public abstract IMethodSymbol PartialDefinitionPart { get; } 59public abstract IMethodSymbol PartialImplementationPart { get; } 111public IMethodSymbol Construct(params ITypeSymbol[] typeArguments) 114public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (4)
81public abstract IMethodSymbol DelegateInvokeMethod { get; } 86public abstract ImmutableArray<IMethodSymbol> InstanceConstructors { get; } 87public abstract ImmutableArray<IMethodSymbol> StaticConstructors { get; } 88public abstract ImmutableArray<IMethodSymbol> Constructors { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAttributeData.cs (1)
21protected override IMethodSymbol CommonAttributeConstructor => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedMethodSymbol.cs (7)
69public override IMethodSymbol ConstructedFrom => _constructedFrom; 76public override IMethodSymbol OverriddenMethod 80public override IMethodSymbol ReducedFrom 87public override IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType) 93public override ImmutableArray<IMethodSymbol> ExplicitInterfaceImplementations 97public override IMethodSymbol PartialDefinitionPart 101public override IMethodSymbol PartialImplementationPart
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (4)
47public override IMethodSymbol DelegateInvokeMethod 60public override ImmutableArray<IMethodSymbol> InstanceConstructors 69public override ImmutableArray<IMethodSymbol> StaticConstructors 78public override ImmutableArray<IMethodSymbol> Constructors
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructorInfo.cs (10)
12private static readonly ConditionalWeakTable<IMethodSymbol, CodeGenerationConstructorInfo> s_constructorToInfoMap = new(); 38IMethodSymbol constructor, 50private static CodeGenerationConstructorInfo? GetInfo(IMethodSymbol method) 56public static ImmutableArray<SyntaxNode> GetThisConstructorArgumentsOpt(IMethodSymbol constructor) 59public static ImmutableArray<SyntaxNode> GetBaseConstructorArgumentsOpt(IMethodSymbol constructor) 62public static ImmutableArray<SyntaxNode> GetStatements(IMethodSymbol constructor) 65public static string GetTypeName(IMethodSymbol constructor) 68public static bool GetIsUnsafe(IMethodSymbol constructor) 71public static bool GetIsPrimaryConstructor(IMethodSymbol constructor) 83private static string GetTypeName(CodeGenerationConstructorInfo? info, IMethodSymbol constructor)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationDestructorInfo.cs (6)
14private static readonly ConditionalWeakTable<IMethodSymbol, CodeGenerationDestructorInfo> s_destructorToInfoMap = new(); 28IMethodSymbol destructor, 36private static CodeGenerationDestructorInfo GetInfo(IMethodSymbol method) 42public static ImmutableArray<SyntaxNode> GetStatements(IMethodSymbol destructor) 45public static string GetTypeName(IMethodSymbol destructor) 51private static string GetTypeName(CodeGenerationDestructorInfo info, IMethodSymbol constructor)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (6)
23IMethodSymbol? addMethod, 24IMethodSymbol? removeMethod, 25IMethodSymbol? raiseMethod) : CodeGenerationSymbol(containingType?.ContainingAssembly, containingType, attributes, declaredAccessibility, modifiers, name), IEventSymbol 32public IMethodSymbol? AddMethod { get; } = addMethod; 33public IMethodSymbol? RemoveMethod { get; } = removeMethod; 34public IMethodSymbol? RaiseMethod { get; } = raiseMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodInfo.cs (9)
14private static readonly ConditionalWeakTable<IMethodSymbol, CodeGenerationMethodInfo> s_methodToInfoMap = new(); 40IMethodSymbol method, 52private static CodeGenerationMethodInfo GetInfo(IMethodSymbol method) 58public static ImmutableArray<SyntaxNode> GetStatements(IMethodSymbol method) 61public static ImmutableArray<SyntaxNode> GetHandlesExpressions(IMethodSymbol method) 64public static bool GetIsNew(IMethodSymbol method) 67public static bool GetIsUnsafe(IMethodSymbol method) 70public static bool GetIsPartial(IMethodSymbol method) 73public static bool GetIsAsyncMethod(IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (8)
24public override ImmutableArray<IMethodSymbol> ExplicitInterfaceImplementations { get; } 34ImmutableArray<IMethodSymbol> explicitInterfaceImplementations, 103public override IMethodSymbol ConstructedFrom => this; 110public override IMethodSymbol OverriddenMethod => null; 112public override IMethodSymbol ReducedFrom => null; 117public override IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType) 120public override IMethodSymbol PartialImplementationPart => null; 122public override IMethodSymbol PartialDefinitionPart => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (7)
96public override IMethodSymbol DelegateInvokeMethod 101? this.GetMembers(WellKnownMemberNames.DelegateInvokeName).OfType<IMethodSymbol>().FirstOrDefault() 168public override ImmutableArray<IMethodSymbol> InstanceConstructors 174this.GetMembers().OfType<IMethodSymbol>().Where(m => m.MethodKind == MethodKind.Constructor && !m.IsStatic)); 178public override ImmutableArray<IMethodSymbol> StaticConstructors 184this.GetMembers().OfType<IMethodSymbol>().Where(m => m.MethodKind == MethodKind.StaticConstructor && m.IsStatic)); 188public override ImmutableArray<IMethodSymbol> Constructors
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (4)
28IMethodSymbol getMethod, 29IMethodSymbol setMethod) : CodeGenerationSymbol(containingType?.ContainingAssembly, containingType, attributes, declaredAccessibility, modifiers, name), IPropertySymbol 38public IMethodSymbol GetMethod { get; } = getMethod; 39public IMethodSymbol SetMethod { get; } = setMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (2)
86public static IMethodSymbol ContainingMethod => null; 170public ImmutableArray<AttributeData> GetAttributes(IMethodSymbol attributeConstructor)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (2)
72public IMethodSymbol DeclaringMethod 76return this.ContainingSymbol as IMethodSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (9)
20public static IMethodSymbol EnsureNonConflictingNames( 21this IMethodSymbol method, INamedTypeSymbol containingType, ISyntaxFactsService syntaxFacts) 41var updatedMethod = method.RenameTypeParameters(newTypeParameterNames); 45public static IMethodSymbol RenameTypeParameters(this IMethodSymbol method, ImmutableArray<string> newNames) 77public static IMethodSymbol RenameParameters( 78this IMethodSymbol method, ImmutableArray<string> parameterNames) 143public static IMethodSymbol RemoveInaccessibleAttributesAndAttributesOfTypes( 144this IMethodSymbol method, ISymbol accessibleWithin,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
103this SyntaxGenerator generator, IMethodSymbol method, ISymbol throughMember)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (7)
32public static IMethodSymbol CreateEqualsMethod( 49public static IMethodSymbol CreateEqualsMethod(this Compilation compilation, ImmutableArray<SyntaxNode> statements) 64public static IMethodSymbol CreateIEquatableEqualsMethod( 77var methodSymbol = constructedEquatableType 79.OfType<IMethodSymbol>() 443from method in baseType.GetMembers(EqualsName).OfType<IMethodSymbol>() 480var constructor = CodeGenerationSymbolFactory.CreateConstructorSymbol(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateGetHashCodeMethod.cs (3)
98var baseHashCode = GetBaseGetHashCodeMethod(containingType); 192public static IMethodSymbol? GetBaseGetHashCodeMethod(INamedTypeSymbol containingType) 205from method in baseType.GetMembers(GetHashCodeName).OfType<IMethodSymbol>()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (9)
103protected static IMethodSymbol? FindDisposeMethod(Compilation compilation, ITypeSymbol? type, bool isAsync) 108var methodToLookFor = isAsync 115return impl as IMethodSymbol; 117IMethodSymbol? GetDisposeMethod(string typeName, string methodName) 120return disposableType?.GetMembers().OfType<IMethodSymbol>().FirstOrDefault(m => m.Parameters.Length == 0 && m.Name == methodName); 170public IMethodSymbol GetGetAwaiterMethod(SemanticModel semanticModel, SyntaxNode node) 173public ImmutableArray<IMethodSymbol> GetDeconstructionAssignmentMethods(SemanticModel semanticModel, SyntaxNode node) 176public ImmutableArray<IMethodSymbol> GetDeconstructionForEachMethods(SemanticModel semanticModel, SyntaxNode node) 203public ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\ISemanticFactsService.cs (1)
49IMethodSymbol? TryGetDisposeMethod(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.CSharp (158)
Binder\Semantics\Conversions\Conversion.cs (1)
1000public IMethodSymbol? MethodSymbol
Compilation\AwaitExpressionInfo.cs (4)
15public IMethodSymbol? GetAwaiterMethod { get; } 19public IMethodSymbol? GetResultMethod { get; } 23internal AwaitExpressionInfo(IMethodSymbol getAwaiter, IPropertySymbol isCompleted, IMethodSymbol getResult, bool isDynamic)
Compilation\CSharpCompilation.cs (5)
524internal override void ValidateDebugEntryPoint(IMethodSymbol debugEntryPoint, DiagnosticBag diagnostics) 3381IMethodSymbol? debugEntryPoint, 4203protected override IMethodSymbol CommonCreateBuiltinOperator( 4429protected override IMethodSymbol CommonCreateBuiltinOperator( 4515protected override IMethodSymbol? CommonGetEntryPoint(CancellationToken cancellationToken)
Compilation\CSharpSemanticModel.cs (6)
2942public abstract IMethodSymbol GetDeclaredSymbol(LocalFunctionStatementSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 2950public abstract IMethodSymbol GetDeclaredSymbol(CompilationUnitSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 3006public abstract IMethodSymbol GetDeclaredSymbol(BaseMethodDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 3143public abstract IMethodSymbol GetDeclaredSymbol(AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 3151public abstract IMethodSymbol GetDeclaredSymbol(ArrowExpressionClauseSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 5187public IMethodSymbol? GetInterceptorMethod(InvocationExpressionSyntax node, CancellationToken cancellationToken)
Compilation\DeconstructionInfo.cs (1)
34public IMethodSymbol? Method
Compilation\ForEachStatementInfo.cs (6)
23public IMethodSymbol? GetEnumeratorMethod { get; } 28public IMethodSymbol? MoveNextMethod { get; } 38public IMethodSymbol? DisposeMethod { get; } 66IMethodSymbol getEnumeratorMethod, 67IMethodSymbol moveNextMethod, 69IMethodSymbol disposeMethod,
Compilation\MemberSemanticModel.cs (6)
621public override IMethodSymbol GetDeclaredSymbol(LocalFunctionStatementSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 633public override IMethodSymbol GetDeclaredSymbol(CompilationUnitSyntax declarationSyntax, CancellationToken cancellationToken = default) 638public override IMethodSymbol GetDeclaredSymbol(BaseMethodDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 668public override IMethodSymbol GetDeclaredSymbol(AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 674public override IMethodSymbol GetDeclaredSymbol(ArrowExpressionClauseSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 930getAwaiter: (IMethodSymbol)awaitableInfo.GetAwaiter?.ExpressionSymbol.GetPublicSymbol(),
Compilation\QueryClauseInfo.cs (3)
29/// The operation, when present is implemented via <see cref="IMethodSymbol"/>. 30/// To access the type, when this is non-null use <see cref="IMethodSymbol.TypeArguments"/>[0]. 42/// The clause can be implemented via <see cref="IMethodSymbol"/>, or
Compilation\SpeculativeSemanticModelWithMemberModel.cs (5)
280public override IMethodSymbol GetDeclaredSymbol(LocalFunctionStatementSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 290public override IMethodSymbol GetDeclaredSymbol(CompilationUnitSyntax declarationSyntax, CancellationToken cancellationToken = default) 295public override IMethodSymbol GetDeclaredSymbol(BaseMethodDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 320public override IMethodSymbol GetDeclaredSymbol(AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 325public override IMethodSymbol GetDeclaredSymbol(ArrowExpressionClauseSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (6)
1466public override IMethodSymbol GetDeclaredSymbol(CompilationUnitSyntax declarationSyntax, CancellationToken cancellationToken = default) 1479public override IMethodSymbol GetDeclaredSymbol(LocalFunctionStatementSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1506public override IMethodSymbol GetDeclaredSymbol(BaseMethodDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1567public override IMethodSymbol GetDeclaredSymbol(AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1597public override IMethodSymbol GetDeclaredSymbol(ArrowExpressionClauseSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 2032method = (GetDeclaredSymbol(memberDecl, cancellationToken) as IMethodSymbol).GetSymbol();
CSharpExtensions.cs (5)
1351public static IMethodSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, CompilationUnitSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1409public static IMethodSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, BaseMethodDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1490public static IMethodSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1627public static IMethodSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, LocalFunctionStatementSyntax node, CancellationToken cancellationToken = default(CancellationToken)) 1636public static IMethodSymbol? GetInterceptorMethod(this SemanticModel? semanticModel, InvocationExpressionSyntax node, CancellationToken cancellationToken = default)
Emitter\Model\FunctionPointerTypeSymbolAdapter.cs (1)
60/// <see cref="FunctionPointerMethodSignature"/>, to hide its implementation of <see cref="IMethodSymbol"/>.
FlowAnalysis\CSharpDataFlowAnalysis.cs (3)
40private ImmutableArray<IMethodSymbol> _usedLocalFunctions; 344public override ImmutableArray<IMethodSymbol> UsedLocalFunctions 395private static ImmutableArray<IMethodSymbol> Normalize(IEnumerable<MethodSymbol> data)
Operations\CSharpOperationFactory.cs (11)
996IMethodSymbol symbol = boundLambda.Symbol.GetPublicSymbol(); 1009IMethodSymbol symbol = boundLocalFunctionStatement.Symbol.GetPublicSymbol(); 1228IMethodSymbol? constructMethod = getConstructMethod((CSharpCompilation)_semanticModel.Compilation, expr).GetPublicSymbol(); 1365IMethodSymbol? operatorMethod = method.GetPublicSymbol(); 1392IMethodSymbol? operatorMethod = boundIncrementOperator.MethodOpt.GetPublicSymbol(); 1435IMethodSymbol? operatorMethod = boundUnaryOperator.MethodOpt.GetPublicSymbol(); 1486IMethodSymbol operatorMethod = boundBinaryOperator.LogicalOperator.GetPublicSymbol(); 1487IMethodSymbol unaryOperatorMethod = boundBinaryOperator.OperatorKind.Operator() == CSharp.BinaryOperatorKind.And ? 1510IMethodSymbol? operatorMethod = boundBinaryOperator.Method.GetPublicSymbol(); 1511IMethodSymbol? unaryOperatorMethod = null; 2048legacyMode ? null : new SynthesizedLocal((_semanticModel.GetEnclosingSymbol(boundLockStatement.Syntax.SpanStart) as IMethodSymbol).GetSymbol(),
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (3)
106if (associatedSymbol is IMethodSymbol ctor) 308if (associatedSymbol is IMethodSymbol) 366var declaredAccessor = getSymbol ? (model.GetDeclaredSymbol(declarationWithExpressionBody, cancellationToken) as IPropertySymbol)?.GetMethod : null;
SymbolDisplay\SymbolDisplayVisitor.cs (1)
381return ((IMethodSymbol)symbol).MethodKind == MethodKind.LocalFunction;
SymbolDisplay\SymbolDisplayVisitor.Members.cs (14)
98var getMethod = property.GetMethod; 104var setMethod = property.SetMethod; 113private static bool ShouldMethodDisplayReadOnly(IMethodSymbol method, IPropertySymbol? propertyOpt = null) 186private static bool IsInitOnly([NotNullWhen(true)] IMethodSymbol? symbol) 227var accessor = symbol.AddMethod ?? symbol.RemoveMethod; 270public override void VisitMethod(IMethodSymbol symbol) 574void visitFunctionPointerSignature(IMethodSymbol symbol) 679void addUserDefinedOperatorName(IMethodSymbol symbol, SyntaxKind operatorKind, string operatorName) 723void addUserDefinedConversionName(IMethodSymbol symbol, SyntaxKind conversionKind, string operatorName) 744private static SymbolDisplayPartKind GetPartKindForConstructorOrDestructor(IMethodSymbol symbol) 755private void AddReturnType(IMethodSymbol symbol) 760private void AddTypeParameterConstraints(IMethodSymbol symbol) 768private void AddParameters(IMethodSymbol symbol) 1018private void AddAccessor(IPropertySymbol property, IMethodSymbol? method, SyntaxKind keyword)
SymbolDisplay\SymbolDisplayVisitor.Types.cs (3)
251var invokeMethod = symbol.DelegateInvokeMethod; 454var method = symbol.DelegateInvokeMethod; 786typeArguments = ((IMethodSymbol)owner).TypeArguments;
Symbols\Attributes\AttributeData.cs (2)
197/// Gets the constructor used in this application of the attribute as an <see cref="IMethodSymbol"/>. 199protected override IMethodSymbol? CommonAttributeConstructor
Symbols\PublicModel\EventSymbol.cs (3)
40IMethodSymbol? IEventSymbol.AddMethod 48IMethodSymbol? IEventSymbol.RemoveMethod 56IMethodSymbol? IEventSymbol.RaiseMethod
Symbols\PublicModel\FunctionPointerTypeSymbol.cs (1)
21public IMethodSymbol Signature => _underlying.Signature.GetPublicSymbol();
Symbols\PublicModel\LabelSymbol.cs (1)
21IMethodSymbol ILabelSymbol.ContainingMethod
Symbols\PublicModel\MethodSymbol.cs (54)
33MethodKind IMethodSymbol.MethodKind 79ITypeSymbol IMethodSymbol.ReturnType 92CodeAnalysis.NullableAnnotation IMethodSymbol.ReturnNullableAnnotation 100ImmutableArray<ITypeSymbol> IMethodSymbol.TypeArguments 111ImmutableArray<CodeAnalysis.NullableAnnotation> IMethodSymbol.TypeArgumentNullableAnnotations => 114ImmutableArray<ITypeParameterSymbol> IMethodSymbol.TypeParameters 122ImmutableArray<IParameterSymbol> IMethodSymbol.Parameters 133IMethodSymbol IMethodSymbol.ConstructedFrom 141bool IMethodSymbol.IsReadOnly 149bool IMethodSymbol.IsInitOnly 157IMethodSymbol IMethodSymbol.OriginalDefinition 165IMethodSymbol IMethodSymbol.OverriddenMethod 173ITypeSymbol IMethodSymbol.ReceiverType 186CodeAnalysis.NullableAnnotation IMethodSymbol.ReceiverNullableAnnotation => _underlying.ReceiverNullableAnnotation; 188IMethodSymbol IMethodSymbol.ReducedFrom 196ITypeSymbol IMethodSymbol.GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter) 203IMethodSymbol IMethodSymbol.ReduceExtensionMethod(ITypeSymbol receiverType) 210ImmutableArray<IMethodSymbol> IMethodSymbol.ExplicitInterfaceImplementations 218ISymbol IMethodSymbol.AssociatedSymbol 226bool IMethodSymbol.IsGenericMethod 234bool IMethodSymbol.IsAsync 242bool IMethodSymbol.HidesBaseMethodsByName 250ImmutableArray<CustomModifier> IMethodSymbol.ReturnTypeCustomModifiers 258ImmutableArray<CustomModifier> IMethodSymbol.RefCustomModifiers 266ImmutableArray<AttributeData> IMethodSymbol.GetReturnTypeAttributes() 271SignatureCallingConvention IMethodSymbol.CallingConvention => _underlying.CallingConvention.ToSignatureConvention(); 273ImmutableArray<INamedTypeSymbol> IMethodSymbol.UnmanagedCallingConventionTypes => _underlying.UnmanagedCallingConventionTypes.SelectAsArray(t => t.GetPublicSymbol()); 275IMethodSymbol IMethodSymbol.Construct(params ITypeSymbol[] typeArguments) 280IMethodSymbol IMethodSymbol.Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations) 285IMethodSymbol IMethodSymbol.PartialImplementationPart 293IMethodSymbol IMethodSymbol.PartialDefinitionPart 301bool IMethodSymbol.IsPartialDefinition => _underlying.IsDefinition && _underlying.IsPartialDefinition(); 303INamedTypeSymbol IMethodSymbol.AssociatedAnonymousDelegate 311int IMethodSymbol.Arity => _underlying.Arity; 313bool IMethodSymbol.IsExtensionMethod => _underlying.IsExtensionMethod; 315System.Reflection.MethodImplAttributes IMethodSymbol.MethodImplementationFlags => _underlying.ImplementationAttributes; 317bool IMethodSymbol.IsVararg => _underlying.IsVararg; 319bool IMethodSymbol.IsCheckedBuiltin => _underlying.IsCheckedBuiltin; 321bool IMethodSymbol.ReturnsVoid => _underlying.ReturnsVoid; 323bool IMethodSymbol.ReturnsByRef => _underlying.ReturnsByRef; 325bool IMethodSymbol.ReturnsByRefReadonly => _underlying.ReturnsByRefReadonly; 327RefKind IMethodSymbol.RefKind => _underlying.RefKind; 329bool IMethodSymbol.IsConditional => _underlying.IsConditional; 331DllImportData IMethodSymbol.GetDllImportData() => _underlying.GetDllImportData();
Symbols\PublicModel\NamedTypeSymbol.cs (4)
32ImmutableArray<IMethodSymbol> INamedTypeSymbol.InstanceConstructors 40ImmutableArray<IMethodSymbol> INamedTypeSymbol.StaticConstructors 48ImmutableArray<IMethodSymbol> INamedTypeSymbol.Constructors 107IMethodSymbol INamedTypeSymbol.DelegateInvokeMethod
Symbols\PublicModel\PropertySymbol.cs (2)
51IMethodSymbol IPropertySymbol.GetMethod 56IMethodSymbol IPropertySymbol.SetMethod
Symbols\PublicModel\TypeParameterSymbol.cs (1)
52IMethodSymbol ITypeParameterSymbol.DeclaringMethod
Symbols\Symbol.cs (1)
574/// Even for metadata symbols, <see cref="IsOverride"/> = true does not imply that <see cref="IMethodSymbol.OverriddenMethod"/> will
Symbols\SymbolExtensions.cs (5)
569internal static IMethodSymbol? GetPublicSymbol(this MethodSymbol? symbol) 571return symbol.GetPublicSymbol<IMethodSymbol>(); 744internal static ImmutableArray<IMethodSymbol> GetPublicSymbols(this ImmutableArray<MethodSymbol> symbols) 746return GetPublicSymbols<IMethodSymbol>(StaticCast<Symbol>.From(symbols)); 808internal static MethodSymbol? GetSymbol(this IMethodSymbol? symbol)
Microsoft.CodeAnalysis.CSharp.CodeStyle (113)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (2)
77var entryPointMethod = semanticModel.Compilation.GetEntryPoint(cancellationToken); 81var thisMethod = semanticModel.GetDeclaredSymbol(methodDeclaration);
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
304if (initializerSymbol is IMethodSymbol)
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
88if (context.OwningSymbol is IMethodSymbol { MethodKind: MethodKind.Constructor })
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (10)
46var methodToDiagnostic = PooledDictionary<IMethodSymbol, Diagnostic>.GetInstance(); 83if (member is not IMethodSymbol method) 102SymbolAnalysisContext context, ReportDiagnostic severity, PooledDictionary<IMethodSymbol, Diagnostic> methodToDiagnostic) 135Dictionary<IMethodSymbol, Diagnostic> methodToDiagnostic) 139if (context.OwningSymbol is not IMethodSymbol owningMethod) 172IMethodSymbol owningMethod, 217IMethodSymbol owningMethod, 265IMethodSymbol owningMethod, 376IMethodSymbol owningMethod, 378IMethodSymbol methodReference)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (7)
131if (lambdaSymbolInfo.Symbol is not IMethodSymbol lambdaMethod) 135if (invokedSymbolInfo.Symbol is not IMethodSymbol invokedMethod) 211if (rewrittenSymbolInfo.Symbol is not IMethodSymbol rewrittenMethod || 251var method1 = semanticModel1.GetSymbolInfo(node1, cancellationToken).Symbol as IMethodSymbol; 252var method2 = semanticModel2.GetSymbolInfo(node2, cancellationToken).Symbol as IMethodSymbol;
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
32protected override bool MethodHasHandlesClause(IMethodSymbol method)
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (3)
150protected override ExpressionSyntax? GetGetterExpression(IMethodSymbol getMethod, CancellationToken cancellationToken) 167private static ExpressionSyntax? GetGetterExpressionFromSymbol(IMethodSymbol getMethod, CancellationToken cancellationToken) 184IMethodSymbol setMethod, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
125if (createSymbol is not IMethodSymbol { IsStatic: true } createMethod)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (12)
325var capacityConstructor = GetAccessibleInstanceConstructor(constructors, c => c.Parameters is [{ Name: "capacity", Type.SpecialType: SpecialType.System_Int32 }]); 329var noArgConstructor = 348IMethodSymbol? GetAccessibleInstanceConstructor(ImmutableArray<IMethodSymbol> constructors, Func<IMethodSymbol, bool> predicate) 350var constructor = constructors.FirstOrDefault(c => !c.IsStatic && predicate(c)); 434if (semanticModel.GetSymbolInfo(invocationExpression, cancellationToken).Symbol is not IMethodSymbol method) 457if (methodOrProperty is not IMethodSymbol and not IPropertySymbol) 552if (parameter.ContainingSymbol is not IMethodSymbol method) 962if (semanticModel.GetSymbolInfo(memberAccessExpression, cancellationToken).Symbol is not IMethodSymbol { IsStatic: true } createMethod) 996IMethodSymbol originalCreateMethod, 1175if (emptySymbol is not IMethodSymbol)
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (1)
58if (this.SemanticModel.GetSymbolInfo(_objectCreationExpression, cancellationToken).Symbol is not IMethodSymbol
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForLocalFunctionHelper.cs (2)
60var symbol = semanticModel.GetDeclaredSymbol(statement); 61return symbol is IMethodSymbol methodSymbol &&
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (1)
60var method = semanticModel.GetDeclaredSymbol(declaration);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (2)
161IMethodSymbol? targetMethod, 215private static IPropertySymbol? TryGetLengthLikeProperty(InfoCache infoCache, IMethodSymbol? targetMethod)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (4)
35private readonly ConcurrentDictionary<IMethodSymbol, MemberInfo> _methodToMemberInfo = new(); 56public bool TryGetMemberInfo(IMethodSymbol methodSymbol, out MemberInfo memberInfo) 68private MemberInfo ComputeMemberInfo(IMethodSymbol method) 96var overloadedIndexMethod = GetOverload(method, IndexType);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (5)
124var targetMethod = invocation.TargetMethod; 151var targetMethod = invocation.TargetMethod; 163IMethodSymbol targetMethod) 212IMethodSymbol targetMethod) 240private static bool IsValidIndexing(IInvocationOperation invocation, InfoCache infoCache, IMethodSymbol targetMethod)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (13)
31private readonly ConcurrentDictionary<IMethodSymbol, MemberInfo> _methodToMemberInfo = new(); 46var substringMethod = stringType.GetMembers(nameof(string.Substring)) 47.OfType<IMethodSymbol>() 69private static IMethodSymbol? GetSliceLikeMethod(INamedTypeSymbol namedType) 71.OfType<IMethodSymbol>() 75public bool TryGetMemberInfo(IMethodSymbol method, out MemberInfo memberInfo) 87public bool TryGetMemberInfoOneArgument(IMethodSymbol method, out MemberInfo memberInfo) 101var overloadWithTwoArguments = method.ContainingType 103.OfType<IMethodSymbol>() 122private MemberInfo ComputeMemberInfo(IMethodSymbol sliceLikeMethod, bool requireRangeMember) 156var actualSliceMethod = 158.OfType<IMethodSymbol>() 168var overloadedRangeMethod = GetOverload(sliceLikeMethod, RangeType);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.Result.cs (2)
26IMethodSymbol sliceLikeMethod, 34public readonly IMethodSymbol SliceLikeMethod = sliceLikeMethod;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (6)
68public static bool IsIntIndexingMethod(IMethodSymbol method) 84public static bool IsTwoArgumentSliceLikeMethod(IMethodSymbol method) 102public static bool IsOneArgumentSliceLikeMethod(IMethodSymbol method) 142public static IMethodSymbol? GetOverload(IMethodSymbol method, ITypeSymbol parameterType) 146.OfType<IMethodSymbol>()
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\MemberInfo.cs (2)
11IMethodSymbol? overloadedMethodOpt) 23public readonly IMethodSymbol? OverloadedMethodOpt = overloadedMethodOpt;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
288if (!TryFindPrimaryConstructorCandidate(namedType, out var primaryConstructor, out var primaryConstructorDeclaration)) 341[NotNullWhen(true)] out IMethodSymbol? primaryConstructor, 349foreach (var constructor in constructors)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (5)
102if (semanticModel.GetSymbolInfo(memberName, cancellationToken).Symbol is not IMethodSymbol methodSymbol) 116private static bool IsPossibleCreationOrConversionMethod(IMethodSymbol methodSymbol, 141private static bool IsPossibleCreationMethod(IMethodSymbol methodSymbol, 157private static bool IsPossibleConversionMethod(IMethodSymbol methodSymbol) 173private static bool IsContainerTypeEqualToReturnType(IMethodSymbol methodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (2)
376if (symbol is IMethodSymbol 541return symbolInfo.GetBestOrAllSymbols().Any() && !symbolInfo.GetBestOrAllSymbols().Any(static s => s is IMethodSymbol);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
40public static bool TryGetPrimaryConstructor(this INamedTypeSymbol typeSymbol, [NotNullWhen(true)] out IMethodSymbol? primaryConstructor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (3)
439if (semanticModel.GetSymbolInfo(argumentList.Parent, cancellationToken).Symbol is IMethodSymbol member && index < member.Parameters.Length) 462public static IMethodSymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, ConstructorDeclarationSyntax syntax, CancellationToken cancellationToken) 468public static IMethodSymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, LocalFunctionStatementSyntax syntax, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
824if (symbol is IMethodSymbol method &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (11)
67if (symbol is IMethodSymbol { MethodKind: MethodKind.Conversion }) 190public IMethodSymbol? GetGetAwaiterMethod(SemanticModel semanticModel, SyntaxNode node) 201public ImmutableArray<IMethodSymbol> GetDeconstructionAssignmentMethods(SemanticModel semanticModel, SyntaxNode node) 205using var builder = TemporaryArray<IMethodSymbol>.Empty; 213public ImmutableArray<IMethodSymbol> GetDeconstructionForEachMethods(SemanticModel semanticModel, SyntaxNode node) 217using var builder = TemporaryArray<IMethodSymbol>.Empty; 225private static void FlattenDeconstructionMethods(DeconstructionInfo deconstruction, ref TemporaryArray<IMethodSymbol> builder) 227var method = deconstruction.Method; 381public ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken) 383using var _ = ArrayBuilder<IMethodSymbol>.GetInstance(out var builder); 392if (localFunctionSymbol is IMethodSymbol methodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (8)
679if (memberSymbol is not IMethodSymbol methodSymbol) 686for (var current = methodSymbol; current != null; current = current.OverriddenMethod) 921if (sym is IMethodSymbol { MethodKind: MethodKind.UserDefinedOperator } op) 1136if (oldSymbolInfo is IMethodSymbol method && 1307if (originalMemberSymbol is not IMethodSymbol { MethodKind: MethodKind.DelegateInvoke } originalMethodSymbol || 1308rewrittenMemberSymbol is not IMethodSymbol { MethodKind: MethodKind.DelegateInvoke } rewrittenMethodSymbol) 1382if (originalMemberSymbol is IMethodSymbol originalMethodSymbol && 1383rewrittenMemberSymbol is IMethodSymbol rewrittenMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (1)
867protected override void GetForEachSymbols(SemanticModel model, CommonForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
234var method = memberGroup[0] as IMethodSymbol;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (117)
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
57if (semanticModel.GetDeclaredSymbol(constructorDeclaration, cancellationToken) is IMethodSymbol constructorSymbol)
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
71if (semanticModel.GetSymbolInfo(invocationExpression, cancellationToken).Symbol is not IMethodSymbol methodSymbol)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (2)
221var methodSymbol = (IMethodSymbol)semanticModel.GetRequiredDeclaredSymbol(method, cancellationToken);
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (10)
24IMethodSymbol methodSymbol, 45TargetMethod: IMethodSymbol { Name: nameof(Equals) }, 76IMethodSymbol methodSymbol, 375Constructor: IMethodSymbol { IsImplicitlyDeclared: true } 495IMethodSymbol methodSymbol) 1100private static bool OverridesEquals(Compilation compilation, IMethodSymbol equals, INamedTypeSymbol? equatableType) 1103equatableType.GetMembers(nameof(Equals)).FirstOrDefault() is IMethodSymbol equatableEquals && 1110var objectEquals = objectType?.GetMembers(nameof(Equals)).FirstOrDefault() as IMethodSymbol; 1111var curr = equals;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (3)
56.Any(symbol => symbol.SetMethod is IMethodSymbol { IsInitOnly: true }); 159var getAccessor = propertySymbol.GetMethod; 160var setAccessor = propertySymbol.SetMethod;
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (4)
185protected override IMethodSymbol GetCurrentConstructor(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken) 188protected override IMethodSymbol GetDelegatedConstructor(SemanticModel semanticModel, IMethodSymbol constructor, CancellationToken cancellationToken) 193return semanticModel.GetSymbolInfo(constructorDeclarationSyntax.Initializer, cancellationToken).Symbol as IMethodSymbol;
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (6)
60out IMethodSymbol methodSymbol, 86out IMethodSymbol methodSymbol, 111out IMethodSymbol methodSymbol, 139out IMethodSymbol methodSymbol, 170out IMethodSymbol methodSymbol, 196private static IMethodSymbol GenerateMethodSymbol(
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
52out IMethodSymbol methodSymbol,
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
35protected override string ToDisplayString(IMethodSymbol disposeImplMethod, SymbolDisplayFormat format)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
107if (symbol is not IMethodSymbol method || method.ReturnsVoid)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (2)
38var methodSymbol = model.GetDeclaredSymbol(node, cancellationToken) as IMethodSymbol;
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
64var setMethod = propertySymbol.SetMethod;
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (4)
71IMethodSymbol methodSymbol, 87IMethodSymbol methodSymbol, 99IMethodSymbol methodSymbol, 111IMethodSymbol methodSymbol,
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (4)
32protected override SyntaxNode RemoveAsyncTokenAndFixReturnType(IMethodSymbol methodSymbol, SyntaxNode node, KnownTaskTypes knownTypes) 44private static SyntaxNode FixMethod(IMethodSymbol methodSymbol, MethodDeclarationSyntax method, KnownTaskTypes knownTypes) 50private static SyntaxNode FixLocalFunction(IMethodSymbol methodSymbol, LocalFunctionStatementSyntax localFunction, KnownTaskTypes knownTypes) 56private static TypeSyntax FixMethodReturnType(IMethodSymbol methodSymbol, TypeSyntax returnTypeSyntax, KnownTaskTypes knownTypes)
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (2)
216if (symbol is not IMethodSymbol method || method.PartialImplementationPart is not null) 305parameterSymbol.ContainingSymbol is IMethodSymbol method &&
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (5)
155IMethodSymbol delegateMethod, ParameterListSyntax parameterList, bool makeStatic) 200IMethodSymbol delegateMethod, 240SyntaxGenerator generator, AnonymousFunctionExpressionSyntax anonymousFunction, IMethodSymbol delegateMethod) 284private static InvocationExpressionSyntax WithNewParameterNames(InvocationExpressionSyntax invocation, IMethodSymbol method, ParameterListSyntax newParameterList) 309private static int TryDetermineParameterIndex(NameColonSyntax argumentNameColon, IMethodSymbol method)
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
278IMethodSymbol or IPropertySymbol or IEventSymbol or IFieldSymbol =>
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (2)
67IMethodSymbol constructor, 165IMethodSymbol constructor,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (5)
28IMethodSymbol constructor, 44IMethodSymbol constructor, 90IMethodSymbol constructor) 108IMethodSymbol constructor) 117private static SyntaxTokenList GenerateModifiers(IMethodSymbol constructor, CSharpCodeGenerationContextInfo info)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConversionGenerator.cs (3)
23IMethodSymbol method, 35IMethodSymbol method, 46IMethodSymbol method,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (4)
115protected override TDeclarationNode AddMethod<TDeclarationNode>(TDeclarationNode destination, IMethodSymbol method, CSharpCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) 199var getMethod = property.GetMethod; 214var setMethod = property.SetMethod; 649IMethodSymbol method, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\DestructorGenerator.cs (3)
26IMethodSymbol destructor, 42IMethodSymbol destructor, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken) 66IMethodSymbol constructor)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (4)
154IMethodSymbol? accessor, 166IMethodSymbol accessor, 175private static BlockSyntax GenerateBlock(IMethodSymbol accessor) 184IMethodSymbol? accessor)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (12)
31IMethodSymbol method, 44IMethodSymbol method, 59IMethodSymbol method, 74IMethodSymbol method, CodeGenerationDestination destination, 92IMethodSymbol method, 111IMethodSymbol method, CodeGenerationDestination destination, 140IMethodSymbol method, CodeGenerationDestination destination, 195IMethodSymbol method, CSharpCodeGenerationContextInfo info, bool isExplicit) 209IMethodSymbol method) 216private static SyntaxList<TypeParameterConstraintClauseSyntax> GenerateDefaultConstraints(IMethodSymbol method) 249IMethodSymbol method, CSharpCodeGenerationContextInfo info) 255IMethodSymbol method, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (2)
112var primaryConstructor = members.OfType<IMethodSymbol>().FirstOrDefault(m => CodeGenerationConstructorInfo.GetIsPrimaryConstructor(m)); 230var invokeMethod = namedType.DelegateInvokeMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (4)
25IMethodSymbol method, 37IMethodSymbol method, 74IMethodSymbol method, 109private static SyntaxTokenList GenerateModifiers(IMethodSymbol method, CodeGenerationDestination destination, bool hasNoBody)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
82parameter.ContainingSymbol is IMethodSymbol methodSymbol &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (5)
278IMethodSymbol? accessor, 292IMethodSymbol accessor, 308private static BlockSyntax GenerateBlock(IMethodSymbol accessor) 317IMethodSymbol? accessor) 327IMethodSymbol accessor,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\StatementGenerator.cs (1)
18internal static BlockSyntax GenerateBlock(IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (2)
120if (member is IMethodSymbol method && method.IsExtensionMethod) 229if (symbol is IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (4)
1035IMethodSymbol m => m.Arity > 0, 1043return symbols.All(static s => s is INamedTypeSymbol or IMethodSymbol); 2011while (enclosingSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction or MethodKind.AnonymousFunction } method) 2832if (symbol is IMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeSyntaxExtensions.cs (1)
55public static TypeSyntax GenerateReturnTypeSyntax(this IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (1)
122public IMethodSymbol? TryGetDisposeMethod(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (14)
112if (allSymbols is [IMethodSymbol method]) 388var methods = info.GetBestOrAllSymbols().OfType<IMethodSymbol>(); 460var methods = info.GetBestOrAllSymbols().OfType<IMethodSymbol>(); 468argumentOpt == null && info.Symbol is IMethodSymbol method && method.Parameters.All(p => p.IsOptional || p.IsParams)) 472.OfType<IMethodSymbol>(); 543var methods = info.GetBestOrAllSymbols().OfType<IMethodSymbol>(); 572private IEnumerable<TypeInferenceInfo> InferTypeInAttributeArgument(int index, IEnumerable<IMethodSymbol> methods, AttributeArgumentSyntax argumentOpt = null) 575private IEnumerable<TypeInferenceInfo> InferTypeInArgument(int index, IEnumerable<IMethodSymbol> methods, ArgumentSyntax argumentOpt, InvocationExpressionSyntax parentInvocationExpressionToTypeInfer) 600private static IMethodSymbol Instantiate(IMethodSymbol method, IList<ITypeSymbol> invocationTypes) 1297.Cast<IMethodSymbol>() 1315.Cast<IMethodSymbol>() 1405var addMethodParameterTypes = addMethodSymbols.Select(m => ((IMethodSymbol)m).Parameters[0]).Select(p => new TypeInferenceInfo(p.Type)); 2028var isAsync = symbol is IMethodSymbol methodSymbol && methodSymbol.IsAsync;
Microsoft.CodeAnalysis.CSharp.EditorFeatures (5)
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (2)
323var generatedMethodSymbol = GetMethodSymbol(document, eventHandlerMethodName, eventHookupExpression, cancellationToken); 336private static IMethodSymbol? GetMethodSymbol(
GoToBase\CSharpGoToBaseService.cs (3)
26protected override async Task<IMethodSymbol?> FindNextConstructorInChainAsync( 27Solution solution, IMethodSymbol constructor, CancellationToken cancellationToken) 41return semanticModel.GetSymbolInfo(constructorDeclaration.Initializer, cancellationToken).GetAnySymbol() as IMethodSymbol;
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (19)
PdbSourceDocument\PdbSourceDocumentTests.cs (1)
105await TestAsync(pdbLocation, sourceLocation, source, c => c.GetMember<IMethodSymbol>("C.M").Parameters.First());
SymbolKey\SymbolKeyCompilationsTests.cs (6)
132var definition = type.GetMembers("M").First() as IMethodSymbol; 133var implementation = definition.PartialImplementationPart; 159var definition = type.GetMembers("M").First() as IMethodSymbol; 160var implementation = definition.PartialImplementationPart;
SymbolKey\SymbolKeyMetadataVsSourceTests.cs (7)
83var member04 = (typesym.GetMembers("M").Single() as IMethodSymbol).Parameters[0].Type; 240var mem20_1 = typeA.GetMembers("GetFileInfo").Single() as IMethodSymbol; 241var mem20_2 = typeA.GetMembers("PrintInfo").Single() as IMethodSymbol; 255var mem40 = typeTest.GetMembers("Main").Single() as IMethodSymbol;
SymbolKey\SymbolKeyTestBase.cs (3)
124internal static List<BlockSyntax> GetBlockSyntaxList(IMethodSymbol symbol) 231var method = (IMethodSymbol)memberSymbol;
SymbolKey\SymbolKeyTests.cs (2)
169var method = type.GetMembers("GetValue").OfType<IMethodSymbol>().Single();
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (70)
CodeGen\CodeGenAsyncMainTests.cs (9)
603var entry = compilation.GetEntryPoint(CancellationToken.None); 625var entry = compilation.GetEntryPoint(CancellationToken.None); 714var entry = compilation.GetEntryPoint(CancellationToken.None); 791var entry = compilation.GetEntryPoint(CancellationToken.None); 841var entry = compilation.GetEntryPoint(CancellationToken.None); 885var entry = compilation.GetEntryPoint(CancellationToken.None); 905var entry = compilation.GetEntryPoint(CancellationToken.None); 969var entry = compilation.GetEntryPoint(CancellationToken.None); 989var entry = compilation.GetEntryPoint(CancellationToken.None);
CodeGen\CodeGenFunctionPointersTests.cs (3)
7420var lambdaSymbol = (IMethodSymbol)info.Symbol!; 9827var method = comp.GetEntryPoint(System.Threading.CancellationToken.None);
CodeGen\CodeGenLocalFunctionTests.cs (16)
23public static IMethodSymbol FindLocalFunction(this CompilationVerifier verifier, string localFunctionName) 27IMethodSymbol result = null; 2593var goo = verify.FindLocalFunction("Goo"); 2610var goo = verify.FindLocalFunction("Goo"); 2717var outer = verify.FindLocalFunction("Outer"); 2718var inner = verify.FindLocalFunction("Inner"); 3132var goo = verify.FindLocalFunction("Goo"); 3157var goo = verify.FindLocalFunction("Goo"); 3158var bar = verify.FindLocalFunction("Bar"); 3201var inner = verify.FindLocalFunction("Inner"); 3202var middle = verify.FindLocalFunction("Middle"); 3203var outer = verify.FindLocalFunction("Outer"); 3275var goo = verify.FindLocalFunction("Goo"); 3310var goo = verify.FindLocalFunction("Goo"); 3311var bar = verify.FindLocalFunction("Bar"); 4239var goo = verify.FindLocalFunction("Local");
CodeGen\CodeGenTupleTest.cs (34)
14231var m1Tuple = (INamedTypeSymbol)test.GetMember<IMethodSymbol>("M1").ReturnType; 14236m1Tuple = (INamedTypeSymbol)test.GetMember<IMethodSymbol>("M1").Parameters[0].Type; 14247m1Tuple = (INamedTypeSymbol)((IMethodSymbol)symbolInfo.Symbol).ReturnType; 14254m1Tuple = (INamedTypeSymbol)((IMethodSymbol)symbolInfo.Symbol).Parameters[0].Type; 14263var m2Tuple = (INamedTypeSymbol)((IMethodSymbol)symbolInfo.Symbol).ReturnType; 14298var m3TupleArray = (IArrayTypeSymbol)test.GetMember<IMethodSymbol>("M3").ReturnType; 14308m3TupleArray = (IArrayTypeSymbol)((IMethodSymbol)symbolInfo.Symbol).ReturnType; 14316var m4TupleList = (INamedTypeSymbol)test.GetMember<IMethodSymbol>("M4").ReturnType; 14326m4TupleList = (INamedTypeSymbol)((IMethodSymbol)symbolInfo.Symbol).ReturnType; 14333var m5Tuple = ((IMethodSymbol)symbolInfo.Symbol).TypeParameters[0].ConstraintTypes.Single(); 14340var m6Method = (IMethodSymbol)symbolInfo.Symbol; 14442var m5TuplePointer = (IPointerTypeSymbol)test.GetMember<IMethodSymbol>("M5").ReturnType; 14449m5TuplePointer = (IPointerTypeSymbol)((IMethodSymbol)symbolInfo.Symbol).ReturnType; 19662Assert.Equal("(System.Int32 a, System.Int32)", ((IMethodSymbol)invocation1.Symbol).ReturnType.ToTestDisplayString()); 19665Assert.Equal("(System.Int32, System.Int32)", ((IMethodSymbol)invocation2.Symbol).ReturnType.ToTestDisplayString()); 19668Assert.Equal("(System.Int32, System.Int32)[]", ((IMethodSymbol)invocation3.Symbol).ReturnType.ToTestDisplayString()); 20502var cMabImplementations = ((IMethodSymbol)members[0]).ExplicitInterfaceImplementations; 20505var cMcdImplementations = ((IMethodSymbol)members[1]).ExplicitInterfaceImplementations; 20718var cMabImplementations = ((IMethodSymbol)members[0]).ExplicitInterfaceImplementations; 20721var cMcdImplementations = ((IMethodSymbol)members[1]).ExplicitInterfaceImplementations; 20763var cMabImplementations = ((IMethodSymbol)c.GetMember("I1<System.ValueTuple<T,T>>.M")).ExplicitInterfaceImplementations; 20766var cMcdImplementations = ((IMethodSymbol)c.GetMember("I1<System.ValueTuple<U,U>>.M")).ExplicitInterfaceImplementations; 23504var m = (IMethodSymbol)(comp.Compilation.GetTypeByMetadataName("ConsoleApplication5.C2").GetMembers("Goo").First()); 23507var b = m.OverriddenMethod; 26297var doSymbol = (IMethodSymbol)model.GetSymbolInfo(doSyntax).Symbol; 26330var doSymbol = (IMethodSymbol)model.GetSymbolInfo(doSyntax).Symbol; 26363var doSymbol = (IMethodSymbol)model.GetSymbolInfo(doSyntax).Symbol; 26396var doSymbol = (IMethodSymbol)model.GetSymbolInfo(doSyntax).Symbol;
CodeGen\IndexAndRangeTests.cs (6)
37private static void VerifyIndexCall(IMethodSymbol symbol, string methodName, string containingTypeName) 883var substringCall = (IMethodSymbol)info.Symbol; 885var sliceCall = (IMethodSymbol)info.Symbol; 921VerifyIndexCall((IMethodSymbol)model.GetSymbolInfo(accesses[0]).Symbol, "Slice", "Span");
Emit\InAttributeModifierTests.cs (2)
50var m = (IMethodSymbol)comp.GetMember("TestRef.M");
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (10)
Emit\EditAndContinue\EditAndContinueClosureTests.cs (3)
71Edit(SemanticEditKind.Update, c => c.GetMembers<IMethodSymbol>("C.F").Single(m => m.Parameters is []), preserveLocalVariables: true), 72Edit(SemanticEditKind.Update, c => c.GetMembers<IMethodSymbol>("C.F").Single(m => m.Parameters is [_]), preserveLocalVariables: true), 73Edit(SemanticEditKind.Update, c => c.GetMembers<IMethodSymbol>("C.F").Single(m => m.Parameters is [_, _]), preserveLocalVariables: true),
Emit\EditAndContinue\EditAndContinueStateMachineTests.cs (3)
648Edit(SemanticEditKind.Update, c => c.GetMembers<IMethodSymbol>("C.F").Single(m => m.ToTestDisplayString() == "System.Threading.Tasks.Task<System.Int32> C.F(System.Int16 a)"), preserveLocalVariables: true), 649Edit(SemanticEditKind.Update, c => c.GetMembers<IMethodSymbol>("C.F").Single(m => m.ToTestDisplayString() == "System.Threading.Tasks.Task<System.Int32> C.F(System.Int32 a)"), preserveLocalVariables: true), 650Edit(SemanticEditKind.Update, c => c.GetMembers<IMethodSymbol>("C.F").Single(m => m.ToTestDisplayString() == "System.Threading.Tasks.Task<System.Int32> C.F(System.Int64 a)"), preserveLocalVariables: true),
Emit\LocalStateTracing\LocalStateTracingTests.cs (4)
434var f0 = (IMethodSymbol)compilation0.GetMember("C.F").GetPublicSymbol(); 435var f1 = (IMethodSymbol)compilation1.GetMember("C.F").GetPublicSymbol();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (21)
Attributes\AttributeTests.cs (1)
710var m0 = semanticModel.GetDeclaredSymbol(root.DescendantNodes().OfType<MethodDeclarationSyntax>().Last());
Diagnostics\DiagnosticAnalyzerTests.cs (2)
840var method = ((IMethodSymbol)ctxt.Symbol);
OverloadResolutionPriorityTests.cs (4)
445var method = (IMethodSymbol)model.GetSymbolInfo(invocation).Symbol!; 700var method = (IMethodSymbol)model.GetSymbolInfo(invocation).Symbol!;
RefReadonlyParameterTests.cs (4)
7105var methodFromCref = info.Symbol as IMethodSymbol; 7133var methodFromCref = info.Symbol as IMethodSymbol;
Semantics\PrimaryConstructorTests.cs (10)
20468var primaryConstructor = symbols.OfType<IMethodSymbol>().Single(); 20502var primaryConstructor1 = symbols1.OfType<IMethodSymbol>().Single(); 20546var primaryConstructor1 = symbols1.OfType<IMethodSymbol>().Single(); 20601var primaryConstructor2 = symbols2.OfType<IMethodSymbol>().Single(); 20643var primaryConstructor1 = symbols1.OfType<IMethodSymbol>().Single();
Microsoft.CodeAnalysis.CSharp.Features (271)
AddImport\CSharpAddImportFeatureService.cs (1)
601protected override bool IsViableExtensionMethod(IMethodSymbol method, SyntaxNode expression, SemanticModel semanticModel, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken)
ChangeSignature\CSharpChangeSignatureService.cs (3)
426symbolInfo.Symbol is IMethodSymbol { MethodKind: MethodKind.ReducedExtension }, 852IMethodSymbol symbol, 922protected override bool TryGetRecordPrimaryConstructor(INamedTypeSymbol typeSymbol, [NotNullWhen(true)] out IMethodSymbol? primaryConstructor)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (3)
117var methodSymbol = CodeGenerationSymbolFactory.CreateMethodSymbol( 163var symbol = semanticModel.GetSymbolInfo(node, cancellationToken).Symbol as IMethodSymbol;
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
197if (semanticModel.GetSymbolInfo(o, cancellationToken).Symbol is IMethodSymbol { IsConditional: true })
Completion\CompletionProviders\CrefCompletionProvider.cs (1)
303(symbol is IMethodSymbol && groupCount >= 2))
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (5)
134.OfType<IMethodSymbol>() 302foreach (var overload in overloads) 317static ImmutableArray<IMethodSymbol> GetOverloads(INamedTypeSymbol namedType, BaseMethodDeclarationSyntax baseMethod) 321MethodDeclarationSyntax method => namedType.GetMembers(method.Identifier.ValueText).OfType<IMethodSymbol>().ToImmutableArray(), 322ConstructorDeclarationSyntax constructor => namedType.GetMembers(WellKnownMemberNames.InstanceConstructorName).OfType<IMethodSymbol>().ToImmutableArray(),
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.CompletionSymbolDisplay.cs (4)
22IMethodSymbol methodSymbol => ToDisplayString(methodSymbol), 52private static string ToDisplayString(IMethodSymbol symbol) 77static void AppendOperatorKeywords(IMethodSymbol symbol, StringBuilder builder) 109private static void AddTypeArguments(IMethodSymbol symbol, StringBuilder builder)
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (1)
257var methodGroup = semanticModel.GetMemberGroup(invocationExpression.Expression, cancellationToken).OfType<IMethodSymbol>();
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (1)
138AddConversion(context, semanticModel, position, (IMethodSymbol)symbol);
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (2)
40private static void AddConversion(CompletionContext context, SemanticModel semanticModel, int position, IMethodSymbol conversion) 60CompletionContext context, IMethodSymbol conversion)
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (3)
36protected override bool IncludeAccessibility(IMethodSymbol method, CancellationToken cancellationToken) 82protected override bool IsPartial(IMethodSymbol method) 140protected override string GetDisplayText(IMethodSymbol method, SemanticModel semanticModel, int position)
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
248semanticModel.GetSymbolInfo(memberAccessExpression, cancellationToken).Symbol is IMethodSymbol methodSymbol &&
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (3)
302if (_semanticModel.GetSymbolInfo(invocationExpression, _cancellationToken).Symbol is IMethodSymbol methodSymbol && 341if (_semanticModel.GetSymbolInfo(invocationExpression, _cancellationToken).Symbol is IMethodSymbol methodSymbol && 741if (declaredSymbol is not IMethodSymbol methodSymbol)
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (1)
72IMethodSymbol mainMethod,
Debugging\BreakpointResolver.cs (1)
33protected override bool HasMethodBody(IMethodSymbol method, CancellationToken cancellationToken)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (19)
184=> member is IMethodSymbol { AssociatedSymbol: IPropertySymbol property } && property.IsSynthesizedAutoProperty(); 186protected override bool AreHandledEventsEqual(IMethodSymbol oldMethod, IMethodSymbol newMethod) 947if (symbol is not IMethodSymbol { MethodKind: MethodKind.Constructor or MethodKind.StaticConstructor } method) 1004IMethodSymbol 1267static bool DiffersInReadOnlyModifier(IMethodSymbol? oldMethod, IMethodSymbol? newMethod) 1339var oldGetterSymbol = ((IPropertySymbol?)oldSymbol)?.GetMethod; 1340var newGetterSymbol = ((IPropertySymbol?)newSymbol)?.GetMethod; 1498internal override IMethodSymbol GetLambdaExpressionSymbol(SemanticModel model, SyntaxNode lambdaExpression, CancellationToken cancellationToken) 1501return (IMethodSymbol)model.GetRequiredEnclosingSymbol(bodyExpression.SpanStart, cancellationToken); 1543return GroupBySignatureEquivalent(oldGroupInfo.Symbol as IMethodSymbol, newGroupInfo.Symbol as IMethodSymbol); 1550private static bool GroupBySignatureEquivalent(IMethodSymbol? oldMethod, IMethodSymbol? newMethod) 1984internal override string GetDisplayName(IMethodSymbol symbol) 2548IMethodSymbol { MethodKind: MethodKind.Destructor } 2552IMethodSymbol { MethodKind: MethodKind.Conversion or MethodKind.UserDefinedOperator } 2556IMethodSymbol { ExplicitInterfaceImplementations.IsEmpty: false }
ExternalAccess\Pythia\Api\IPythiaSignatureHelpProviderImplementation.cs (1)
14Task<(ImmutableArray<PythiaSignatureHelpItemWrapper> items, int? selectedItemIndex)> GetMethodGroupItemsAndSelectionAsync(ImmutableArray<IMethodSymbol> accessibleMethods, Document document, InvocationExpressionSyntax invocationExpression, SemanticModel semanticModel, SymbolInfo currentSymbol, CancellationToken cancellationToken);
ExternalAccess\Pythia\Api\PythiaSignatureHelpItemWrapper.cs (1)
20IMethodSymbol method,
ExternalAccess\Pythia\PythiaSignatureHelpProvider.cs (2)
31ImmutableArray<IMethodSymbol> accessibleMethods, 36IMethodSymbol? currentSymbol,
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (5)
94protected override IMethodSymbol GenerateMethodDefinition( 100var methodSymbol = CodeGenerationSymbolFactory.CreateMethodSymbol( 590if (AnalyzerResult.ReturnType.GetMembers().Any(static x => x is IMethodSymbol 707IMethodSymbol methodSymbol, 771IMethodSymbol methodSymbol,
ExtractMethod\CSharpSelectionResult.StatementResult.cs (2)
86return semanticModel.GetDeclaredSymbol(methodDeclaration) is not IMethodSymbol method 93return semanticModel.GetSymbolInfo(function).Symbol is not IMethodSymbol method
GenerateType\CSharpGenerateTypeService.cs (5)
78if (symbol is IMethodSymbol method) 446private static IMethodSymbol GetMethodSymbolIfPresent(SemanticModel semanticModel, ExpressionSyntax expression, CancellationToken cancellationToken) 456return memberGroup.ElementAt(0).IsKind(SymbolKind.Method) ? (IMethodSymbol)memberGroup.ElementAt(0) : null; 468return (IMethodSymbol)expressionSymbol; 828private static readonly IMethodSymbol s_accessor = CodeGenerationSymbolFactory.CreateAccessorSymbol(
ImplementInterface\CSharpImplementExplicitlyCodeRefactoringProvider.cs (2)
154if (implMember is IMethodSymbol { Parameters: var implParameters } && 155interfaceMember is IMethodSymbol { Parameters: var interfaceParameters })
InitializeParameter\CSharpInitializeMemberFromParameterCodeRefactoringProvider.cs (1)
58protected override SyntaxNode? GetAccessorBody(IMethodSymbol accessor, CancellationToken cancellationToken)
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (1)
59if (parameter.ContainingSymbol is not IMethodSymbol { MethodKind: MethodKind.Constructor } constructor)
InitializeParameter\InitializeParameterHelpers.cs (1)
147public static SyntaxNode? GetAccessorBody(IMethodSymbol accessor, CancellationToken cancellationToken)
InlineHints\CSharpInlineTypeHintsService.cs (1)
82if (parameter?.ContainingSymbol is IMethodSymbol { MethodKind: MethodKind.AnonymousFunction } &&
IntroduceParameter\CSharpIntroduceParameterCodeRefactoringProvider.cs (1)
38protected override bool IsDestructor(IMethodSymbol methodSymbol)
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
73var method = document.SemanticModel.GetDeclaredSymbol(arrowExpression.Parent, cancellationToken) as IMethodSymbol;
LanguageServices\CSharpSymbolDisplayService.SymbolDescriptionBuilder.cs (1)
196if (symbol is IMethodSymbol method && method.ContainingSymbol.IsKind(SymbolKind.Method))
NavigationBar\CSharpNavigationBarItemService.cs (5)
76if (member is IMethodSymbol { PartialImplementationPart: { } } methodSymbol) 86else if (member is IMethodSymbol or IPropertySymbol) 88Debug.Assert(member is IMethodSymbol { PartialDefinitionPart: null } or IPropertySymbol { PartialDefinitionPart: null }, 183var method = (IMethodSymbol)member;
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (2)
245var setMethod = getAndSetMethods.SetMethod; 251var getMethod = getAndSetMethods.GetMethod;
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (4)
82var getMethod = property.GetMethod; 92var setMethod = property.SetMethod; 110IMethodSymbol setMethod, 168IMethodSymbol getMethod,
SignatureHelp\AbstractCSharpSignatureHelpProvider.cs (1)
67protected IList<TaggedText> GetAwaitableUsage(IMethodSymbol method, SemanticModel semanticModel, int position)
SignatureHelp\AbstractOrdinaryMethodSignatureHelpProvider.cs (3)
18IMethodSymbol method, 27IMethodSymbol method, 48IMethodSymbol method,
SignatureHelp\AttributeSignatureHelpProvider.cs (3)
129IMethodSymbol constructor, 158IMethodSymbol constructor, 217IMethodSymbol method,
SignatureHelp\ConstructorInitializerSignatureHelpProvider.cs (2)
133IMethodSymbol constructor, 153IMethodSymbol method,
SignatureHelp\GenericNameSignatureHelpProvider.cs (3)
122.WhereAsArray(s => s is INamedTypeSymbol or IMethodSymbol) 192var method = (IMethodSymbol)symbol;
SignatureHelp\GenericNameSignatureHelpProvider_Method.cs (3)
13IMethodSymbol method, 61private static ITypeSymbol? GetContainingType(IMethodSymbol method) 74private static IList<SymbolDisplayPart> GetPostambleParts(IMethodSymbol method, SemanticModel semanticModel, int position)
SignatureHelp\InvocationExpressionSignatureHelpProvider.cs (2)
92.OfType<IMethodSymbol>() 130IMethodSymbol? currentSymbol;
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_DelegateAndFunctionPointerInvoke.cs (5)
18private static IMethodSymbol? GetDelegateInvokeMethod( 22var invokeMethod = delegateType.DelegateInvokeMethod; 39private static IList<SignatureHelpItem> GetDelegateOrFunctionPointerInvokeItems(InvocationExpressionSyntax invocationExpression, IMethodSymbol invokeMethod, SemanticModel semanticModel, IStructuralTypeDisplayService structuralTypeDisplayService, IDocumentationCommentFormattingService documentationCommentFormattingService, out int? selectedItem, CancellationToken cancellationToken) 58private static IList<SymbolDisplayPart> GetDelegateOrFunctionPointerInvokePreambleParts(IMethodSymbol invokeMethod, SemanticModel semanticModel, int position) 80IMethodSymbol invokeMethod, SemanticModel semanticModel, int position, IDocumentationCommentFormattingService formattingService, CancellationToken cancellationToken)
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (10)
21ImmutableArray<IMethodSymbol> accessibleMethods, 26IMethodSymbol? currentSymbol, 35private static ImmutableArray<IMethodSymbol> GetAccessibleMethods( 39IEnumerable<IMethodSymbol> methodGroup, 75methodGroup = methodGroup.Where(m => m.IsStatic || m is IMethodSymbol { MethodKind: MethodKind.LocalFunction }); 88private static bool IsHiddenByOtherMethod(IMethodSymbol method, ISet<IMethodSymbol> methodSet) 90foreach (var m in methodSet) 104private static bool IsHiddenBy(IMethodSymbol method1, IMethodSymbol method2)
SignatureHelp\LightweightOverloadResolution.cs (10)
25public (IMethodSymbol? method, int parameterIndex) RefineOverloadAndPickParameter(SymbolInfo symbolInfo, ImmutableArray<IMethodSymbol> candidates) 29return symbolInfo.Symbol is IMethodSymbol method 34public int FindParameterIndexIfCompatibleMethod(IMethodSymbol method) 43private (IMethodSymbol? symbol, int parameterIndex) GuessCurrentSymbolAndParameter(ImmutableArray<IMethodSymbol> methodGroup) 47foreach (var method in methodGroup) 64private (IMethodSymbol? method, int parameterIndex) TryFindParameterIndexIfCompatibleMethod(IMethodSymbol method) 172private bool TryPrepareArgumentToParameterMap(IMethodSymbol method, ref TemporaryArray<int> argumentToParameterMap)
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (1)
122var invokeMethod = type.DelegateInvokeMethod;
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider_DelegateType.cs (3)
17IMethodSymbol invokeMethod, 36private static IList<SymbolDisplayPart> GetDelegateTypePreambleParts(IMethodSymbol invokeMethod, SemanticModel semanticModel, int position) 46private static IList<SignatureHelpSymbolParameter> GetDelegateTypeParameters(IMethodSymbol invokeMethod, SemanticModel semanticModel, int position)
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider_NormalType.cs (2)
19IMethodSymbol constructor, 40IMethodSymbol method,
SignatureHelp\PrimaryConstructorBaseTypeSignatureHelpProvider.cs (2)
121IMethodSymbol constructor, 140IMethodSymbol method,
Snippets\CSharpConsoleSnippetProvider.cs (1)
42if (lambdaSymbol is IMethodSymbol { ReturnType: { SpecialType: SpecialType.System_Void } or { TypeKind: TypeKind.Error } })
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (2)
77var entryPointMethod = semanticModel.Compilation.GetEntryPoint(cancellationToken); 81var thisMethod = semanticModel.GetDeclaredSymbol(methodDeclaration);
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
304if (initializerSymbol is IMethodSymbol)
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
88if (context.OwningSymbol is IMethodSymbol { MethodKind: MethodKind.Constructor })
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (10)
46var methodToDiagnostic = PooledDictionary<IMethodSymbol, Diagnostic>.GetInstance(); 83if (member is not IMethodSymbol method) 102SymbolAnalysisContext context, ReportDiagnostic severity, PooledDictionary<IMethodSymbol, Diagnostic> methodToDiagnostic) 135Dictionary<IMethodSymbol, Diagnostic> methodToDiagnostic) 139if (context.OwningSymbol is not IMethodSymbol owningMethod) 172IMethodSymbol owningMethod, 217IMethodSymbol owningMethod, 265IMethodSymbol owningMethod, 376IMethodSymbol owningMethod, 378IMethodSymbol methodReference)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (7)
131if (lambdaSymbolInfo.Symbol is not IMethodSymbol lambdaMethod) 135if (invokedSymbolInfo.Symbol is not IMethodSymbol invokedMethod) 211if (rewrittenSymbolInfo.Symbol is not IMethodSymbol rewrittenMethod || 251var method1 = semanticModel1.GetSymbolInfo(node1, cancellationToken).Symbol as IMethodSymbol; 252var method2 = semanticModel2.GetSymbolInfo(node2, cancellationToken).Symbol as IMethodSymbol;
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
32protected override bool MethodHasHandlesClause(IMethodSymbol method)
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (3)
150protected override ExpressionSyntax? GetGetterExpression(IMethodSymbol getMethod, CancellationToken cancellationToken) 167private static ExpressionSyntax? GetGetterExpressionFromSymbol(IMethodSymbol getMethod, CancellationToken cancellationToken) 184IMethodSymbol setMethod, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
125if (createSymbol is not IMethodSymbol { IsStatic: true } createMethod)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (12)
325var capacityConstructor = GetAccessibleInstanceConstructor(constructors, c => c.Parameters is [{ Name: "capacity", Type.SpecialType: SpecialType.System_Int32 }]); 329var noArgConstructor = 348IMethodSymbol? GetAccessibleInstanceConstructor(ImmutableArray<IMethodSymbol> constructors, Func<IMethodSymbol, bool> predicate) 350var constructor = constructors.FirstOrDefault(c => !c.IsStatic && predicate(c)); 434if (semanticModel.GetSymbolInfo(invocationExpression, cancellationToken).Symbol is not IMethodSymbol method) 457if (methodOrProperty is not IMethodSymbol and not IPropertySymbol) 552if (parameter.ContainingSymbol is not IMethodSymbol method) 962if (semanticModel.GetSymbolInfo(memberAccessExpression, cancellationToken).Symbol is not IMethodSymbol { IsStatic: true } createMethod) 996IMethodSymbol originalCreateMethod, 1175if (emptySymbol is not IMethodSymbol)
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (1)
58if (this.SemanticModel.GetSymbolInfo(_objectCreationExpression, cancellationToken).Symbol is not IMethodSymbol
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForLocalFunctionHelper.cs (2)
60var symbol = semanticModel.GetDeclaredSymbol(statement); 61return symbol is IMethodSymbol methodSymbol &&
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (1)
60var method = semanticModel.GetDeclaredSymbol(declaration);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (2)
161IMethodSymbol? targetMethod, 215private static IPropertySymbol? TryGetLengthLikeProperty(InfoCache infoCache, IMethodSymbol? targetMethod)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (4)
35private readonly ConcurrentDictionary<IMethodSymbol, MemberInfo> _methodToMemberInfo = new(); 56public bool TryGetMemberInfo(IMethodSymbol methodSymbol, out MemberInfo memberInfo) 68private MemberInfo ComputeMemberInfo(IMethodSymbol method) 96var overloadedIndexMethod = GetOverload(method, IndexType);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (5)
124var targetMethod = invocation.TargetMethod; 151var targetMethod = invocation.TargetMethod; 163IMethodSymbol targetMethod) 212IMethodSymbol targetMethod) 240private static bool IsValidIndexing(IInvocationOperation invocation, InfoCache infoCache, IMethodSymbol targetMethod)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (13)
31private readonly ConcurrentDictionary<IMethodSymbol, MemberInfo> _methodToMemberInfo = new(); 46var substringMethod = stringType.GetMembers(nameof(string.Substring)) 47.OfType<IMethodSymbol>() 69private static IMethodSymbol? GetSliceLikeMethod(INamedTypeSymbol namedType) 71.OfType<IMethodSymbol>() 75public bool TryGetMemberInfo(IMethodSymbol method, out MemberInfo memberInfo) 87public bool TryGetMemberInfoOneArgument(IMethodSymbol method, out MemberInfo memberInfo) 101var overloadWithTwoArguments = method.ContainingType 103.OfType<IMethodSymbol>() 122private MemberInfo ComputeMemberInfo(IMethodSymbol sliceLikeMethod, bool requireRangeMember) 156var actualSliceMethod = 158.OfType<IMethodSymbol>() 168var overloadedRangeMethod = GetOverload(sliceLikeMethod, RangeType);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.Result.cs (2)
26IMethodSymbol sliceLikeMethod, 34public readonly IMethodSymbol SliceLikeMethod = sliceLikeMethod;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (6)
68public static bool IsIntIndexingMethod(IMethodSymbol method) 84public static bool IsTwoArgumentSliceLikeMethod(IMethodSymbol method) 102public static bool IsOneArgumentSliceLikeMethod(IMethodSymbol method) 142public static IMethodSymbol? GetOverload(IMethodSymbol method, ITypeSymbol parameterType) 146.OfType<IMethodSymbol>()
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\MemberInfo.cs (2)
11IMethodSymbol? overloadedMethodOpt) 23public readonly IMethodSymbol? OverloadedMethodOpt = overloadedMethodOpt;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
288if (!TryFindPrimaryConstructorCandidate(namedType, out var primaryConstructor, out var primaryConstructorDeclaration)) 341[NotNullWhen(true)] out IMethodSymbol? primaryConstructor, 349foreach (var constructor in constructors)
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
57if (semanticModel.GetDeclaredSymbol(constructorDeclaration, cancellationToken) is IMethodSymbol constructorSymbol)
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
71if (semanticModel.GetSymbolInfo(invocationExpression, cancellationToken).Symbol is not IMethodSymbol methodSymbol)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (2)
221var methodSymbol = (IMethodSymbol)semanticModel.GetRequiredDeclaredSymbol(method, cancellationToken);
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (10)
24IMethodSymbol methodSymbol, 45TargetMethod: IMethodSymbol { Name: nameof(Equals) }, 76IMethodSymbol methodSymbol, 375Constructor: IMethodSymbol { IsImplicitlyDeclared: true } 495IMethodSymbol methodSymbol) 1100private static bool OverridesEquals(Compilation compilation, IMethodSymbol equals, INamedTypeSymbol? equatableType) 1103equatableType.GetMembers(nameof(Equals)).FirstOrDefault() is IMethodSymbol equatableEquals && 1110var objectEquals = objectType?.GetMembers(nameof(Equals)).FirstOrDefault() as IMethodSymbol; 1111var curr = equals;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (3)
56.Any(symbol => symbol.SetMethod is IMethodSymbol { IsInitOnly: true }); 159var getAccessor = propertySymbol.GetMethod; 160var setAccessor = propertySymbol.SetMethod;
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (4)
185protected override IMethodSymbol GetCurrentConstructor(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken) 188protected override IMethodSymbol GetDelegatedConstructor(SemanticModel semanticModel, IMethodSymbol constructor, CancellationToken cancellationToken) 193return semanticModel.GetSymbolInfo(constructorDeclarationSyntax.Initializer, cancellationToken).Symbol as IMethodSymbol;
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (6)
60out IMethodSymbol methodSymbol, 86out IMethodSymbol methodSymbol, 111out IMethodSymbol methodSymbol, 139out IMethodSymbol methodSymbol, 170out IMethodSymbol methodSymbol, 196private static IMethodSymbol GenerateMethodSymbol(
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
52out IMethodSymbol methodSymbol,
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
35protected override string ToDisplayString(IMethodSymbol disposeImplMethod, SymbolDisplayFormat format)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
107if (symbol is not IMethodSymbol method || method.ReturnsVoid)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (2)
38var methodSymbol = model.GetDeclaredSymbol(node, cancellationToken) as IMethodSymbol;
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
64var setMethod = propertySymbol.SetMethod;
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (4)
71IMethodSymbol methodSymbol, 87IMethodSymbol methodSymbol, 99IMethodSymbol methodSymbol, 111IMethodSymbol methodSymbol,
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (4)
32protected override SyntaxNode RemoveAsyncTokenAndFixReturnType(IMethodSymbol methodSymbol, SyntaxNode node, KnownTaskTypes knownTypes) 44private static SyntaxNode FixMethod(IMethodSymbol methodSymbol, MethodDeclarationSyntax method, KnownTaskTypes knownTypes) 50private static SyntaxNode FixLocalFunction(IMethodSymbol methodSymbol, LocalFunctionStatementSyntax localFunction, KnownTaskTypes knownTypes) 56private static TypeSyntax FixMethodReturnType(IMethodSymbol methodSymbol, TypeSyntax returnTypeSyntax, KnownTaskTypes knownTypes)
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (2)
216if (symbol is not IMethodSymbol method || method.PartialImplementationPart is not null) 305parameterSymbol.ContainingSymbol is IMethodSymbol method &&
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (5)
155IMethodSymbol delegateMethod, ParameterListSyntax parameterList, bool makeStatic) 200IMethodSymbol delegateMethod, 240SyntaxGenerator generator, AnonymousFunctionExpressionSyntax anonymousFunction, IMethodSymbol delegateMethod) 284private static InvocationExpressionSyntax WithNewParameterNames(InvocationExpressionSyntax invocation, IMethodSymbol method, ParameterListSyntax newParameterList) 309private static int TryDetermineParameterIndex(NameColonSyntax argumentNameColon, IMethodSymbol method)
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
278IMethodSymbol or IPropertySymbol or IEventSymbol or IFieldSymbol =>
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (2)
67IMethodSymbol constructor, 165IMethodSymbol constructor,
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (3)
106if (associatedSymbol is IMethodSymbol ctor) 308if (associatedSymbol is IMethodSymbol) 366var declaredAccessor = getSymbol ? (model.GetDeclaredSymbol(declarationWithExpressionBody, cancellationToken) as IPropertySymbol)?.GetMethod : null;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (67)
EditAndContinue\ActiveStatementTests.Methods.cs (3)
519[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")], 558semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]), 561semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C", syntaxMap: syntaxMapB)]),
EditAndContinue\Helpers\CSharpEditAndContinueTestVerifier.cs (1)
27Assert.True(method is IMethodSymbol, "Only methods should have a syntax map.");
EditAndContinue\StatementEditingTests.cs (5)
5176SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 5177SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C") 5434SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, preserveLocalVariables: true, partialType: "C")); 5475SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, preserveLocalVariables: true, partialType: "C")); 8462SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, preserveLocalVariables: true, partialType: "C"));
EditAndContinue\TopLevelEditingTests.cs (58)
6951SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.M")), 7186semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IMethodSymbol>("C.F").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Char }]))]), 7189semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IMethodSymbol>("C.F").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Byte }]))]), 7492SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F"))); 7507SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F"))); 7548SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IMethodSymbol>("M"))); 8512SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.M").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 8513SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.M").PartialImplementationPart, partialType: "C") 10028semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]), 10049semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]), 10066semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]), 10068semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]), 10089SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.F"), deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C") 10107semanticEdits: [SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C")]), 10109semanticEdits: [SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C")]), 10132semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]), 10134semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]) 10152semanticEdits: [SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart)]), 10196semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]), 10222semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]), 10246semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]), 10248semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C")]), 10276SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C") 10297SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 10298SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C") 10303SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 10304SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, partialType: "C") 11234SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IMethodSymbol>("C.Deconstruct").Single(m => m.Parameters is [_])), 11583SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IMethodSymbol>("C.Deconstruct").Single(m => m.Parameters is [_, _])), 12647SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("C").PartialImplementationPart, partialType: "C")); 14184SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F")), 14205SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F")), 18803semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, partialType: "C")]), 18824semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, partialType: "C")]), 18841semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, partialType: "C")]), 18862SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C") 18868SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C") 18892semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, partialType: "C")]), 18894semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, partialType: "C")]) 18988SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, partialType: "C") 19017SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, partialType: "C"), 19047SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, partialType: "C"), 19069SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19071SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, partialType: "C"), 19077SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19079SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, partialType: "C"), 19685SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.get_Item").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19686SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.set_Item").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19688SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.get_Item").PartialImplementationPart, partialType: "C"), 19689SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.set_Item").PartialImplementationPart, partialType: "C"), 19695SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.get_Item").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19696SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.set_Item").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19698SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.get_Item").PartialImplementationPart, partialType: "C"), 19699SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.set_Item").PartialImplementationPart, partialType: "C"), 19803SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.get_Item").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19804SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.set_Item").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19806SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.get_Item").PartialImplementationPart, partialType: "C"), 19807SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IMethodSymbol>("C.set_Item").PartialImplementationPart, partialType: "C"),
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (7)
IOperation\FunctionPointerOperations.cs (1)
206var signature = fktPointerOp.GetFunctionPointerSignature();
IOperation\IOperationTests_ILocalFunctionStatement.cs (6)
1798IMethodSymbol localFunctionD1 = getLocalFunction(graphM); 1808IMethodSymbol localFunctionD2 = getLocalFunction(graphD1); 1821IMethodSymbol getLocalFunction(ControlFlowGraph graph) 1853IMethodSymbol localFunctionD1 = getLocalFunction(graphM, "d1"); 1855IMethodSymbol localFunctionD2 = getLocalFunction(graphM, "d2"); 1872IMethodSymbol getLocalFunction(ControlFlowGraph graph, string name)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (195)
Semantics\AccessCheckTests.cs (2)
911IMethodSymbol IntegerPlus = model.GetSymbolInfo(tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single()).Symbol as IMethodSymbol;
Semantics\AnonymousFunctionTests.cs (12)
987var anonymousMethod = (IMethodSymbol)semanticModel.GetSymbolInfo(anonymousMethodSyntax).Symbol!; 988var simpleLambda = (IMethodSymbol)semanticModel.GetSymbolInfo(simpleLambdaSyntax).Symbol!; 989var parenthesizedLambda = (IMethodSymbol)semanticModel.GetSymbolInfo(parenthesizedLambdaSyntax).Symbol!; 1021var anonymousMethod = (IMethodSymbol)semanticModel.GetSymbolInfo(anonymousMethodSyntax).Symbol!; 1022var simpleLambda = (IMethodSymbol)semanticModel.GetSymbolInfo(simpleLambdaSyntax).Symbol!; 1023var parenthesizedLambda = (IMethodSymbol)semanticModel.GetSymbolInfo(parenthesizedLambdaSyntax).Symbol!;
Semantics\BindingAsyncTests.cs (3)
59Assert.True(((IMethodSymbol)model.GetSymbolInfo(simple).Symbol).IsAsync); 65Assert.True(((IMethodSymbol)model.GetSymbolInfo(paren).Symbol).IsAsync); 88Assert.True(((IMethodSymbol)model.GetSymbolInfo(del).Symbol).IsAsync);
Semantics\DelegateTypeTests.cs (8)
901var method = (IMethodSymbol)symbolInfo.Symbol!; 944var method = (IMethodSymbol)symbolInfo.Symbol!; 952private static bool HaveMatchingSignatures(IMethodSymbol methodA, IMethodSymbol methodB) 7134var method = (IMethodSymbol)symbolInfo.Symbol!;
Semantics\FunctionPointerTests.cs (11)
1616var methodSymbol = (IMethodSymbol)model.GetSymbolInfo(invocation).Symbol!; 1776var methodSymbol = (IMethodSymbol)model.GetSymbolInfo(invocation).Symbol!; 1937var m1InvocationSymbol = (IMethodSymbol)model.GetSymbolInfo(invocation).Symbol!; 1945var declaredSymbol = (IMethodSymbol)comp.GetTypeByMetadataName("C").GetMethod("M2").ISymbol; 2229.Cast<IMethodSymbol>() 2290.Cast<IMethodSymbol>() 2363.Cast<IMethodSymbol>()
Semantics\GenericConstraintsTests.cs (10)
2881var symbol = (IMethodSymbol)model.GetSymbolInfo(value).Symbol; 3141var inferredMethod = (IMethodSymbol)model.GetSymbolInfo(call).Symbol; 3171var inferredMethod = (IMethodSymbol)model.GetSymbolInfo(call).Symbol; 3197var inferredMethod = (IMethodSymbol)model.GetSymbolInfo(call).Symbol; 3226var inferredMethod = (IMethodSymbol)model.GetSymbolInfo(call).Symbol;
Semantics\InitOnlyMemberTests.cs (2)
2518var method = (IMethodSymbol)model.GetSymbolInfo(invocation).Symbol;
Semantics\InterceptorsTests.cs (25)
6216var interceptor = model.GetInterceptorMethod(call); 6265var interceptor = model.GetInterceptorMethod(call); 6311var interceptor = model.GetInterceptorMethod(call); 6357var interceptor = model.GetInterceptorMethod(call); 6409var interceptor = model.GetInterceptorMethod(call); 6458var interceptor = model.GetInterceptorMethod(call); 6514var interceptor = model.GetInterceptorMethod(call); 6562var interceptor = model.GetInterceptorMethod(call); 6652var interceptor = model.GetInterceptorMethod(call); 6680var interceptor = model.GetInterceptorMethod(call); 6739var interceptor = model.GetInterceptorMethod(call); 7241var method = model.GetInterceptorMethod(node); 7286var method = model.GetInterceptorMethod(node); 7368var method = model.GetInterceptorMethod(node); 7410var method = model.GetInterceptorMethod(node); 7460var method = model.GetInterceptorMethod(node); 7513var method = model.GetInterceptorMethod(node); 7566var method = model.GetInterceptorMethod(node); 7626var method = model.GetInterceptorMethod(node); 7682var method = model.GetInterceptorMethod(node); 7737var method = model.GetInterceptorMethod(node); 7792var method = model.GetInterceptorMethod(node); 7842var method = model.GetInterceptorMethod(node); 7907var method = model.GetInterceptorMethod(node); 7957var method = model.GetInterceptorMethod(node);
Semantics\LambdaDiscardParametersTests.cs (1)
387var lambdas = exprs.Select(e => (IMethodSymbol)model.GetSymbolInfo(e).Symbol).ToArray();
Semantics\LambdaTests.cs (15)
858Assert.Equal(MethodKind.AnonymousFunction, (sym as IMethodSymbol).MethodKind); 868Assert.Equal(MethodKind.AnonymousFunction, (sym as IMethodSymbol).MethodKind); 1985var lambdaParameters = ((IMethodSymbol)(model.GetSymbolInfo(node1)).Symbol).Parameters; 3043var lambda = (IMethodSymbol)model.GetEnclosingSymbol(contentType.SpanStart); 3050lambda = (IMethodSymbol)model.GetEnclosingSymbol(b.SpanStart); 3638var method = (IMethodSymbol)symbol; 3894var symbol = (IMethodSymbol)model.GetSymbolInfo(lambda).Symbol; 5648var method = (IMethodSymbol)model.GetSymbolInfo(lambdaSyntax).Symbol; 8018.Select(n => (Node: n, Symbol: (IMethodSymbol)model.GetSymbolInfo(n).Symbol)) 8094var newLambdaSymbol = (IMethodSymbol)speculativeModel.GetSymbolInfo(newLambda).Symbol;
Semantics\LocalFunctionTests.cs (15)
503var symbol = (IMethodSymbol)model.GetDeclaredSymbol(localFunction); 551var symbol = (IMethodSymbol)model.GetDeclaredSymbol(localFunction); 815var symbol = (IMethodSymbol)model.GetDeclaredSymbol(localFunction); 971var symbol = (IMethodSymbol)model.GetDeclaredSymbol(localFunction); 1025var attributeConstructor = comp.GetTypeByMetadataName("A").InstanceConstructors.Single(); 1061var attrConstructor = (IMethodSymbol)model.GetSymbolInfo(attrSyntax).Symbol; 1798Assert.Equal(clsCompliantSymbol.GetMember<IMethodSymbol>(".ctor"), 1873Assert.Equal(clsCompliantSymbol.GetMember<IMethodSymbol>(".ctor"), 2588var methods = exprs.SelectAsArray(e => (IMethodSymbol)model.GetDeclaredSymbol(e)); 10386IMethodSymbol methodSymbol = semanticModel.GetDeclaredSymbol(localFunction);
Semantics\LookupTests.cs (7)
1565var method = (IMethodSymbol)model.GetSymbolInfo(expr).Symbol; 1567var reducedFrom = method.ReducedFrom; 1598var method = (IMethodSymbol)model.GetSymbolInfo(expr).Symbol; 1603method = (IMethodSymbol)model.GetSymbolInfo(expr).Symbol; 1605var reducedFrom = method.ReducedFrom;
Semantics\MethodTypeInferenceTests.cs (4)
1049var method = (IMethodSymbol)model.GetSymbolInfo(syntax).Symbol; 1079var method = (IMethodSymbol)model.GetSymbolInfo(syntax).Symbol;
Semantics\NativeIntegerTests.cs (4)
320var method = (IMethodSymbol)underlyingMember; 345return !(nativeIntegerMember is IMethodSymbol { MethodKind: MethodKind.Constructor }); 3639var method = model.GetDeclaredSymbol(nodes.OfType<MethodDeclarationSyntax>().Single());
Semantics\NullableReferenceTypesTests.cs (4)
155765var method1 = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()); 156330Assert.Equal("object", ((IMethodSymbol)model.GetSymbolInfo(item).Symbol).ReturnType.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 156615Assert.Equal("object", ((IMethodSymbol)model.GetSymbolInfo(item).Symbol).ReturnType.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 156621Assert.Equal("object", ((IMethodSymbol)found).ReturnType.ToDisplayString(TypeWithAnnotations.TestDisplayFormat));
Semantics\OperatorTests.cs (30)
7543var symbol1 = (IMethodSymbol)info1.Symbol; 7545var symbol3 = (IMethodSymbol)semanticModel.GetSymbolInfo(node3).Symbol; 7621var synthesizedMethod = compilation.CreateBuiltinOperator( 7672var otherSymbol = (IMethodSymbol)semanticModel.GetSymbolInfo(node1).Symbol; 7710var symbols1 = (from node1 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node1).Symbol).ToArray(); 7711foreach (var symbol1 in symbols1) 7719var symbols2 = (from node2 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node2).Symbol).ToArray(); 7720foreach (var symbol2 in symbols2) 8113var symbol1 = (IMethodSymbol)info1.Symbol; 8117var symbol5 = (IMethodSymbol)semanticModel.GetSymbolInfo(node5).Symbol; 8397var synthesizedMethod = compilation.CreateBuiltinOperator( 8468var otherSymbol = (IMethodSymbol)semanticModel.GetSymbolInfo(node1).Symbol; 8593var symbols1 = (from node1 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node1).Symbol).ToArray(); 8594foreach (var symbol1 in symbols1) 8602var symbols2 = (from node2 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node2).Symbol).ToArray(); 8603foreach (var symbol2 in symbols2) 8639var symbols1 = (from node1 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node1).Symbol).ToArray(); 8640foreach (var symbol1 in symbols1) 8650var symbols2 = (from node2 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node2).Symbol).ToArray(); 8651foreach (var symbol2 in symbols2) 8689var symbols1 = (from node1 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node1).Symbol).ToArray(); 8690foreach (var symbol1 in symbols1) 8700var symbols2 = (from node2 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node2).Symbol).ToArray(); 8701foreach (var symbol2 in symbols2)
Semantics\OverloadResolutionTests.cs (2)
7260var methodSymbol = (IMethodSymbol)model.GetSymbolInfo(callSyntax).Symbol;
Semantics\QueryTests.cs (6)
1462Assert.NotEqual(MethodKind.ReducedExtension, ((IMethodSymbol)info0.CastInfo.Symbol).MethodKind); 1471Assert.NotEqual(MethodKind.ReducedExtension, ((IMethodSymbol)info1.OperationInfo.Symbol).MethodKind); 1671Assert.Equal(MethodKind.ReducedExtension, ((IMethodSymbol)info0.CastInfo.Symbol).MethodKind); 1680Assert.Equal(MethodKind.ReducedExtension, ((IMethodSymbol)info1.OperationInfo.Symbol).MethodKind); 2182var m = (IMethodSymbol)info2.Symbol;
Semantics\ReadOnlyStructsTests.cs (7)
1227static IMethodSymbol getMethod(INamedTypeSymbol symbol, string name) => (IMethodSymbol)symbol.GetMembers(name).Single(); 1264var c = comp.GetMember<IMethodSymbol>("C.Test"); 1283var symbol = (IMethodSymbol)semanticModel.GetSymbolInfo(invocationExpression.Expression).Symbol; 1284var reducedFrom = symbol.ReducedFrom; 1292Assert.False(((IMethodSymbol)reducedFrom).IsReadOnly);
Semantics\SemanticErrorTests.cs (2)
3340var constructedMethodSymbol = (IMethodSymbol)(boundCall.CandidateSymbols[0]);
Semantics\TopLevelStatementsTests.cs (13)
236var declSymbol = model1.GetDeclaredSymbol(localDecl); 321var refMethod = model1.GetDeclaredSymbol(unit1); 357var declMethod = model2.GetDeclaredSymbol(unit2); 359var declSymbol = model2.GetDeclaredSymbol(localDecl); 2085var declSymbol = model1.GetDeclaredSymbol(localDecl); 2249var declSymbol = model1.GetDeclaredSymbol(localDecl); 4218var local = model.GetDeclaredSymbol(declarator); 4221Assert.Equal(MethodKind.LocalFunction, ((IMethodSymbol)local).MethodKind); 4510var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()); 4516var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4574var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4578var symbol2 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Skip(1).First()); 4623var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First());
Semantics\UnsafeTests.cs (9)
7876Assert.True(methodGroupSummary.MethodGroup.SetEquals(ImmutableArray.Create<IMethodSymbol>(structMethod1.GetPublicSymbol(), structMethod2.GetPublicSymbol()), EqualityComparer<IMethodSymbol>.Default)); 7941Assert.True(methodGroupSummary.MethodGroup.SetEquals(structMethods.GetPublicSymbols(), EqualityComparer<IMethodSymbol>.Default)); 8872var summaryMethod = (IMethodSymbol)summary.Symbol; 8875var synthesizedMethod = compilation.CreateBuiltinOperator( 9334var summaryMethod = (IMethodSymbol)summary.Symbol; 9337var synthesizedMethod = compilation.CreateBuiltinOperator(
Semantics\Utf8StringsLiteralsTests.cs (3)
4081var method = (IMethodSymbol)model.GetSymbolInfo(node).Symbol; 4086var synthesizedMethod = comp.CreateBuiltinOperator(
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (341)
Compilation\CompilationAPITests.cs (24)
1732var entryPoint = compilation.GetEntryPoint(default(CancellationToken)); 1774var method = compilation.GetEntryPoint(default(CancellationToken)); 1818var method = compilation.GetEntryPoint(default(CancellationToken)); 2743var op = compilation.CreateBuiltinOperator(name, intType, intType, intType); 2761var op = compilation.CreateBuiltinOperator(name, boolType, intType, intType); 2780var op = compilation.CreateBuiltinOperator(WellKnownMemberNames.AdditionOperatorName, intType, intType, intType); 2847var addBuiltIn = compilation.CreateBuiltinOperator(WellKnownMemberNames.AdditionOperatorName, intType, intType, intType); 2848var addBuiltInChecked = compilation.CreateBuiltinOperator(WellKnownMemberNames.CheckedAdditionOperatorName, intType, intType, intType); 2849var subtractBuiltIn = compilation.CreateBuiltinOperator(WellKnownMemberNames.SubtractionOperatorName, intType, intType, intType); 2850var subtractBuiltInChecked = compilation.CreateBuiltinOperator(WellKnownMemberNames.CheckedSubtractionOperatorName, intType, intType, intType); 2882var addBuiltIn = compilation.CreateBuiltinOperator(WellKnownMemberNames.AdditionOperatorName, intType, intType, intType); 2883var addBuiltInChecked = compilation.CreateBuiltinOperator(WellKnownMemberNames.CheckedAdditionOperatorName, intType, intType, intType); 2884var subtractBuiltIn = compilation.CreateBuiltinOperator(WellKnownMemberNames.SubtractionOperatorName, intType, intType, intType); 2885var subtractBuiltInChecked = compilation.CreateBuiltinOperator(WellKnownMemberNames.CheckedSubtractionOperatorName, intType, intType, intType); 2914var addBuiltIn = compilation.CreateBuiltinOperator(WellKnownMemberNames.AdditionOperatorName, intType, intType, intType); 2915var addBuiltInChecked = compilation.CreateBuiltinOperator(WellKnownMemberNames.CheckedAdditionOperatorName, intType, intType, intType); 2916var subtractBuiltIn = compilation.CreateBuiltinOperator(WellKnownMemberNames.SubtractionOperatorName, intType, intType, intType); 2917var subtractBuiltInChecked = compilation.CreateBuiltinOperator(WellKnownMemberNames.CheckedSubtractionOperatorName, intType, intType, intType); 2939var op = compilation.CreateBuiltinOperator(name, intType, intType); 2951var op = compilation.CreateBuiltinOperator(name, boolType, boolType); 2970var op = compilation.CreateBuiltinOperator(WellKnownMemberNames.UnaryPlusOperatorName, intType, intType); 3066var genericMethod = (IMethodSymbol)comp.GetMember("Program.M"); 3072var type = genericMethod.Construct(typeArguments, default);
Compilation\ForEachStatementInfoTests.cs (12)
38var ge1 = (IMethodSymbol)e1.GetMembers("GetEnumerator").Single(); 39var mn1 = (IMethodSymbol)e1.GetMembers("MoveNext").Single(); 41var disp1 = (IMethodSymbol)e1.GetMembers("Dispose").Single(); 45var ge2 = (IMethodSymbol)e2.GetMembers("GetEnumerator").Single(); 46var mn2 = (IMethodSymbol)e2.GetMembers("MoveNext").Single(); 48var disp2 = (IMethodSymbol)e2.GetMembers("Dispose").Single();
Compilation\GetSemanticInfoTests.cs (38)
1026IMethodSymbol methodSymbol = (IMethodSymbol)bindInfo.Symbol; 1074Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)baseConstructor).MethodKind); 1093Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)baseConstructor).MethodKind); 1115var invokedConstructor = (IMethodSymbol)bindInfo.Symbol; 1172Assert.Equal(MethodKind.EventAdd, ((IMethodSymbol)parameterSymbol.ContainingSymbol).MethodKind); 1201Assert.Equal(MethodKind.EventRemove, ((IMethodSymbol)parameterSymbol.ContainingSymbol).MethodKind); 1816var candidate = (IMethodSymbol)bindInfo.CandidateSymbols.Single(); 1819Assert.Equal(TypeKind.TypeParameter, ((IMethodSymbol)candidate.OriginalDefinition).Parameters.Last().Type.TypeKind); 1848var method = (IMethodSymbol)bindInfo.Symbol; 2360Assert.Equal(MethodKind.AnonymousFunction, ((IMethodSymbol)parameterSymbol.ContainingSymbol).MethodKind); 2542Assert.Equal(MethodKind.Conversion, ((IMethodSymbol)symbol.ContainingSymbol).MethodKind); 2791var operatorSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(operatorName); 2799var method = (IMethodSymbol)symbolInfo.Symbol; 3243var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.AdditionOperatorName).Cast<IMethodSymbol>(); 3328var mngMethod = (IMethodSymbol)comp.GlobalNamespace.GetMember<INamedTypeSymbol>("Z").GetMembers("MNG").First(); 3394var mngMethod = (IMethodSymbol)comp.GlobalNamespace.GetMember<INamedTypeSymbol>("Z").GetMembers("MNG").First(); 3790Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("M"), info.CandidateSymbols.Single()); 3850Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("M"), info.CandidateSymbols.Single()); 4042var method1 = info1.Symbol as IMethodSymbol; 4057Where((m) => (object)m != (object)method1.ReducedFrom).Cast<IMethodSymbol>().Single().TypeParameters[0])); 4070var method2 = info2.Symbol as IMethodSymbol; 4678var methodGoo = classA.GetMember<IMethodSymbol>("Goo"); 4680var methodBar = classC.GetMember<IMethodSymbol>("Bar"); 4723var methodGoo = classA.GetMember<IMethodSymbol>("Goo"); 4725var methodBar = classC.GetMember<IMethodSymbol>("Bar"); 4788var lambda = (IMethodSymbol)symbolInfo.Symbol; 4831var methodSymbol = (IMethodSymbol)symbolInfo.Symbol;
Compilation\SemanticModelAPITests.cs (7)
1370var method = (IMethodSymbol)symbol; 2086var method = (IMethodSymbol)symbol; 2103method = (IMethodSymbol)symbol; 4452var method = (IMethodSymbol)comp.GetTypeByMetadataName("C").GetMembers("M").Single().GetPublicSymbol();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (28)
280var methodSymbol = model.GetDeclaredSymbol(methodDecl); 311var accessorSymbol = model.GetDeclaredSymbol(accessorDecl); 974var mSymbol = model.GetDeclaredSymbol(memDecl) as IMethodSymbol; 981mSymbol = model.GetDeclaredSymbol(memDecl) as IMethodSymbol; 1722symbol.Kind == SymbolKind.Method && (((IMethodSymbol)symbol).IsExtensionMethod || ((IMethodSymbol)symbol).MethodKind == MethodKind.ReducedExtension); 1885symbol.Kind == SymbolKind.Method && (((IMethodSymbol)symbol).IsExtensionMethod || ((IMethodSymbol)symbol).MethodKind == MethodKind.ReducedExtension); 1935var method = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("E").GetMember<IMethodSymbol>("M"); 1975method = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("M"); 2852var explicitMethodSymbol = (IMethodSymbol)model.GetDeclaredSymbol(explicitMethodNode); 2872var explicitPropertyGetterSymbol = (IMethodSymbol)model.GetDeclaredSymbol(explicitPropertyGetterNode); 2882var explicitPropertySetterSymbol = (IMethodSymbol)model.GetDeclaredSymbol(explicitPropertySetterNode); 2975var dsyma1 = model.GetDeclaredSymbol(node1.Members[0] as MethodDeclarationSyntax); 2994var dsymc1 = model.GetDeclaredSymbol(node3.Members[0] as MethodDeclarationSyntax); 2995var dsymc2 = model.GetDeclaredSymbol(node3.Members[1] as MethodDeclarationSyntax); 2996var dsymc3 = model.GetDeclaredSymbol(node3.Members[2] as MethodDeclarationSyntax); 3147var dsym = model.GetDeclaredSymbol(accessors.Accessors[0]); 4434var conversion = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(WellKnownMemberNames.ImplicitConversionName); 4442var declaredSymbol = model.GetDeclaredSymbol(conversionDecl); 4465var conversion = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(WellKnownMemberNames.ExplicitConversionName); 4473var declaredSymbol = model.GetDeclaredSymbol(conversionDecl); 4496var @operator = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(WellKnownMemberNames.AdditionOperatorName); 4504var declaredSymbol = model.GetDeclaredSymbol(operatorDecl);
Compilation\SemanticModelGetSemanticInfoTests.cs (9)
4886Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)semanticInfo.Symbol.ContainingSymbol).MethodKind); 4893Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)semanticInfo.Symbol.ContainingSymbol).MethodKind); 5413Assert.Equal(MethodKind.PropertySet, ((IMethodSymbol)sortedCandidates[0]).MethodKind); 5665var lambdaSym = (IMethodSymbol)(semanticInfo.Symbol); 5701var lambdaSym = (IMethodSymbol)(semanticInfo.Symbol); 6373Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)symbol).MethodKind); 7295Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)semanticInfo.Symbol).MethodKind);
Compilation\SymbolVisitorTests.cs (3)
98public override void VisitMethod(IMethodSymbol symbol) 276public override string VisitMethod(IMethodSymbol symbol) 455public override int VisitMethod(IMethodSymbol symbol, StringBuilder argument)
DocumentationComments\CrefTests.cs (23)
2968var expectedMethodSymbol = expectedTypeSymbol.GetMember<IMethodSymbol>("M"); 3004var method = typeB.GetMember<IMethodSymbol>("M"); 3039var actualMethod = (IMethodSymbol)model.GetSymbolInfo(crefSyntax).Symbol; 3230Assert.Equal(MethodKind.Ordinary, ((IMethodSymbol)info.CandidateSymbols[0]).MethodKind); 3278Assert.Equal(MethodKind.Conversion, ((IMethodSymbol)info.CandidateSymbols[0]).MethodKind); 3302Assert.Equal(MethodKind.UserDefinedOperator, ((IMethodSymbol)info.CandidateSymbols[0]).MethodKind); 3326Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)info.CandidateSymbols[0]).MethodKind); 4788var overridingMethod = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Derived").GetMember<IMethodSymbol>("M"); 4850var overridingMethod = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Derived").GetMember<IMethodSymbol>("M"); 4877var overridingMethod = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Derived").GetMember<IMethodSymbol>("M"); 4938var overridingMethod = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Derived").GetMember<IMethodSymbol>("M"); 4981var derivedM1 = global.GetMember<INamedTypeSymbol>("Derived").GetMember<IMethodSymbol>("M1"); 4982var baseM2 = global.GetMember<INamedTypeSymbol>("Base").GetMember<IMethodSymbol>("M2"); 5142var nonGenericMethod = type.GetMember<IMethodSymbol>("NormalSub"); 5143var genericMethod = type.GetMember<IMethodSymbol>("GenericSub"); 5472var expectedSymbol = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("Goo"); 5718Assert.Equal(MethodKind.UserDefinedOperator, ((IMethodSymbol)symbol).MethodKind); 6077var members = model.LookupSymbols(methodNameSyntax.SpanStart, ((IMethodSymbol)methodSymbol).ReturnType); 6114var expectedCrefSymbol = expectedReturnTypeSymbol.GetMember<IMethodSymbol>(WellKnownMemberNames.ImplicitConversionName); 6152var expectedCrefSymbol = classB.GetMember<IMethodSymbol>("Goo"); 6708var parameterSymbol = ((IMethodSymbol)model.GetSymbolInfo(cref).Symbol).Parameters.Single(); 6751var parameterSymbol = ((IMethodSymbol)model.GetSymbolInfo(cref).Symbol).Parameters.Single();
SymbolDisplay\SymbolDisplayTests.cs (22)
5932var method = comp.GetMember<IMethodSymbol>("B.F1"); 5963method = comp.GetMember<IMethodSymbol>("B.F2"); 5971method = comp.GetMember<IMethodSymbol>("B.F3"); 6004var method = comp.GetMember<IMethodSymbol>("B.F1"); 6033method = comp.GetMember<IMethodSymbol>("B.F2"); 6041method = comp.GetMember<IMethodSymbol>("B.F3"); 6154var method = compilation.GetMember<IMethodSymbol>("C.Method"); 6227var method = (IMethodSymbol)comp.GetMember("C.F"); 6281var method1 = compilation.GetMember<IMethodSymbol>("C.Method1"); 6289var method2 = compilation.GetMember<IMethodSymbol>("C.Method2"); 6297var method3 = compilation.GetMember<IMethodSymbol>("C.Method3"); 6325var method = compilation.GetMember<IMethodSymbol>("C.Method"); 6353var method = comp.GetMember<IMethodSymbol>("B.F1"); 6440var localSymbol = (IMethodSymbol)semanticModel.GetDeclaredSymbol(local); 6483var localSymbol = (IMethodSymbol)semanticModel.GetDeclaredSymbol(local); 6518var localSymbol = (IMethodSymbol)semanticModel.GetDeclaredSymbol(local); 6612var localSymbol = (IMethodSymbol)semanticModel.GetDeclaredSymbol(local);
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (6)
1033var methodDispose = (IMethodSymbol)semanticModel.GetSymbolInfo(memberAccessSyntax).Symbol; 1051var methodSymbol = semanticModel.GetSymbolInfo(memberAccessed).Symbol as IMethodSymbol; 1053var disposeMethod = (IMethodSymbol)compilation.GetSpecialType(SpecialType.System_IDisposable).GetMembers("Dispose").Single();
Symbols\AnonymousTypesSemanticsTests.cs (1)
2026IMethodSymbol getter = property.GetMethod;
Symbols\CheckedUserDefinedOperatorsTests.cs (3)
7216var int64 = ((IMethodSymbol)model.GetSymbolInfo(xNode.Parent).Symbol).ReturnType; 7288var int64 = ((IMethodSymbol)model.GetSymbolInfo(xNode.Parent).Symbol).ReturnType; 7359var int64 = ((IMethodSymbol)model.GetSymbolInfo(xNode.Parent).Symbol).ReturnType;
Symbols\ConversionTests.cs (5)
1722var conversionSymbols = destinationType.GetMembers().OfType<IMethodSymbol>().Where(m => m.MethodKind == MethodKind.Conversion); 1802var method = (IMethodSymbol)symbol; 1836var method = (IMethodSymbol)symbol;
Symbols\CustomModifiersTests.cs (2)
65var test = compilation.GetTypeByMetadataName("Test1").GetMember<IMethodSymbol>("Test"); 135var test = compilation.GetTypeByMetadataName("Test1").GetMember<IMethodSymbol>("Test");
Symbols\DestructorTests.cs (2)
400var destructor = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(WellKnownMemberNames.DestructorName); 409var declaredSymbol = model.GetDeclaredSymbol(destructorDecl);
Symbols\ExtendedPartialMethodsTests.cs (2)
3496void verifyPublicAPI(IMethodSymbol defSymbol) 3498var implSymbol = defSymbol.PartialImplementationPart;
Symbols\ExtensionMethodTests.cs (3)
226var gooSymbol = (IMethodSymbol)compilation.GetSemanticModel(syntaxTree).GetSymbolInfo( 230var gooOriginal = gooSymbol.ReducedFrom;
Symbols\LocalFunctionTests.cs (3)
35var local = semanticModel.GetDeclaredSymbol(localSyntax); 56var local = semanticModel.GetDeclaredSymbol(localSyntax); 77var local = semanticModel.GetDeclaredSymbol(localSyntax);
Symbols\MethodEqualityTests.cs (6)
203var classMethodDeclaration = (IMethodSymbol)@class.GetMembers("Method").Single(); 217return (IMethodSymbol)semanticInfo.Symbol; 241var pairWiseNotEqual = new IMethodSymbol[] 249foreach (var method1 in pairWiseNotEqual) 251foreach (var method2 in pairWiseNotEqual)
Symbols\Source\DeclaringSyntaxNodeTests.cs (13)
58var meth = symbol as IMethodSymbol; 156var sym = model.GetSymbolInfo(node).Symbol as IMethodSymbol; 467foreach (IMethodSymbol m in c2.GetMembers().OfType<IMethodSymbol>()) 523if (memb.Kind == SymbolKind.Method && ((IMethodSymbol)memb).MethodKind == MethodKind.Constructor) 536if (memb is IMethodSymbol) 538var meth = (IMethodSymbol)memb; 559if (memb is IMethodSymbol) 561var meth = (IMethodSymbol)memb;
Symbols\Source\DelegateTests.cs (3)
828var lambda = (IMethodSymbol)model.GetSymbolInfo(lambdaSyntax).Symbol; 835lambda = (IMethodSymbol)model.GetSymbolInfo(lambdaSyntax).Symbol;
Symbols\Source\MethodTests.cs (8)
73foreach (var ct in ctors) 116var m = a.InstanceConstructors.Single(); 2542var partialDef = model.GetDeclaredSymbol(methods[0]); 2545var partialImpl = model.GetDeclaredSymbol(methods[1]); 2575var partialDef = model.GetDeclaredSymbol(methods[0]); 2576var partialDefConstructed = partialDef.Construct(classC); // M<C>() 2581var partialImpl = model.GetDeclaredSymbol(methods[1]); 2582var partialImplConstructed = partialImpl.Construct(classC); // M<C>()
Symbols\Source\NullablePublicAPITests.cs (66)
288return c.GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("M")).ToArray(); 377return c.GetMembers("M1").OfType<IMethodSymbol>().Single().Parameters.ToArray(); 480var members = c.GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("M")).ToArray(); 488members = e.GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("M")).Select(m => m.ReduceExtensionMethod(m.Parameters[0].Type)).ToArray(); 499static void assertNullability(IMethodSymbol[] methods, params PublicNullableAnnotation[] expectedAnnotations) 570return syntaxTree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.LocalFunctionStatementSyntax>().Select(func => semanticModel.GetDeclaredSymbol(func)).Cast<IMethodSymbol>().ToArray(); 693comp => ((INamedTypeSymbol)((Compilation)comp).GetMember("I")).GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("F")).ToArray(), 757comp => ((INamedTypeSymbol)((Compilation)comp).GetMember("I")).GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("F")).ToArray(), 822comp => ((INamedTypeSymbol)((Compilation)comp).GetMember("I")).GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("F")).ToArray(), 889comp => ((INamedTypeSymbol)((Compilation)comp).GetMember("IB")).GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("F")).ToArray(), 948var method = (IMethodSymbol)model.GetSymbolInfo(inv).Symbol; 1854verifySymbolInfo((IMethodSymbol)symbolInfo.Symbol, PublicNullableAnnotation.Annotated); 1856verifySymbolInfo((IMethodSymbol)symbolInfo.Symbol, PublicNullableAnnotation.NotAnnotated); 1858static void verifySymbolInfo(IMethodSymbol methodSymbol, PublicNullableAnnotation expectedAnnotation) 1897verifySymbolInfo((IMethodSymbol)symbolInfo.Symbol, PublicNullableAnnotation.Annotated); 1899verifySymbolInfo((IMethodSymbol)symbolInfo.Symbol, PublicNullableAnnotation.NotAnnotated); 1901static void verifySymbolInfo(IMethodSymbol methodSymbol, PublicNullableAnnotation expectedAnnotation) 2967Assert.Equal(expectedAnnotation, ((IMethodSymbol)symbolInfo.Symbol).TypeArgumentNullableAnnotations[0]); 2968Assert.Equal(expectedAnnotation, ((IMethodSymbol)symbolInfo.Symbol).TypeArguments[0].NullableAnnotation); 3009Assert.Equal(expectedAnnotation, ((IMethodSymbol)symbolInfo.Symbol).TypeArgumentNullableAnnotations[0]); 3010Assert.Equal(expectedAnnotation, ((IMethodSymbol)symbolInfo.Symbol).TypeArguments[0].NullableAnnotation); 3051Assert.Equal(PublicNullableAnnotation.NotAnnotated, ((IMethodSymbol)symbolInfo.Symbol).TypeArgumentNullableAnnotations[0]); 3052Assert.Equal(PublicNullableAnnotation.NotAnnotated, ((IMethodSymbol)symbolInfo.Symbol).TypeArguments[0].NullableAnnotation); 3053Assert.Equal(expectedAnnotation, ((IMethodSymbol)symbolInfo.Symbol).TypeArgumentNullableAnnotations[1]); 3054Assert.Equal(expectedAnnotation, ((IMethodSymbol)symbolInfo.Symbol).TypeArguments[1].NullableAnnotation); 3114Assert.Equal(PublicNullableAnnotation.None, ((IMethodSymbol)symbol).TypeArgumentNullableAnnotations[0]); 3115Assert.Equal(PublicNullableAnnotation.None, ((IMethodSymbol)symbol).TypeArguments[0].NullableAnnotation); 3157var methodSymbol = ((IMethodSymbol)symbolInfo.Symbol); 3202var methodSymbol = ((IMethodSymbol)symbolInfo.Symbol); 3365var propertySymbol = (IMethodSymbol)model.GetSymbolInfo(indexer).Symbol; 3411var method = (IMethodSymbol)model.GetSymbolInfo(syntax).Symbol; 3456var method = (IMethodSymbol)model.GetSymbolInfo(syntax).Symbol; 3489var lambdaSymbol = (IMethodSymbol)model.GetSymbolInfo(lambda).Symbol; 3508var mSymbol = model.GetDeclaredSymbol(mDeclaration); 3542var innerLambdaSymbol = (IMethodSymbol)model.GetSymbolInfo(innerLambda).Symbol; 3603var innerLambdaSymbol = (IMethodSymbol)model.GetSymbolInfo(innerLambda).Symbol; 3662var lambdaSymbol = (IMethodSymbol)model.GetSymbolInfo(lambda).Symbol; 3665var localFunctionSymbol = (IMethodSymbol)model.GetDeclaredSymbol(localFunction); 3809var lambdaSymbol = (IMethodSymbol)model.GetSymbolInfo(lambda).Symbol; 3877var localFunctionSymbol = model.GetDeclaredSymbol(localFunction); 3982var innerLambdaSymbol1 = (IMethodSymbol)model.GetSymbolInfo(innerLambda1).Symbol; 3992var innerLambdaSymbol2 = (IMethodSymbol)model.GetSymbolInfo(innerLambda2).Symbol; 4118var localFunctionSymbol = model.GetDeclaredSymbol(localFunction); 4134var localFunctionResult = lookupResults.OfType<IMethodSymbol>().First(m => m.MethodKind == MethodKind.LocalFunction); 4180var localFunctionSymbol = (IMethodSymbol)model.GetDeclaredSymbol(localFunction); 4181var nestedLocalFunction = (IMethodSymbol)model.GetDeclaredSymbol(lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().ElementAt(1)); 4702var symbol2 = (IMethodSymbol)model.GetSpeculativeSymbolInfo(initializer.Position, expression, SpeculativeBindingOption.BindAsExpression).Symbol; 4781var actualAnnotations = invocations.Select(inv => (((IMethodSymbol)model.GetSymbolInfo(inv).Symbol)).TypeArguments[0].NullableAnnotation).ToArray();
Symbols\StaticAbstractMembersInInterfacesTests.cs (5)
19565var declaredSymbol = model.GetDeclaredSymbol(node.FirstAncestorOrSelf<OperatorDeclarationSyntax>()); 19648var declaredSymbol = model.GetDeclaredSymbol(node.FirstAncestorOrSelf<OperatorDeclarationSyntax>()); 19740var declaredSymbol = model.GetDeclaredSymbol(node.FirstAncestorOrSelf<OperatorDeclarationSyntax>()); 19829var declaredSymbol = model.GetDeclaredSymbol(node.FirstAncestorOrSelf<OperatorDeclarationSyntax>()); 28778var declaredSymbol = model.GetDeclaredSymbol(node.FirstAncestorOrSelf<ConversionOperatorDeclarationSyntax>());
Symbols\SymbolEqualityTests.cs (18)
43var nonNullPlus = (IMethodSymbol)model.GetSymbolInfo(invocations[0]).Symbol; 44var nullPlus = (IMethodSymbol)model.GetSymbolInfo(invocations[1]).Symbol; 86var nonNullStringExt = (IMethodSymbol)model.GetSymbolInfo(invocations[0]).Symbol; 89var nullStringExt = (IMethodSymbol)model.GetSymbolInfo(invocations[1]).Symbol; 167var nonNullM = (IMethodSymbol)model.GetSymbolInfo(invocations[0]).Symbol; 168var nullM = (IMethodSymbol)model.GetSymbolInfo(invocations[1]).Symbol; 832var method1 = (IMethodSymbol)((INamedTypeSymbol)model.GetDeclaredSymbol(member1Syntax)).GetMembers("M").Single(); // A<T!>! A<T>.M(A<T!>! t) 833var method2 = (IMethodSymbol)model.GetSymbolInfo(member2Syntax).Symbol; // A<T!>! A<T!>.M(A<T!>! t) 939var lambdaSymbol = (IMethodSymbol)semanticModel1.GetSymbolInfo(lambdaSyntax).Symbol;
Symbols\TypeTests.cs (13)
1721var compType = (model.GetDeclaredSymbol(mnode) as IMethodSymbol).Parameters[0].Type; 2347var m1 = (IMethodSymbol)c.GetMember("M1"); 2352var m2 = (IMethodSymbol)c.GetMember("M2"); 2357var m3 = (IMethodSymbol)c.GetMember("M3"); 2395var m1 = (IMethodSymbol)c.GetMember("M1"); 2400var m2 = (IMethodSymbol)c.GetMember("M2"); 2405var m3 = (IMethodSymbol)c.GetMember("M3");
Symbols\UnsignedRightShiftTests.cs (16)
129var unsignedShiftSymbol = (IMethodSymbol)model.GetSymbolInfo(unsignedShift).Symbol; 130var shiftSymbol = (IMethodSymbol)model.GetSymbolInfo(shift).Symbol; 632var unsignedShiftSymbol = (IMethodSymbol)model.GetSymbolInfo(unsignedShift).Symbol; 633var shiftSymbol = (IMethodSymbol)model.GetSymbolInfo(shift).Symbol; 1182var unsignedShiftSymbol = (IMethodSymbol)model.GetSymbolInfo(unsignedShift).Symbol; 1183var shiftSymbol = (IMethodSymbol)model.GetSymbolInfo(shift).Symbol; 1590var unsignedShiftSymbol = (IMethodSymbol)model.GetSymbolInfo(unsignedShift).Symbol; 1591var shiftSymbol = (IMethodSymbol)model.GetSymbolInfo(shift).Symbol;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (2)
Syntax\LambdaUtilitiesTests.cs (2)
47var enclosingMethod = (IMethodSymbol)model.GetEnclosingSymbol(span.Value.Start);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (23)
CompilationTestUtils.cs (9)
116public static void CheckReducedExtensionMethod(IMethodSymbol reducedMethod, IMethodSymbol reducedFrom) 139public static void CheckConstructedMethod(IMethodSymbol constructedMethod, IMethodSymbol constructedFrom) 158private static void CheckTypeParameters(IMethodSymbol method) 160var constructedFrom = method.ConstructedFrom; 220public ImmutableArray<IMethodSymbol> MethodGroup 222get { return this.MemberGroup.WhereAsArray(s => s.Kind == SymbolKind.Method).SelectAsArray(s => (IMethodSymbol)s); } 468var method = model.GetDeclaredSymbol(methodSyntax);
Extensions.cs (13)
177public static IMethodSymbol GetCopyConstructor(this Compilation compilation, string qualifiedTypeName) 188public static IMethodSymbol GetPrimaryConstructor(this Compilation compilation, string qualifiedTypeName) 194public static IMethodSymbol GetParameterlessConstructor(this Compilation compilation, string qualifiedTypeName) 200public static IMethodSymbol GetSpecializedEqualsOverload(this Compilation compilation, string qualifiedTypeName) 203return type.GetMembers("Equals").OfType<IMethodSymbol>().Single(m => m.Parameters is [{ Type: var parameterType }] && parameterType.Equals(type, SymbolEqualityComparer.Default)); 206public static IMethodSymbol GetPrimaryDeconstructor(this Compilation compilation, string qualifiedTypeName) 208var primaryConstructor = compilation.GetPrimaryConstructor(qualifiedTypeName); 214return primaryConstructor.ContainingType.GetMembers("Deconstruct").OfType<IMethodSymbol>().Single( 699public static ITypeSymbol GetParameterType(this IMethodSymbol method, int index) => method.Parameters[index].Type; 756return ((IMethodSymbol)member).Parameters; 817return ((IMethodSymbol)symbol).ReturnType; 852return ((IMethodSymbol)symbol).ConstructedFrom; 877public static IEnumerable<Microsoft.CodeAnalysis.NullableAnnotation> TypeArgumentNullableAnnotations(this IMethodSymbol method)
FunctionPointerUtilities.cs (1)
240var signature = ptrType.Signature;
Microsoft.CodeAnalysis.CSharp.Workspaces (135)
Classification\SyntaxClassification\NameSyntaxClassifier.cs (3)
159symbol is IParameterSymbol { ContainingSymbol: IMethodSymbol { Name: WellKnownMemberNames.TopLevelStatementsEntryPointMethodName } }) 199case IMethodSymbol methodSymbol: 251private static string GetClassificationForMethod(IMethodSymbol methodSymbol)
Classification\SyntaxClassification\OperatorOverloadSyntaxClassifier.cs (1)
48if (symbolInfo.Symbol is IMethodSymbol { MethodKind: MethodKind.UserDefinedOperator })
CodeGeneration\CSharpSyntaxGenerator.cs (1)
373private protected override SyntaxNode DestructorDeclaration(IMethodSymbol destructorMethod)
ExternalAccess\Pythia\Api\PythiaSymbolExtensions.cs (2)
29public static bool? IsMoreSpecificThan(this IMethodSymbol method1, IMethodSymbol method2)
Recommendations\CSharpRecommendationServiceRunner.cs (1)
677if (symbol is IMethodSymbol { MethodKind: MethodKind.AnonymousFunction })
Recommendations\CSharpRecommendationServiceRunner_Conversions.cs (6)
162if (member is not IMethodSymbol method) 189static bool IsLiftableConversion(IMethodSymbol method) 193private IMethodSymbol LiftConversion(Compilation compilation, IMethodSymbol method) 236var conversion = CreateConversion( 258private static IMethodSymbol CreateConversion(INamedTypeSymbol containingType, ITypeSymbol fromType, ITypeSymbol toType, string? documentationCommentXml)
Recommendations\CSharpRecommendationServiceRunner_Operators.cs (2)
33if (member is not IMethodSymbol { MethodKind: MethodKind.UserDefinedOperator } method) 57private static bool IsLiftableOperator(IMethodSymbol symbol)
Rename\CSharpRenameRewriterLanguageService.cs (5)
827renamedSymbol.ContainingSymbol is IMethodSymbol methodSymbol && 850conflicts.AddRange(DeclarationConflictHelpers.GetMembersWithConflictingSignatures((IMethodSymbol)renamedSymbol, trimOptionalParameters: false).Select(t => reverseMappedLocations[t])); 941var property = ((IMethodSymbol)symbol).AssociatedSymbol!; 1059var method = (IMethodSymbol)symbol;
Simplification\CSharpSimplificationService.Expander.cs (8)
120var returnType = (_semanticModel.GetSymbolInfo(lambdaExpression).Symbol as IMethodSymbol)?.ReturnType; 142var returnType = (_semanticModel.GetSymbolInfo(parentLambda).Symbol as IMethodSymbol)?.ReturnType; 562((IMethodSymbol)symbol).IsStatic) 745if (((IMethodSymbol)symbol).TypeArguments.Length != 0) 747var typeArguments = ((IMethodSymbol)symbol).TypeArguments; 1057rewrittenNode = RewriteExtensionMethodInvocation(originalNode, rewrittenNode, ((MemberAccessExpressionSyntax)rewrittenNode.Expression).Expression, (IMethodSymbol)targetSymbol); 1068IMethodSymbol reducedExtensionMethod) 1093IMethodSymbol reducedExtensionMethod)
Simplification\Reducers\CSharpExtensionMethodReducer.cs (3)
59var targetMethodSymbol = (IMethodSymbol)targetSymbol.Symbol; 122if (newSymbol.Kind == SymbolKind.Method && oldSymbol.Equals(((IMethodSymbol)newSymbol).GetConstructedReducedFrom()))
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
430if (enclosingSymbol is IMethodSymbol methodSymbol)
Simplification\Simplifiers\NameSimplifier.cs (2)
79var method = symbol as IMethodSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (5)
102if (semanticModel.GetSymbolInfo(memberName, cancellationToken).Symbol is not IMethodSymbol methodSymbol) 116private static bool IsPossibleCreationOrConversionMethod(IMethodSymbol methodSymbol, 141private static bool IsPossibleCreationMethod(IMethodSymbol methodSymbol, 157private static bool IsPossibleConversionMethod(IMethodSymbol methodSymbol) 173private static bool IsContainerTypeEqualToReturnType(IMethodSymbol methodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (2)
376if (symbol is IMethodSymbol 541return symbolInfo.GetBestOrAllSymbols().Any() && !symbolInfo.GetBestOrAllSymbols().Any(static s => s is IMethodSymbol);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
40public static bool TryGetPrimaryConstructor(this INamedTypeSymbol typeSymbol, [NotNullWhen(true)] out IMethodSymbol? primaryConstructor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (3)
439if (semanticModel.GetSymbolInfo(argumentList.Parent, cancellationToken).Symbol is IMethodSymbol member && index < member.Parameters.Length) 462public static IMethodSymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, ConstructorDeclarationSyntax syntax, CancellationToken cancellationToken) 468public static IMethodSymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, LocalFunctionStatementSyntax syntax, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
824if (symbol is IMethodSymbol method &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (11)
67if (symbol is IMethodSymbol { MethodKind: MethodKind.Conversion }) 190public IMethodSymbol? GetGetAwaiterMethod(SemanticModel semanticModel, SyntaxNode node) 201public ImmutableArray<IMethodSymbol> GetDeconstructionAssignmentMethods(SemanticModel semanticModel, SyntaxNode node) 205using var builder = TemporaryArray<IMethodSymbol>.Empty; 213public ImmutableArray<IMethodSymbol> GetDeconstructionForEachMethods(SemanticModel semanticModel, SyntaxNode node) 217using var builder = TemporaryArray<IMethodSymbol>.Empty; 225private static void FlattenDeconstructionMethods(DeconstructionInfo deconstruction, ref TemporaryArray<IMethodSymbol> builder) 227var method = deconstruction.Method; 381public ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken) 383using var _ = ArrayBuilder<IMethodSymbol>.GetInstance(out var builder); 392if (localFunctionSymbol is IMethodSymbol methodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (8)
679if (memberSymbol is not IMethodSymbol methodSymbol) 686for (var current = methodSymbol; current != null; current = current.OverriddenMethod) 921if (sym is IMethodSymbol { MethodKind: MethodKind.UserDefinedOperator } op) 1136if (oldSymbolInfo is IMethodSymbol method && 1307if (originalMemberSymbol is not IMethodSymbol { MethodKind: MethodKind.DelegateInvoke } originalMethodSymbol || 1308rewrittenMemberSymbol is not IMethodSymbol { MethodKind: MethodKind.DelegateInvoke } rewrittenMethodSymbol) 1382if (originalMemberSymbol is IMethodSymbol originalMethodSymbol && 1383rewrittenMemberSymbol is IMethodSymbol rewrittenMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (1)
867protected override void GetForEachSymbols(SemanticModel model, CommonForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
234var method = memberGroup[0] as IMethodSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (5)
28IMethodSymbol constructor, 44IMethodSymbol constructor, 90IMethodSymbol constructor) 108IMethodSymbol constructor) 117private static SyntaxTokenList GenerateModifiers(IMethodSymbol constructor, CSharpCodeGenerationContextInfo info)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConversionGenerator.cs (3)
23IMethodSymbol method, 35IMethodSymbol method, 46IMethodSymbol method,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (4)
115protected override TDeclarationNode AddMethod<TDeclarationNode>(TDeclarationNode destination, IMethodSymbol method, CSharpCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) 199var getMethod = property.GetMethod; 214var setMethod = property.SetMethod; 649IMethodSymbol method, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\DestructorGenerator.cs (3)
26IMethodSymbol destructor, 42IMethodSymbol destructor, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken) 66IMethodSymbol constructor)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (4)
154IMethodSymbol? accessor, 166IMethodSymbol accessor, 175private static BlockSyntax GenerateBlock(IMethodSymbol accessor) 184IMethodSymbol? accessor)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (12)
31IMethodSymbol method, 44IMethodSymbol method, 59IMethodSymbol method, 74IMethodSymbol method, CodeGenerationDestination destination, 92IMethodSymbol method, 111IMethodSymbol method, CodeGenerationDestination destination, 140IMethodSymbol method, CodeGenerationDestination destination, 195IMethodSymbol method, CSharpCodeGenerationContextInfo info, bool isExplicit) 209IMethodSymbol method) 216private static SyntaxList<TypeParameterConstraintClauseSyntax> GenerateDefaultConstraints(IMethodSymbol method) 249IMethodSymbol method, CSharpCodeGenerationContextInfo info) 255IMethodSymbol method, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (2)
112var primaryConstructor = members.OfType<IMethodSymbol>().FirstOrDefault(m => CodeGenerationConstructorInfo.GetIsPrimaryConstructor(m)); 230var invokeMethod = namedType.DelegateInvokeMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (4)
25IMethodSymbol method, 37IMethodSymbol method, 74IMethodSymbol method, 109private static SyntaxTokenList GenerateModifiers(IMethodSymbol method, CodeGenerationDestination destination, bool hasNoBody)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ParameterGenerator.cs (1)
82parameter.ContainingSymbol is IMethodSymbol methodSymbol &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (5)
278IMethodSymbol? accessor, 292IMethodSymbol accessor, 308private static BlockSyntax GenerateBlock(IMethodSymbol accessor) 317IMethodSymbol? accessor) 327IMethodSymbol accessor,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\StatementGenerator.cs (1)
18internal static BlockSyntax GenerateBlock(IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (2)
120if (member is IMethodSymbol method && method.IsExtensionMethod) 229if (symbol is IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (4)
1035IMethodSymbol m => m.Arity > 0, 1043return symbols.All(static s => s is INamedTypeSymbol or IMethodSymbol); 2011while (enclosingSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction or MethodKind.AnonymousFunction } method) 2832if (symbol is IMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeSyntaxExtensions.cs (1)
55public static TypeSyntax GenerateReturnTypeSyntax(this IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (1)
122public IMethodSymbol? TryGetDisposeMethod(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (14)
112if (allSymbols is [IMethodSymbol method]) 388var methods = info.GetBestOrAllSymbols().OfType<IMethodSymbol>(); 460var methods = info.GetBestOrAllSymbols().OfType<IMethodSymbol>(); 468argumentOpt == null && info.Symbol is IMethodSymbol method && method.Parameters.All(p => p.IsOptional || p.IsParams)) 472.OfType<IMethodSymbol>(); 543var methods = info.GetBestOrAllSymbols().OfType<IMethodSymbol>(); 572private IEnumerable<TypeInferenceInfo> InferTypeInAttributeArgument(int index, IEnumerable<IMethodSymbol> methods, AttributeArgumentSyntax argumentOpt = null) 575private IEnumerable<TypeInferenceInfo> InferTypeInArgument(int index, IEnumerable<IMethodSymbol> methods, ArgumentSyntax argumentOpt, InvocationExpressionSyntax parentInvocationExpressionToTypeInfer) 600private static IMethodSymbol Instantiate(IMethodSymbol method, IList<ITypeSymbol> invocationTypes) 1297.Cast<IMethodSymbol>() 1315.Cast<IMethodSymbol>() 1405var addMethodParameterTypes = addMethodSymbols.Select(m => ((IMethodSymbol)m).Parameters[0]).Select(p => new TypeInferenceInfo(p.Type)); 2028var isAsync = symbol is IMethodSymbol methodSymbol && methodSymbol.IsAsync;
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (8)
CodeGeneration\SyntaxGeneratorTests.cs (8)
981var operatorSymbol = (IMethodSymbol)comp.GetTypeByMetadataName("C").GetMembers(WellKnownMemberNames.CheckedIncrementOperatorName).Single(); 989var conversion = gcHandleType.GetMembers().OfType<IMethodSymbol>().Single(m => 997conversion = doubleType.GetMembers().OfType<IMethodSymbol>().Single(m => 2495var method = type.GetMembers().Single(m => m is IMethodSymbol { MethodKind: MethodKind.ExplicitInterfaceImplementation }); 4278var method = symbolC.GetMembers().OfType<IMethodSymbol>().Single(m => m.MethodKind == MethodKind.Ordinary);
Microsoft.CodeAnalysis.EditorFeatures (1)
Navigation\AbstractDefinitionLocationService.cs (1)
171if (symbol is not IMethodSymbol method)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (21)
CodeGeneration\CodeGenerationTests.cs (12)
113var ctor = CodeGenerationSymbolFactory.CreateConstructorSymbol( 139Func<SemanticModel, ImmutableArray<IMethodSymbol>> getExplicitInterfaces = null, 155var method = CodeGenerationSymbolFactory.CreateMethodSymbol( 232var method = CodeGenerationSymbolFactory.CreateOperatorSymbol( 280var method = CodeGenerationSymbolFactory.CreateConversionSymbol( 377IMethodSymbol addMethod = null, 378IMethodSymbol removeMethod = null, 379IMethodSymbol raiseMethod = null, 443var getAccessor = CodeGenerationSymbolFactory.CreateMethodSymbol( 454var setAccessor = CodeGenerationSymbolFactory.CreateMethodSymbol( 692private static ImmutableArray<IMethodSymbol> GetMethodSymbols( 693Func<SemanticModel, ImmutableArray<IMethodSymbol>> explicitInterface, TestContext context)
CodeGeneration\CodeGenerationTests.CSharp.cs (2)
681getExplicitInterfaces: s => s.LookupSymbols(input.IndexOf('M'), null, "M").OfType<IMethodSymbol>().ToImmutableArray()); 699getExplicitInterfaces: s => s.LookupSymbols(input.IndexOf('M'), null, "M").OfType<IMethodSymbol>().ToImmutableArray());
CodeGeneration\CodeGenerationTests.VisualBasic.cs (1)
647getExplicitInterfaces: s => s.LookupSymbols(input.IndexOf('M'), null, "M").OfType<IMethodSymbol>().ToImmutableArray());
Utilities\SymbolEquivalenceComparerTests.cs (6)
1867var method1 = GetInvokedSymbol<TInvocation>(comp1, typeName, methodName); 1868var method2 = GetInvokedSymbol<TInvocation>(comp2, typeName, methodName); 1878var cfmethod1 = method1.ConstructedFrom; 1879var cfmethod2 = method2.ConstructedFrom; 1884private static IMethodSymbol GetInvokedSymbol<TInvocation>(Compilation compilation, string typeName, string methodName) 1897return info.Symbol as IMethodSymbol;
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (2)
Diagnostics\DiagnosticServiceTests.vb (2)
1261Dim method = DirectCast(context.Symbol, IMethodSymbol) 1886Dim method = (DirectCast(ctxt.Symbol, IMethodSymbol))
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (4)
AbstractTypeParameterChecker.cs (2)
27public abstract IParameterSymbol GetThisParameter(IMethodSymbol method); 87public sealed override void VisitMethod(IMethodSymbol symbol)
InstructionDecoder.cs (2)
66var parameters = ((IMethodSymbol)method.GetISymbol()).Parameters; 117return ((IMethodSymbol)method.GetISymbol()).ReturnType.ToDisplayString(DisplayFormat);
Microsoft.CodeAnalysis.Features (538)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.ConstructorCandidate.cs (2)
11private readonly struct ConstructorCandidate(IMethodSymbol constructor, ImmutableArray<ISymbol> missingMembers, ImmutableArray<IParameterSymbol> missingParameters) 13public readonly IMethodSymbol Constructor = constructor;
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.State.cs (3)
84foreach (var constructor in containingType.InstanceConstructors) 96private static async Task<bool> IsApplicableConstructorAsync(IMethodSymbol constructor, Document document, ImmutableArray<string> parameterNamesForSelectedMembers, CancellationToken cancellationToken) 120private static ConstructorCandidate CreateConstructorCandidate(ImmutableArray<IParameterSymbol> parametersForSelectedMembers, ImmutableArray<ISymbol> selectedMembers, IMethodSymbol constructor)
AddDebuggerDisplay\AbstractAddDebuggerDisplayCodeRefactoringProvider.cs (5)
83var methodSymbol = (IMethodSymbol)semanticModel.GetRequiredDeclaredSymbol(method, cancellationToken); 99private static bool IsToStringMethod(IMethodSymbol methodSymbol) 102private static bool IsDebuggerDisplayMethod(IMethodSymbol methodSymbol) 160if (!typeSymbol.GetMembers().OfType<IMethodSymbol>().Any(IsDebuggerDisplayMethod))
AddImport\AbstractAddImportFeatureService.cs (2)
53protected abstract bool IsViableExtensionMethod(IMethodSymbol method, SyntaxNode expression, SemanticModel semanticModel, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken); 473protected static bool IsViableExtensionMethod(IMethodSymbol method, ITypeSymbol receiver)
AddImport\SymbolReferenceFinder.cs (10)
357var methodSymbols = OfType<IMethodSymbol>(symbols); 371private ImmutableArray<SymbolResult<IMethodSymbol>> GetViableExtensionMethods( 372ImmutableArray<SymbolResult<IMethodSymbol>> methodSymbols, 379private ImmutableArray<SymbolResult<IMethodSymbol>> GetViableExtensionMethods( 380ImmutableArray<SymbolResult<IMethodSymbol>> methodSymbols, ITypeSymbol typeSymbol) 386private ImmutableArray<SymbolResult<IMethodSymbol>> GetViableExtensionMethodsWorker( 387ImmutableArray<SymbolResult<IMethodSymbol>> methodSymbols) 413var methodSymbols = OfType<IMethodSymbol>(symbols).SelectAsArray(s => s.WithDesiredName(null)); 552SearchScope searchScope, string name, ITypeSymbol type, Func<IMethodSymbol, bool> predicate, CancellationToken cancellationToken) 561var methodSymbols = OfType<IMethodSymbol>(symbols).SelectAsArray(s => s.WithDesiredName(null));
ChangeSignature\AbstractChangeSignatureService.cs (7)
50IMethodSymbol symbol, Document document, CancellationToken cancellationToken); 83protected abstract bool TryGetRecordPrimaryConstructor(INamedTypeSymbol typeSymbol, [NotNullWhen(true)] out IMethodSymbol? primaryConstructor); 116if (symbol is IMethodSymbol method) 140else if (TryGetRecordPrimaryConstructor(typeSymbol, out var primaryConstructor)) 270var methodSymbol = symbol.Definition as IMethodSymbol; 1045if (symbol is IMethodSymbol methodSymbol && methodSymbol.Parameters.LastOrDefault()?.IsParams == true)
ChangeSignature\DelegateInvokeMethodReferenceFinder.cs (5)
29internal sealed class DelegateInvokeMethodReferenceFinder : AbstractReferenceFinder<IMethodSymbol> 37protected override bool CanFind(IMethodSymbol symbol) 41IMethodSymbol symbol, 68IMethodSymbol symbol, 84IMethodSymbol methodSymbol,
CodeLens\CodeLensFindReferenceProgress.cs (2)
72(definition as IMethodSymbol)?.AssociatedSymbol != null; 124(definition as IMethodSymbol)?.MethodKind == MethodKind.Constructor;
CodeLens\CodeLensReferencesService.cs (2)
230var method = (IMethodSymbol)current;
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (2)
533foreach (var methodSymbol in typeSymbol.GetMembers().OfType<IMethodSymbol>())
Completion\Providers\AbstractContextVariableArgumentProvider.cs (2)
90while (enclosingSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction or MethodKind.AnonymousFunction }) 97if (enclosingSymbol is IMethodSymbol { ContainingType: { } containingType })
Completion\Providers\AbstractDocCommentCompletionProvider.cs (2)
233var returns = symbol is IMethodSymbol method && !method.ReturnsVoid; 241var delegateInvokeMethod = namedType.DelegateInvokeMethod;
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
149memberContainingDocument = await codeGenService.AddMethodAsync(context, containingType, (IMethodSymbol)generatedMember, cancellationToken).ConfigureAwait(false);
Completion\Providers\AbstractOverrideCompletionProvider.cs (2)
43if (newOverriddenMember is IMethodSymbol methodSymbol && 74SymbolKind.Method => ((IMethodSymbol)symbol).ReturnType,
Completion\Providers\AbstractPartialMethodCompletionProvider.cs (7)
35protected abstract bool IncludeAccessibility(IMethodSymbol method, CancellationToken cancellationToken); 37protected abstract string GetDisplayText(IMethodSymbol method, SemanticModel semanticModel, int position); 38protected abstract bool IsPartial(IMethodSymbol method); 67var method = (IMethodSymbol)member; 95.OfType<IMethodSymbol>() 104private CompletionItem CreateItem(IMethodSymbol method, int line, TextSpan span, SemanticModel semanticModel, DeclarationModifiers modifiers, SyntaxToken token)
Completion\Providers\AbstractRecommendationServiceBasedCompletionProvider.cs (1)
130=> symbol is IMethodSymbol method ? method.ReturnType : symbol.GetSymbolType();
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.cs (5)
143Compilation compilation, ImmutableArray<IMethodSymbol> extentsionMethodSymbols, ImmutableArray<ITypeSymbol> targetTypeSymbols, CancellationToken cancellationToken) 147using var _2 = PooledDictionary<(string containingNamespace, string methodName, bool isGeneric), (IMethodSymbol bestSymbol, int overloadCount, bool includeInTargetTypedCompletion)> 151foreach (var symbol in extentsionMethodSymbols) 155IMethodSymbol bestSymbol; 212Compilation compilation, IMethodSymbol methodSymbol, ImmutableArray<ITypeSymbol> targetTypeSymbols,
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (15)
86public async Task<(ImmutableArray<IMethodSymbol> symbols, bool isPartialResult)> GetExtensionMethodSymbolsAsync(bool forceCacheCreation, bool hideAdvancedMembers, CancellationToken cancellationToken) 91var peReferenceMethodSymbolsTask = ProducerConsumer<IMethodSymbol?>.RunParallelAsync( 98var projectMethodSymbolsTask = ProducerConsumer<IMethodSymbol?>.RunParallelAsync( 109using var _ = ArrayBuilder<IMethodSymbol>.GetInstance(results[0].Length + results[1].Length, out var symbols); 155Action<IMethodSymbol?> callback, 200Action<IMethodSymbol?> callback, 242MultiDictionary<ITypeSymbol, IMethodSymbol> matchingMethodSymbols, 243Action<IMethodSymbol?> callback, 309MultiDictionary<ITypeSymbol, IMethodSymbol> matchingMethodSymbols, 310Action<IMethodSymbol?> callback, 345private MultiDictionary<ITypeSymbol, IMethodSymbol> GetPotentialMatchingSymbolsFromAssembly( 351var builder = new MultiDictionary<ITypeSymbol, IMethodSymbol>(); 382var methodSymbols = containerSymbol.GetMembers(methodName).OfType<IMethodSymbol>(); 384foreach (var methodSymbol in methodSymbols) 397static bool MatchExtensionMethod(IMethodSymbol method, string filterReceiverTypeName, bool internalsVisible, out ITypeSymbol? receiverType)
Completion\Providers\ImportCompletionProvider\ImportCompletionItem.cs (2)
182var methodSymbol = SymbolKey.ResolveString(methodSymbolKey, compilation).GetAnySymbol() as IMethodSymbol;
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (7)
265var constructor = CodeGenerationSymbolFactory.CreateConstructorSymbol( 285var constructor = CreateClassConstructor(semanticModel, typeName, properties, generator); 352var getMethod = prop.GetMethod != null ? CreateAccessorSymbol(prop, MethodKind.PropertyGet) : null; 353var setMethod = prop.SetMethod != null ? CreateAccessorSymbol(prop, MethodKind.PropertySet) : null; 370private static IMethodSymbol CreateAccessorSymbol(IPropertySymbol prop, MethodKind kind) 376private static IMethodSymbol CreateClassConstructor( 398var constructor = CodeGenerationSymbolFactory.CreateConstructorSymbol(
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (8)
256var indexer = GetInterfaceMember(collectionType, get_Item); 281var indexer = GetInterfaceMember(collectionType, get_Item); 301var countSymbol = GetInterfaceMember(current, get_Count); 302var indexerSymbol = GetInterfaceMember(current, get_Item); 308if (collectionType.FindImplementationForInterfaceMember(countSymbol) is not IMethodSymbol countImpl || 309collectionType.FindImplementationForInterfaceMember(indexerSymbol) is not IMethodSymbol indexerImpl) 349private static IMethodSymbol? GetInterfaceMember(ITypeSymbol interfaceType, string memberName) 354if (members is [IMethodSymbol method, ..])
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (3)
258var getEnumeratorMethod = TryFindMemberInThisOrBaseTypes<IMethodSymbol>( 281INamedTypeSymbol containingType, IMethodSymbol getEnumeratorMethod,
ConvertToInterpolatedString\AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs (3)
229var symbol = semanticModel.GetSymbolInfo(memberAccess, cancellationToken).Symbol as IMethodSymbol; 279return semanticModel.GetSymbolInfo(expression, cancellationToken).Symbol is IMethodSymbol
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (2)
76if (semanticModel.GetSymbolInfo(invocation, cancellationToken).GetAnySymbol() is not IMethodSymbol invocationSymbol) 226IMethodSymbol invocationSymbol,
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (5)
817var constructor = CreateConstructor(semanticModel, isRecord, structName, fields, generator, parameterNamingRule); 853private static IMethodSymbol GenerateDeconstructMethod( 855INamedTypeSymbol tupleType, IMethodSymbol constructor) 921private static IMethodSymbol CreateConstructor( 945var constructor = CodeGenerationSymbolFactory.CreateConstructorSymbol(
Debugging\AbstractBreakpointResolver.cs (5)
76protected abstract bool HasMethodBody(IMethodSymbol method, CancellationToken cancellationToken); 221: members.OfType<IMethodSymbol>().Where(m => m.TypeParameters.Length == nameAndArity.Arity); 232SymbolKind.Method => ((IMethodSymbol)symbol).PartialImplementationPart, 273return HasMethodBody((IMethodSymbol)methodOrProperty, cancellationToken); 287IMethodSymbol method => method.Parameters.Length != parameterCount,
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
142switch (((IMethodSymbol)symbol).MethodKind)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (12)
266protected abstract bool AreHandledEventsEqual(IMethodSymbol oldMethod, IMethodSymbol newMethod); 324SymbolKind.Method => GetDisplayName((IMethodSymbol)symbol), 354internal virtual string GetDisplayName(IMethodSymbol symbol) 454internal abstract IMethodSymbol GetLambdaExpressionSymbol(SemanticModel model, SyntaxNode lambdaExpression, CancellationToken cancellationToken); 2377protected static bool ReturnTypesEquivalent(IMethodSymbol oldMethod, IMethodSymbol newMethod, bool exact) 2452var oldMethod = (IMethodSymbol)oldMember; 2453var newMethod = (IMethodSymbol)newMember; 2459var newInvokeMethod = ((INamedTypeSymbol)newMember).DelegateInvokeMethod;
EditAndContinue\Utilities\Extensions.cs (11)
159=> symbol is IMethodSymbol { Parameters: [var parameter] } && SymbolEqualityComparer.Default.Equals(parameter.Type, symbol.ContainingType); 161public static bool HasDeconstructorSignature(this IMethodSymbol method, IMethodSymbol constructor) 189public static IMethodSymbol? GetMatchingDeconstructor(this IMethodSymbol constructor) 190=> (IMethodSymbol?)constructor.ContainingType.GetMembers(WellKnownMemberNames.DeconstructMethodName).FirstOrDefault( 191static (symbol, constructor) => symbol is IMethodSymbol method && HasDeconstructorSignature(method, constructor), constructor)?.PartialAsImplementation(); 200=> symbol is IMethodSymbol { IsPartialDefinition: true } or IPropertySymbol { IsPartialDefinition: true }; 203=> symbol is IMethodSymbol { PartialDefinitionPart: not null } or IPropertySymbol { PartialDefinitionPart: not null }; 208IMethodSymbol { PartialDefinitionPart: var def } => def, 216IMethodSymbol { PartialImplementationPart: var impl } => impl,
EmbeddedLanguages\DateAndTime\LanguageServices\DateAndTimeLanguageDetector.cs (2)
154=> symbol is IMethodSymbol method && 163private static bool AnalyzeStringLiteral(IMethodSymbol method, string? argName, int? argIndex)
EmbeddedLanguages\EmbeddedLanguageDetector.cs (2)
190m => m is IMethodSymbol { Parameters: [{ Type.SpecialType: SpecialType.System_String }, ..] }); 195if (impl is not IMethodSymbol { Parameters.Length: >= 1 } method)
EmbeddedLanguages\Json\LanguageServices\JsonLanguageDetector.cs (1)
144if (symbol is IMethodSymbol { DeclaredAccessibility: Accessibility.Public, IsStatic: true } &&
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexLanguageDetector.cs (1)
62from method in regexType.GetMembers().OfType<IMethodSymbol>()
EncapsulateField\AbstractEncapsulateFieldService.cs (2)
377protected static IMethodSymbol CreateSet(string originalFieldName, IFieldSymbol field, SyntaxGenerator factory) 396protected static IMethodSymbol CreateGet(string originalFieldName, IFieldSymbol field, SyntaxGenerator factory)
ExtractInterface\AbstractExtractInterfaceService.cs (3)
389var method = member as IMethodSymbol; 404IMethodSymbol getMethod = null;
ExtractMethod\Extensions.cs (2)
21var methodSymbol = info.Symbol as IMethodSymbol;
ExtractMethod\MethodExtractor.CodeGenerator.cs (4)
69protected abstract IMethodSymbol GenerateMethodDefinition(SyntaxNode insertionPointNode, CancellationToken cancellationToken); 88SemanticDocument originalDocument, IMethodSymbol methodSymbolResult, CancellationToken cancellationToken); 94var newMethodDefinition = GenerateMethodDefinition(insertionPoint.GetContext(), cancellationToken); 112InsertionPoint insertionPoint, IMethodSymbol newMethodDefinition, CancellationToken cancellationToken)
ExtractMethod\MethodExtractor.VariableSymbol.cs (4)
139var compare = CompareMethodParameters((IMethodSymbol)_parameterSymbol.ContainingSymbol, (IMethodSymbol)other._parameterSymbol.ContainingSymbol); 149private static int CompareMethodParameters(IMethodSymbol left, IMethodSymbol right)
GenerateComparisonOperators\GenerateComparisonOperatorsCodeRefactoringProvider.cs (9)
81var compareMethod = TryGetCompareMethodImpl(containingType, iface); 122private static IMethodSymbol? TryGetCompareMethodImpl(INamedTypeSymbol containingType, ITypeSymbol comparableType) 126if (member is IMethodSymbol method) 127return (IMethodSymbol?)containingType.FindImplementationForInterfaceMember(method); 142var compareMethod = TryGetCompareMethodImpl(containingType, comparableType)!; 161IMethodSymbol compareMethod) 174private static ImmutableArray<IMethodSymbol> GenerateComparisonOperators( 181using var _ = ArrayBuilder<IMethodSymbol>.GetInstance(out var operators); 245if (member is IMethodSymbol method &&
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.State.cs (5)
24public IMethodSymbol? MatchingConstructor { get; private set; } 25public IMethodSymbol? DelegatedConstructor { get; private set; } 97private static IMethodSymbol? GetDelegatedConstructorBasedOnParameterTypes( 114private static IMethodSymbol? GetMatchingConstructorBasedOnParameterTypes(INamedTypeSymbol containingType, ImmutableArray<IParameterSymbol> parameters) 117private static bool MatchesConstructorBasedOnParameterTypes(IMethodSymbol constructor, ImmutableArray<IParameterSymbol> parameters)
GenerateEqualsAndGetHashCodeFromMembers\AbstractGenerateEqualsAndGetHashCodeService.cs (5)
38public async Task<IMethodSymbol> GenerateEqualsMethodAsync( 50public async Task<IMethodSymbol> GenerateIEquatableEqualsMethodAsync( 61public async Task<IMethodSymbol> GenerateEqualsMethodThroughIEquatableEqualsAsync( 117public async Task<IMethodSymbol> GenerateGetHashCodeMethodAsync( 127private IMethodSymbol CreateGetHashCodeMethod(
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeAction.cs (7)
49using var _ = ArrayBuilder<IMethodSymbol>.GetInstance(out var methods); 125private async Task AddOperatorsAsync(ArrayBuilder<IMethodSymbol> members, CancellationToken cancellationToken) 141private IMethodSymbol CreateEqualityOperator( 170private static IMethodSymbol CreateInequalityOperator(Compilation compilation, SyntaxGenerator generator, ImmutableArray<IParameterSymbol> parameters) 187private Task<IMethodSymbol> CreateGetHashCodeMethodAsync(CancellationToken cancellationToken) 193private Task<IMethodSymbol> CreateEqualsMethodAsync(CancellationToken cancellationToken) 201private async Task<IMethodSymbol> CreateIEquatableEqualsMethodAsync(INamedTypeSymbol constructedEquatableType, CancellationToken cancellationToken)
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (3)
127.OfType<IMethodSymbol>() 159.OfType<IMethodSymbol>() 163.OfType<IMethodSymbol>()
GenerateEqualsAndGetHashCodeFromMembers\IGenerateEqualsAndGetHashCodeService.cs (4)
29Task<IMethodSymbol> GenerateEqualsMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, string? localNameOpt, CancellationToken cancellationToken); 35Task<IMethodSymbol> GenerateEqualsMethodThroughIEquatableEqualsAsync(Document document, INamedTypeSymbol namedType, CancellationToken cancellationToken); 41Task<IMethodSymbol> GenerateIEquatableEqualsMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, INamedTypeSymbol constructedEquatableType, CancellationToken cancellationToken); 50Task<IMethodSymbol> GenerateGetHashCodeMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, CancellationToken cancellationToken);
GenerateEqualsAndGetHashCodeFromMembers\IGenerateEqualsAndGetHashCodeServiceExtensions.cs (1)
13public static Task<IMethodSymbol> GenerateEqualsMethodAsync(
GenerateType\AbstractGenerateTypeService.GenerateNamedType.cs (1)
155var delegatedConstructor = _state.BaseTypeOrInterfaceOpt.InstanceConstructors.FirstOrDefault(
GenerateType\AbstractGenerateTypeService.State.cs (2)
57public IMethodSymbol? DelegateMethodSymbol { get; private set; } 426public IMethodSymbol? DelegateCreationMethodSymbol { get; set; }
GoToBase\AbstractGoToBaseService.cs (6)
17protected abstract Task<IMethodSymbol?> FindNextConstructorInChainAsync( 18Solution solution, IMethodSymbol constructor, CancellationToken cancellationToken); 20protected static IMethodSymbol? FindBaseNoArgConstructor(IMethodSymbol constructor) 47if (bases.Length == 0 && symbol is IMethodSymbol { MethodKind: MethodKind.Constructor } constructor) 49var nextConstructor = await FindNextConstructorInChainAsync(solution, constructor, cancellationToken).ConfigureAwait(false);
GoToDefinition\GoToDefinitionFeatureHelpers.cs (1)
49symbol = (symbol as IMethodSymbol)?.PartialImplementationPart ?? symbol;
InheritanceMargin\AbstractInheritanceMarginService.cs (1)
76or IMethodSymbol
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (3)
67if (symbol is IEventSymbol or IPropertySymbol or IMethodSymbol) 590if (memberSymbol is IMethodSymbol or IEventSymbol or IPropertySymbol) 623if (memberSymbol is IMethodSymbol or IEventSymbol or IPropertySymbol
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (10)
54IMethodSymbol methodSymbol, 87IMethodSymbol methodSymbol, 162document = await AddStringCheckAsync(document, parameter, functionDeclaration, (IMethodSymbol)parameter.ContainingSymbol, blockStatementOpt, nameof(string.IsNullOrEmpty), lazySimplifierOptions, cancellationToken).ConfigureAwait(false); 168(IMethodSymbol)parameter.ContainingSymbol, blockStatementOpt, lazySimplifierOptions, cancellationToken).ConfigureAwait(false); 300var targetMethod = invocation.TargetMethod; 315IMethodSymbol method, 338IMethodSymbol method, 354IMethodSymbol method, 414var methodSymbol = (IMethodSymbol)parameter.ContainingSymbol;
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (7)
48protected abstract SyntaxNode? GetAccessorBody(IMethodSymbol accessor, CancellationToken cancellationToken); 53Document document, SyntaxNode functionDeclaration, IMethodSymbol method, IBlockOperation? blockStatementOpt, 65IMethodSymbol method, 110IMethodSymbol method, 161IMethodSymbol method, 220IMethodSymbol method) 336var getMethod = CodeGenerationSymbolFactory.CreateAccessorSymbol(
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (3)
41IMethodSymbol method, 52IMethodSymbol methodSymbol, 85if (parameter.ContainingSymbol is not IMethodSymbol methodSymbol ||
InitializeParameter\InitializeParameterHelpersCore.cs (1)
19if (parameter.ContainingSymbol is IMethodSymbol method)
InlineHints\AbstractInlineParameterNameHintsService.cs (1)
225if (parameter is not { ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.Ordinary or MethodKind.LocalFunction } method })
InlineMethod\AbstractInlineMethodRefactoringProvider.cs (7)
92var calleeMethodSymbol = semanticModel.GetSymbolInfo(calleeInvocationNode, cancellationToken).GetAnySymbol() as IMethodSymbol; 248IMethodSymbol calleeMethodSymbol, 291IMethodSymbol calleeMethodSymbol, 366IMethodSymbol calleeMethodSymbol, 383if (callerSymbol is IMethodSymbol callerMethodSymbol 420IMethodSymbol calleeMethodSymbol,
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (2)
46IMethodSymbol calleeMethodSymbol, 323IMethodSymbol calleeMethodSymbol,
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (5)
47protected abstract bool IsDestructor(IMethodSymbol methodSymbol); 75if (containingSymbol is not IMethodSymbol methodSymbol) 141TExpressionSyntax expression, IMethodSymbol methodSymbol, SyntaxNode containingMethod, 238IMethodSymbol methodSymbol, SyntaxNode containingMethod, Dictionary<Document, List<TExpressionSyntax>> methodCallSites, bool allOccurrences, IntroduceParameterCodeActionKind selectedCodeAction, 271Document document, IMethodSymbol methodSymbol, CancellationToken cancellationToken)
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (2)
27IMethodSymbol methodSymbol, 38private readonly IMethodSymbol _methodSymbol = methodSymbol;
LanguageServiceIndexFormat\SymbolMoniker.cs (1)
33if (symbol is IMethodSymbol method && method.MethodKind == MethodKind.BuiltinOperator)
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.cs (2)
46IMethodSymbol invokeMethod, 149if (symbol is IMethodSymbol method)
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.StructuralTypeCollectorVisitor.cs (1)
47public override void VisitMethod(IMethodSymbol symbol)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (3)
319else if (symbol is IMethodSymbol method) 624private void AddDescriptionForMethod(IMethodSymbol method) 723.Where(s => s is IMethodSymbol || s.IsIndexer())
MetadataAsSource\AbstractMetadataAsSourceService.WrappedEventSymbol.cs (3)
28public IMethodSymbol? AddMethod => _symbol.AddMethod; 31public IMethodSymbol? RaiseMethod => _symbol.RaiseMethod; 32public IMethodSymbol? RemoveMethod => _symbol.RemoveMethod;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedMethodSymbol.cs (13)
15private class WrappedMethodSymbol(IMethodSymbol methodSymbol, bool canImplementImplicitly, IDocumentationCommentFormattingService docCommentFormattingService) : AbstractWrappedSymbol(methodSymbol, canImplementImplicitly, docCommentFormattingService), IMethodSymbol 17private readonly IMethodSymbol _symbol = methodSymbol; 25public IMethodSymbol ConstructedFrom => _symbol.ConstructedFrom; 32public ImmutableArray<IMethodSymbol> ExplicitInterfaceImplementations 52public new IMethodSymbol OriginalDefinition 60public IMethodSymbol OverriddenMethod => _symbol.OverriddenMethod; 64public IMethodSymbol PartialDefinitionPart => _symbol.PartialDefinitionPart; 66public IMethodSymbol PartialImplementationPart => _symbol.PartialImplementationPart; 74public IMethodSymbol ReducedFrom 109public IMethodSymbol Construct(params ITypeSymbol[] typeArguments) 112public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 118public IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (5)
49SymbolKind.Method => new WrappedMethodSymbol((IMethodSymbol)m, canImplementImplicitly, docCommentFormattingService), 71public IMethodSymbol DelegateInvokeMethod => _symbol.DelegateInvokeMethod; 81public ImmutableArray<IMethodSymbol> InstanceConstructors => _symbol.InstanceConstructors; 82public ImmutableArray<IMethodSymbol> StaticConstructors => _symbol.StaticConstructors; 83public ImmutableArray<IMethodSymbol> Constructors => _symbol.Constructors;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedPropertySymbol.cs (2)
28public IMethodSymbol GetMethod => _symbol.GetMethod; 50public IMethodSymbol SetMethod => _symbol.SetMethod;
PullMemberUp\MemberAndDestinationValidator.cs (1)
46IMethodSymbol methodSymbol => methodSymbol.MethodKind == MethodKind.Ordinary,
PullMemberUp\MembersPuller.cs (6)
75private static IMethodSymbol FilterOutNonPublicAccessor(IMethodSymbol getterOrSetter) 84private static IMethodSymbol MakePublicAccessor(IMethodSymbol getterOrSetter) 180else if (member is IMethodSymbol methodSymbol) 456if (member is IMethodSymbol methodSymbol)
QuickInfo\CommonSemanticQuickInfoProvider.ErrorVisitor.cs (1)
38public override bool VisitMethod(IMethodSymbol symbol)
Rename\SymbolicRenameInfo.cs (1)
206if (symbol.Kind == SymbolKind.Method && ((IMethodSymbol)symbol).MethodKind == MethodKind.UserDefinedOperator)
ReplaceMethodWithProperty\AbstractReplaceMethodWithPropertyService.cs (2)
31private static bool OverridesMetadataSymbol(IMethodSymbol method) 33for (var current = method; current != null; current = current.OverriddenMethod)
ReplaceMethodWithProperty\IReplaceMethodWithPropertyService.cs (4)
32IMethodSymbol getMethod, IMethodSymbol setMethod, 35public readonly IMethodSymbol GetMethod = getMethod; 36public readonly IMethodSymbol SetMethod = setMethod;
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (20)
54if (semanticModel.GetDeclaredSymbol(methodDeclaration) is not IMethodSymbol methodSymbol || 96private static IMethodSymbol? FindSetMethod(IMethodSymbol getMethod) 101.OfType<IMethodSymbol>() 109private static bool IsValidGetMethod(IMethodSymbol getMethod) 121private static bool OverridesMethodFromSystemObject(IMethodSymbol method) 123for (var current = method; current != null; current = current.OverriddenMethod) 134private static bool IsValidSetMethod(IMethodSymbol setMethod, IMethodSymbol getMethod) 142private static bool IsValidSetMethod(IMethodSymbol setMethod) 155IMethodSymbol getMethod, 156IMethodSymbol? setMethod, 344MultiDictionary<DocumentId, IMethodSymbol>.ValueSet originalGetDefinitions, 345MultiDictionary<DocumentId, IMethodSymbol>.ValueSet originalSetDefinitions, 401MultiDictionary<DocumentId, IMethodSymbol>.ValueSet originalDefinitions, 433private static async Task<SyntaxNode?> GetMethodDeclarationAsync(IMethodSymbol? method, CancellationToken cancellationToken) 445private static async Task<MultiDictionary<DocumentId, IMethodSymbol>> GetDefinitionsByDocumentIdAsync( 450var result = new MultiDictionary<DocumentId, IMethodSymbol>(); 455var definition = referencedSymbol.Definition as IMethodSymbol;
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (2)
145.OfType<IMethodSymbol>() 155.OfType<IMethodSymbol>()
RQName\RQNodeBuilder.cs (2)
24IMethodSymbol methodSymbol => BuildMethod(methodSymbol), 198private static RQMethod? BuildMethod(IMethodSymbol symbol)
Shared\Extensions\ISymbolExtensions_2.cs (5)
96var methodSymbol = (IMethodSymbol)symbol; 195IMethodSymbol method => GetMethodDocumentation(method, compilation, cancellationToken), 204if (containingSymbol.ContainingSymbol.IsDelegateType() && containingSymbol is IMethodSymbol methodSymbol) 246private static DocumentationComment GetMethodDocumentation(this IMethodSymbol method, Compilation compilation, CancellationToken cancellationToken)
Shared\Extensions\ISymbolExtensions_Sorting.cs (4)
107private static int CompareMethods(IMethodSymbol xMethod, string[] xTypeNames, IMethodSymbol yMethod, string[] yTypeNames) 175? CompareMethods((IMethodSymbol)s1, symbol1ParameterTypeNames, (IMethodSymbol)s2, symbol2ParameterTypeNames)
Shared\Utilities\ExtractTypeHelpers.cs (2)
206var method = member as IMethodSymbol;
SignatureHelp\AbstractSignatureHelpProvider.cs (1)
275if (symbol is IMethodSymbol methodSymbol && methodSymbol.IsGenericMethod && methodSymbol != methodSymbol.OriginalDefinition)
SignatureHelp\CommonSignatureHelpUtilities.cs (2)
147public static async Task<ImmutableArray<IMethodSymbol>> GetCollectionInitializerAddMethodsAsync( 172var addMethods = addSymbols.OfType<IMethodSymbol>()
src\Analyzers\Core\Analyzers\Helpers\DeserializationConstructorCheck.cs (1)
17public bool IsDeserializationConstructor(IMethodSymbol methodSymbol)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (8)
20private readonly IMethodSymbol _objectGetHashCodeMethod; 26Compilation compilation, IMethodSymbol objectGetHashCodeMethod, 43if (objectType?.GetMembers(nameof(GetHashCode)).FirstOrDefault() is not IMethodSymbol objectGetHashCodeMethod) 64if (owningSymbol is not IMethodSymbol { Name: nameof(GetHashCode) } method) 90IMethodSymbol method, ImmutableArray<IOperation> statements) 113IMethodSymbol method, ImmutableArray<IOperation> statements) 211private bool OverridesSystemObject(IMethodSymbol? method) 213for (var current = method; current != null; current = current.OverriddenMethod)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (3)
22HashCodeAnalyzer analyzer, IMethodSymbol method, ILocalSymbol? hashCodeVariable) : IDisposable 25private readonly IMethodSymbol _method = method; 62var targetMethod = invocation.TargetMethod;
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (1)
123if (symbol is IMethodSymbol methodSymbol && methodSymbol.IsEntryPoint(compilation.TaskType(), compilation.TaskOfTType()))
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (1)
149return symbol == null || symbol.IsStatic || symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction };
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (8)
374var targetMethod = ((IInvocationOperation)operationContext.Operation).TargetMethod.OriginalDefinition; 423var constructor = ((IObjectCreationOperation)operationContext.Operation).Constructor?.OriginalDefinition; 450var entryPoint = symbolEndContext.Compilation.GetEntryPoint(cancellationToken); 558case IMethodSymbol: 726var methodSymbol = (IMethodSymbol)memberSymbol; 845private bool IsMethodWithSpecialAttribute(IMethodSymbol methodSymbol) 848private static bool IsShouldSerializeOrResetPropertyMethod(IMethodSymbol methodSymbol)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
112protected abstract bool MethodHasHandlesClause(IMethodSymbol method);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
431if (owningSymbol is IMethodSymbol method && 714if (context.OwningSymbol is not IMethodSymbol method)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (3)
36private readonly ConcurrentDictionary<IMethodSymbol, bool> _methodsUsedAsDelegates = []; 206parameter.ContainingSymbol is not IMethodSymbol method || 291IMethodSymbol method,
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
122private static bool IsObjectToStringOverride(IMethodSymbol method)
src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (10)
56if (!TryGetLinqWhereExtensionMethod(enumerableType, out var whereMethodSymbol)) 78static bool TryGetLinqWhereExtensionMethod(INamedTypeSymbol enumerableType, [NotNullWhen(true)] out IMethodSymbol? whereMethod) 80foreach (var whereMethodSymbol in enumerableType.GetMembers(nameof(Enumerable.Where)).OfType<IMethodSymbol>()) 96static bool TryGetLinqMethodsThatDoNotReturnEnumerables(INamedTypeSymbol enumerableType, out ImmutableArray<IMethodSymbol> linqMethods) 98using var _ = ArrayBuilder<IMethodSymbol>.GetInstance(out var linqMethodSymbolsBuilder); 99foreach (var method in enumerableType.GetMembers().OfType<IMethodSymbol>()) 113public void AnalyzeInvocationOperation(OperationAnalysisContext context, INamedTypeSymbol enumerableType, IMethodSymbol whereMethod, ImmutableArray<IMethodSymbol> linqMethods)
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (5)
79protected abstract TExpression? GetGetterExpression(IMethodSymbol getMethod, CancellationToken cancellationToken); 80protected abstract TExpression? GetSetterExpression(IMethodSymbol setMethod, SemanticModel semanticModel, CancellationToken cancellationToken); 293var setMethod = property.SetMethod; 326private IFieldSymbol? GetSetterField(SemanticModel semanticModel, IMethodSymbol setMethod, CancellationToken cancellationToken) 329private IFieldSymbol? GetGetterField(SemanticModel semanticModel, IMethodSymbol getMethod, CancellationToken cancellationToken)
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerAnalyzer.cs (1)
196return addMethods.Any(static m => m is IMethodSymbol methodSymbol && methodSymbol.Parameters.Any());
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (3)
235var method = this.SemanticModel.GetSymbolInfo(memberAccess, cancellationToken).GetAnySymbol() as IMethodSymbol; 262useSpread = method.GetOriginalUnreducedDefinition() is not IMethodSymbol { IsExtensionMethod: true, Parameters: [_, { Type: ITypeParameterSymbol }] };
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (3)
37var referenceEqualsMethod = objectType.GetMembers(nameof(ReferenceEquals)) 38.OfType<IMethodSymbol>() 56private void AnalyzeSyntax(SyntaxNodeAnalysisContext context, IMethodSymbol referenceEqualsMethod, bool unconstraintedGenericSupported)
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (6)
87var referenceEqualsMethod = objectType?.GetMembers(nameof(ReferenceEquals)) 88.OfType<IMethodSymbol>() 105IMethodSymbol? referenceEqualsMethod) 169if (semanticModel.GetSymbolInfo(name, cancellationToken).GetAnySymbol() is IMethodSymbol) 199IMethodSymbol? referenceEqualsMethod, 254IMethodSymbol? referenceEqualsMethod,
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer_IfStatement.cs (1)
30IMethodSymbol? referenceEqualsMethod)
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (4)
107var method = TryGetValidFormatMethodSymbol(symbolInfo); 280protected static IMethodSymbol? TryGetValidFormatMethodSymbol(SymbolInfo symbolInfo) 292if (((IMethodSymbol)symbolInfo.Symbol).MethodKind == MethodKind.LocalFunction) 308return (IMethodSymbol)symbolInfo.Symbol;
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
50if (symbol is IMethodSymbol or IPropertySymbol or IEventSymbol)
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (1)
61foreach (var candidateSymbol in candidateSymbols.OfType<IMethodSymbol>())
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (9)
78if (semanticModel.GetEnclosingSymbol(node.SpanStart, cancellationToken) is IMethodSymbol methodWithDiagnostic) 124var candidates = semanticModel.GetMemberGroup(expression, cancellationToken).OfType<IMethodSymbol>().ToImmutableArray(); 157IMethodSymbol methodSymbol => methodSymbol.ContainingType, // Implicit object creation expressions 188ImmutableArray<IMethodSymbol> methodCandidates) 193foreach (var method in methodCandidates.OrderBy(m => m.Parameters.Length)) 226private static int NonParamsParameterCount(IMethodSymbol method) 350private static string GetCodeFixTitle(string resourceString, IMethodSymbol methodToUpdate, bool includeParameters) 368IMethodSymbol method, 434IMethodSymbol method,
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (6)
26public static bool HasCascadingDeclarations(IMethodSymbol method) 75IMethodSymbol method, 147private static async Task<ImmutableArray<IMethodSymbol>> FindMethodDeclarationReferencesAsync( 148Document invocationDocument, IMethodSymbol method, CancellationToken cancellationToken) 154.OfType<IMethodSymbol>() 160IMethodSymbol method,
src\Analyzers\Core\CodeFixes\AddParameter\ArgumentInsertPositionData.cs (2)
7internal readonly struct ArgumentInsertPositionData<TArgumentSyntax>(IMethodSymbol methodToUpdate, TArgumentSyntax argumentToInsert, int argumentInsertionIndex) where TArgumentSyntax : SyntaxNode 9public IMethodSymbol MethodToUpdate { get; } = methodToUpdate;
src\Analyzers\Core\CodeFixes\AddParameter\CodeFixData.cs (2)
12IMethodSymbol method, 20public IMethodSymbol Method { get; } = method ?? throw new ArgumentNullException(nameof(method));
src\Analyzers\Core\CodeFixes\AddParameter\RegisterFixData.cs (1)
9internal class RegisterFixData<TArgumentSyntax>(SeparatedSyntaxList<TArgumentSyntax> arguments, ImmutableArray<IMethodSymbol> methodCandidates, bool isConstructorInitializer)
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (5)
43protected abstract IMethodSymbol GetCurrentConstructor(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken); 44protected abstract IMethodSymbol GetDelegatedConstructor(SemanticModel semanticModel, IMethodSymbol constructor, CancellationToken cancellationToken); 46protected bool WillCauseConstructorCycle(State state, SemanticDocument document, IMethodSymbol delegatedConstructor, CancellationToken cancellationToken) 50var currentConstructor = GetCurrentConstructor(document.SemanticModel, state.Token, cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (8)
54private IMethodSymbol? _delegatedConstructor; 154var delegatedConstructor = FindConstructorToDelegateTo(parameters, expressions, cancellationToken); 184private IMethodSymbol? FindConstructorToDelegateTo( 205private IMethodSymbol? FindConstructorToDelegateTo( 208ImmutableArray<IMethodSymbol> constructors, 213foreach (var constructor in constructors) 251private bool Matches(IMethodSymbol ctor, ISyntaxFactsService service) 594var constructor = CodeGenerationSymbolFactory.CreateConstructorSymbol(
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (4)
21IMethodSymbol constructor) 74IMethodSymbol constructor, 82var constructorInCompilation = (IMethodSymbol?)SymbolKey.Create(constructor).Resolve(semanticModel.Compilation).Symbol;
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.AbstractCodeAction.cs (5)
27private readonly IList<IMethodSymbol> _constructors; 35IList<IMethodSymbol> constructors, 60private IMethodSymbol CreateConstructorDefinition( 61IMethodSymbol baseConstructor) 82private static Accessibility DetermineAccessibility(IMethodSymbol baseConstructor, INamedTypeSymbol classType)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.CodeAction.cs (2)
15IMethodSymbol constructor) : AbstractCodeAction(document, state, [constructor], GetDisplayText(state, constructor)) 17private static string GetDisplayText(State state, IMethodSymbol constructor)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.CodeActionAll.cs (1)
15IList<IMethodSymbol> constructors)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (1)
40foreach (var constructor in state.UnimplementedConstructors)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (4)
21public ImmutableArray<IMethodSymbol> UnimplementedConstructors { get; private set; } 97var baseNoArgConstructor = baseType.Constructors.FirstOrDefault(c => c.Parameters.Length == 0); 119IMethodSymbol constructor, 120ImmutableArray<IMethodSymbol> classConstructors,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.cs (2)
26protected abstract bool TryInitializeImplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn); 27protected abstract bool TryInitializeExplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.State.cs (2)
62out var identifierToken, out var methodSymbol, out var typeToGenerateIn)) 86out var identifierToken, out var methodSymbol, out var typeToGenerateIn))
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.State.cs (1)
71var methodSymbol = CodeGenerationSymbolFactory.CreateMethodSymbol(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.cs (1)
26protected abstract bool TryInitializeExplicitInterfaceState(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.State.cs (2)
89out var identifierToken, out var methodSymbol, out var typeToGenerateIn)) 247private static IMethodSymbol CreateMethodSymbolWithReturnType(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs (2)
18IMethodSymbol methodSymbol, 21private readonly IMethodSymbol _methodSymbol = methodSymbol;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (4)
76var getMethod = CodeGenerationSymbolFactory.CreateAccessorSymbol( 81var setMethod = includeSetter ? getMethod : null; 96public async ValueTask<IMethodSymbol> GenerateMethodAsync( 111var method = CodeGenerationSymbolFactory.CreateMethodSymbol(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.State.cs (1)
83.OfType<IMethodSymbol>();
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (3)
69var getAccessor = CreateAccessor(_state.DetermineMaximalAccessibility()); 70var setAccessor = _isReadonly || _refKind != RefKind.None 106private IMethodSymbol CreateAccessor(Accessibility accessibility)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
212var containingMethod = state.ContainingMethod;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (4)
31public IMethodSymbol ContainingMethod { get; private set; } 397private static IMethodSymbol FindContainingMethodSymbol(int position, SemanticModel semanticModel, CancellationToken cancellationToken) 402if (symbol is IMethodSymbol method && !method.IsAnonymousFunction()) 480var enclosingMethodSymbol = _document.SemanticModel.GetEnclosingSymbol<IMethodSymbol>(SimpleNameOrMemberAccessExpressionOpt.SpanStart, cancellationToken);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (5)
169IMethodSymbol method => GenerateMethod(compilation, method, throughMember, modifiers, accessibility), 177Compilation compilation, IMethodSymbol method, ISymbol? throughMember, 248private IMethodSymbol? GetEventAddOrRemoveMethod( 249IEventSymbol @event, IMethodSymbol? accessor, ISymbol? throughMember, 267private bool ShouldGenerateAccessor([NotNullWhen(true)] IMethodSymbol? method)
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.cs (1)
26protected abstract string ToDisplayString(IMethodSymbol disposeImplMethod, SymbolDisplayFormat format);
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (4)
147case IMethodSymbol methodSymbol: 230var disposeMethod = TryGetIDisposableDispose(compilation); 246public static IMethodSymbol? TryGetIDisposableDispose(Compilation compilation) 254if (member is IMethodSymbol { IsStatic: false, ReturnsVoid: true, Arity: 0, Parameters.Length: 0 } disposeMethod)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (7)
259if (member is not IMethodSymbol method) 295if (member is IMethodSymbol method) 312var accessor = CodeGenerationSymbolFactory.CreateAccessorSymbol( 327private IMethodSymbol? GetAddOrRemoveMethod( 328IEventSymbol @event, bool generateInvisibly, IMethodSymbol accessor, string memberName, 364if (member is IMethodSymbol method1 && baseMember is IMethodSymbol method2)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_DisposePattern.cs (9)
55var disposeMethod = TryGetIDisposableDispose(compilation)!; 119IMethodSymbol disposeMethod, 122var disposeImplMethod = CreateDisposeImplementationMethod(compilation, disposeMethod, disposedValueField); 126var disposeInterfaceMethod = CreateDisposeInterfaceMethod( 135private IMethodSymbol CreateDisposeImplementationMethod( 137IMethodSymbol disposeMethod, 186private IMethodSymbol CreateDisposeInterfaceMethod( 188IMethodSymbol disposeMethod, 223var result = CodeGenerationSymbolFactory.CreateMethodSymbol(
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Method.cs (2)
24IMethodSymbol method, 50private SyntaxNode CreateStatement(Compilation compilation, IMethodSymbol method)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (4)
41var getAccessor = GenerateGetAccessor( 45var setAccessor = GenerateSetAccessor( 90private IMethodSymbol? GenerateSetAccessor( 123private IMethodSymbol? GenerateGetAccessor(
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (9)
29bool keepVoid, IMethodSymbol methodSymbol, SyntaxNode node, KnownTaskTypes knownTypes, CancellationToken cancellationToken); 58var methodSymbol = GetMethodSymbol(semanticModel, node, cancellationToken); 87private static IMethodSymbol? GetMethodSymbol(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken) 91return symbol as IMethodSymbol; 116var methodSymbol = GetMethodSymbol(semanticModel, node, cancellationToken); 158IMethodSymbol methodSymbol, 177var newMethod = (IMethodSymbol)semanticModel.GetRequiredDeclaredSymbol(newNode, cancellationToken); 187IMethodSymbol methodSymbol,
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (8)
25protected abstract SyntaxNode RemoveAsyncTokenAndFixReturnType(IMethodSymbol methodSymbol, SyntaxNode node, KnownTaskTypes knownTypes); 58var methodSymbol = (IMethodSymbol?)(semanticModel.GetDeclaredSymbol(node, cancellationToken) ?? semanticModel.GetSymbolInfo(node, cancellationToken).GetAnySymbol()); 73private async Task<Solution> RenameThenRemoveAsyncTokenAsync(Document document, SyntaxNode node, IMethodSymbol methodSymbol, CancellationToken cancellationToken) 89var newMethod = (IMethodSymbol)semanticModel.GetRequiredDeclaredSymbol(newNode, cancellationToken); 97Document document, IMethodSymbol methodSymbol, SyntaxNode node, CancellationToken cancellationToken) 128if (semanticModel.GetDeclaredSymbol(methodDeclaration, cancellationToken) is IMethodSymbol methodSymbol)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (5)
45var methodSymbol = GetMethodSymbol(node, semanticModel, cancellationToken); 85var methodSymbol = GetMethodSymbol(node, semanticModel, cancellationToken); 104private static IMethodSymbol? GetMethodSymbol(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken) 105=> semanticModel.GetSymbolInfo(node, cancellationToken).Symbol as IMethodSymbol ?? 106semanticModel.GetDeclaredSymbol(node, cancellationToken) as IMethodSymbol;
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (9)
190foreach (var method in GetMatchingMethods(candidateMembers, arity, parameters, returnType)) 504var methodContext = bindingContext as IMethodSymbol; 546var methodContext = bindingContext as IMethodSymbol; 738private ImmutableArray<IMethodSymbol> GetMatchingMethods(ImmutableArray<ISymbol> candidateMembers, int? arity, ParameterInfo[] parameters, TypeInfo? returnType) 740var builder = new ArrayBuilder<IMethodSymbol>(); 744var methodSymbol = symbol as IMethodSymbol;
StackTraceExplorer\AbstractStackTraceSymbolResolver.cs (3)
15public abstract Task<IMethodSymbol?> TryGetBestMatchAsync( 109protected static IMethodSymbol? TryGetBestMatch(ImmutableArray<IMethodSymbol> candidateFunctions,
StackTraceExplorer\StackFrameLocalMethodResolver.cs (1)
17public override async Task<IMethodSymbol?> TryGetBestMatchAsync(
StackTraceExplorer\StackFrameMethodSymbolResolver.cs (3)
15public override Task<IMethodSymbol?> TryGetBestMatchAsync(Project project, 26.OfType<IMethodSymbol>() 30var match = TryGetBestMatch(candidateMethods, methodTypeArguments, methodArguments);
StackTraceExplorer\StackTraceExplorerUtilities.cs (2)
93DefinitionItem GetDefinition(IMethodSymbol method) 108private static async Task<IMethodSymbol?> TryGetBestMatchAsync(Project project, string fullyQualifiedTypeName, StackFrameSimpleNameNode methodNode, StackFrameParameterList methodArguments, StackFrameTypeArgumentList? methodTypeArguments, CancellationToken cancellationToken)
ValueTracking\ValueTracker.cs (4)
128case IMethodSymbol methodSymbol: 188private static async Task TrackMethodSymbolAsync(IMethodSymbol methodSymbol, OperationCollector collector, CancellationToken cancellationToken) 244static bool HasAValueReturn(IMethodSymbol methodSymbol) 249static bool HasAnOutOrRefParam(IMethodSymbol methodSymbol)
ValueTracking\ValueTracker.FindReferencesProgress.cs (1)
49if (symbol is IMethodSymbol methodSymbol)
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\EditAndContinueTestVerifier.cs (1)
255edit.OldSymbol is IMethodSymbol)
Microsoft.CodeAnalysis.Rebuild (3)
CompilationFactory.cs (3)
113var debugEntryPoint = getDebugEntryPoint(); 175IMethodSymbol? getDebugEntryPoint() 184.OfType<IMethodSymbol>();
Microsoft.CodeAnalysis.Scripting (2)
ScriptBuilder.cs (2)
128var entryPoint = compilation.GetEntryPoint(cancellationToken); 189internal static MethodInfo GetEntryPointRuntimeMethod(IMethodSymbol entryPoint, Assembly assembly)
Microsoft.CodeAnalysis.Test.Utilities (29)
Compilation\CompilationExtensions.cs (2)
56IMethodSymbol debugEntryPoint = null, 383if ((parameterInitializerOperation.Parameter.ContainingSymbol as IMethodSymbol)?.MethodKind is not (MethodKind.LocalFunction or MethodKind.AnonymousFunction))
Compilation\ControlFlowGraphVerifier.cs (8)
117var localFunctionsMap = PooledDictionary<IMethodSymbol, ControlFlowGraph>.GetInstance(); 328foreach (IMethodSymbol m in graph.LocalFunctions) 1394foreach (IMethodSymbol method in region.LocalFunctions) 1518var method = region.LocalFunctions[i]; 1670foreach (IMethodSymbol m in region.LocalFunctions) 1699IMethodSymbol method; 1755while (symbol is IMethodSymbol m) 1992return symbol is IMethodSymbol
Compilation\OperationTreeVerifier.cs (2)
1208var unaryOperatorMethod = ((BinaryOperation)operation).UnaryOperatorMethod; 1227private void LogHasOperatorMethodExpressionCommon(IMethodSymbol operatorMethodOpt, ITypeSymbol constrainedToTypeOpt)
Compilation\TestOperationVisitor.cs (10)
569var signature = operation.GetFunctionPointerSignature(); 749var operatorMethod = operation.OperatorMethod; 764var operatorMethod = operation.OperatorMethod; 765var unaryOperatorMethod = ((BinaryOperation)operation).UnaryOperatorMethod; 803if (symbol is IMethodSymbol method) 841var operatorMethod = operation.OperatorMethod; 1023var constructor = operation.Constructor; 1171var operatorMethod = operation.OperatorMethod; 1200var operatorMethod = operation.OperatorMethod; 1487case IMethodSymbol method:
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (1)
52if (operationBlockContext.OwningSymbol is IMethodSymbol containingMethod)
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (1)
46if (operationBlockContext.OwningSymbol is IMethodSymbol containingMethod)
Diagnostics\LocalCouldBeConstAnalyzer.cs (1)
40if (operationBlockContext.OwningSymbol is IMethodSymbol containingMethod)
Diagnostics\TrackingDiagnosticAnalyzer.cs (4)
40MethodKind = symbol is IMethodSymbol ? ((IMethodSymbol)symbol).MethodKind : (MethodKind?)null; 41ReturnsVoid = symbol is IMethodSymbol ? ((IMethodSymbol)symbol).ReturnsVoid : false;
Microsoft.CodeAnalysis.VisualBasic (125)
Analysis\FlowAnalysis\VisualBasicDataFlowAnalysis.vb (2)
289Public Overrides ReadOnly Property UsedLocalFunctions As ImmutableArray(Of IMethodSymbol) 291Return ImmutableArray(Of IMethodSymbol).Empty
Compilation\AwaitExpressionInfo.vb (6)
19Friend Sub New(getAwaiter As IMethodSymbol, isCompleted As IPropertySymbol, getResult As IMethodSymbol) 25Private ReadOnly _getAwaiter As IMethodSymbol 27Private ReadOnly _getResult As IMethodSymbol 32Public ReadOnly Property GetAwaiterMethod As IMethodSymbol 41Public ReadOnly Property GetResultMethod As IMethodSymbol
Compilation\ForEachStatementInfo.vb (6)
14Public ReadOnly Property GetEnumeratorMethod As IMethodSymbol 19Public ReadOnly Property MoveNextMethod As IMethodSymbol 29Public ReadOnly Property DisposeMethod As IMethodSymbol 63Friend Sub New(getEnumeratorMethod As IMethodSymbol, 64moveNextMethod As IMethodSymbol, 66disposeMethod As IMethodSymbol,
Compilation\SemanticModel.vb (6)
2632Public Overloads Function GetDeclaredSymbol(declarationSyntax As SubNewStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol 2641Public Overloads Function GetDeclaredSymbol(declarationSyntax As MethodStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol 2650Public Overloads Function GetDeclaredSymbol(declarationSyntax As DeclareStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol 2659Public Overloads Function GetDeclaredSymbol(declarationSyntax As OperatorStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol 2668Public Overloads Function GetDeclaredSymbol(declarationSyntax As MethodBlockBaseSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol 2729Public Overloads Function GetDeclaredSymbol(declarationSyntax As AccessorStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol
Compilation\VisualBasicCompilation.vb (6)
476Friend Overrides Sub ValidateDebugEntryPoint(debugEntryPoint As IMethodSymbol, diagnostics As DiagnosticBag) 2372debugEntryPoint As IMethodSymbol, 2394debugEntryPoint As IMethodSymbol, 2939rightType As ITypeSymbol) As IMethodSymbol 3022operandType As ITypeSymbol) As IMethodSymbol 3083Protected Overrides Function CommonGetEntryPoint(cancellationToken As CancellationToken) As IMethodSymbol
Operations\VisualBasicOperationFactory.vb (7)
431Dim symbol As IMethodSymbol = boundLambda.LambdaSymbol 439Dim targetMethod As IMethodSymbol = boundCall.Method 501Dim operatorMethod As IMethodSymbol = Nothing 514Dim operatorMethod As IMethodSymbol = TryGetOperatorMethod(boundUserDefinedUnaryOperator) 635Dim unaryOperatorMethod As IMethodSymbol = Nothing 760Dim method As IMethodSymbol = boundDelegateCreationExpression.Method 820Dim constructor As IMethodSymbol = boundObjectCreationExpression.ConstructorOpt
Semantics\Conversions.vb (1)
209Public ReadOnly Property MethodSymbol As IMethodSymbol
SymbolDisplay\SymbolDisplayVisitor.Members.vb (11)
163Public Overrides Sub VisitMethod(symbol As IMethodSymbol) 194Private Sub AddMethodKind(symbol As IMethodSymbol) 289Private Sub AddMethodName(symbol As IMethodSymbol) 380Private Shared Function TryGetOperatorTokenKind(symbol As IMethodSymbol) As SyntaxKind 408Private Shared Function TryGetConversionTokenKind(symbol As IMethodSymbol) As SyntaxKind 418Private Sub AddMethodGenericParameters(method As IMethodSymbol) 424Private Sub AddMethodParameters(method As IMethodSymbol) 433Private Sub AddMethodReturnType(method As IMethodSymbol) 451Private Sub VisitDeclareMethod(method As IMethodSymbol) 685Private Function IsDeclareMethod(method As IMethodSymbol) As Boolean 701DirectCast(symbol, IMethodSymbol).MethodKind = MethodKind.AnonymousFunction OrElse
Symbols\Attributes\AttributeData.vb (2)
156''' Gets the constructor used in this application of the attribute as an <see cref="IMethodSymbol"/>. 158Protected Overrides ReadOnly Property CommonAttributeConstructor As IMethodSymbol
Symbols\EventSymbol.vb (3)
290Private ReadOnly Property IEventSymbol_AddMethod As IMethodSymbol Implements IEventSymbol.AddMethod 296Private ReadOnly Property IEventSymbol_RemoveMethod As IMethodSymbol Implements IEventSymbol.RemoveMethod 302Private ReadOnly Property IEventSymbol_RaiseMethod As IMethodSymbol Implements IEventSymbol.RaiseMethod
Symbols\LabelSymbol.vb (1)
111Friend ReadOnly Property ILabelSymbol_ContainingMethod As IMethodSymbol Implements ILabelSymbol.ContainingMethod
Symbols\MethodSymbol.vb (55)
38Public MustOverride ReadOnly Property IsVararg As Boolean Implements IMethodSymbol.IsVararg 43Public Overridable ReadOnly Property IsCheckedBuiltin As Boolean Implements IMethodSymbol.IsCheckedBuiltin 109Private ReadOnly Property IMethodSymbol_IsReadOnly As Boolean Implements IMethodSymbol.IsReadOnly 115Private ReadOnly Property IMethodSymbol_IsInitOnly As Boolean Implements IMethodSymbol.IsInitOnly 260Public ReadOnly Property IsConditional As Boolean Implements IMethodSymbol.IsConditional 379Public MustOverride Function GetDllImportData() As DllImportData Implements IMethodSymbol.GetDllImportData 893Private ReadOnly Property IMethodSymbol_Arity As Integer Implements IMethodSymbol.Arity 899Private ReadOnly Property IMethodSymbol_ConstructedFrom As IMethodSymbol Implements IMethodSymbol.ConstructedFrom 905Private ReadOnly Property IMethodSymbol_ExplicitInterfaceImplementations As ImmutableArray(Of IMethodSymbol) Implements IMethodSymbol.ExplicitInterfaceImplementations 907Return ImmutableArrayExtensions.Cast(Of MethodSymbol, IMethodSymbol)(Me.ExplicitInterfaceImplementations) 911Private ReadOnly Property IMethodSymbol_MethodImplementationFlags As System.Reflection.MethodImplAttributes Implements IMethodSymbol.MethodImplementationFlags 917Private ReadOnly Property IMethodSymbol_IsExtensionMethod As Boolean Implements IMethodSymbol.IsExtensionMethod 923Private ReadOnly Property IMethodSymbol_MethodKind As MethodKind Implements IMethodSymbol.MethodKind 929Private ReadOnly Property IMethodSymbol_OriginalDefinition As IMethodSymbol Implements IMethodSymbol.OriginalDefinition 935Private ReadOnly Property IMethodSymbol_OverriddenMethod As IMethodSymbol Implements IMethodSymbol.OverriddenMethod 941Private ReadOnly Property IMethodSymbol_ReceiverType As ITypeSymbol Implements IMethodSymbol.ReceiverType 947Private ReadOnly Property IMethodSymbol_ReceiverNullableAnnotation As NullableAnnotation Implements IMethodSymbol.ReceiverNullableAnnotation 953Private Function IMethodSymbol_GetTypeInferredDuringReduction(reducedFromTypeParameter As ITypeParameterSymbol) As ITypeSymbol Implements IMethodSymbol.GetTypeInferredDuringReduction 957Private ReadOnly Property IMethodSymbol_ReducedFrom As IMethodSymbol Implements IMethodSymbol.ReducedFrom 963Private Function IMethodSymbol_ReduceExtensionMethod(receiverType As ITypeSymbol) As IMethodSymbol Implements IMethodSymbol.ReduceExtensionMethod 971Private ReadOnly Property IMethodSymbol_Parameters As ImmutableArray(Of IParameterSymbol) Implements IMethodSymbol.Parameters 1014Private ReadOnly Property IMethodSymbol_PartialDefinitionPart As IMethodSymbol Implements IMethodSymbol.PartialDefinitionPart 1020Private ReadOnly Property IMethodSymbol_PartialImplementationPart As IMethodSymbol Implements IMethodSymbol.PartialImplementationPart 1026Private ReadOnly Property IMethodSymbol_IsPartialDefinition As Boolean Implements IMethodSymbol.IsPartialDefinition 1032Private ReadOnly Property IMethodSymbol_ReturnsVoid As Boolean Implements IMethodSymbol.ReturnsVoid, IMethodSymbolInternal.ReturnsVoid 1038Private ReadOnly Property IMethodSymbol_ReturnsByRef As Boolean Implements IMethodSymbol.ReturnsByRef 1044Private ReadOnly Property IMethodSymbol_ReturnsByReadonlyRef As Boolean Implements IMethodSymbol.ReturnsByRefReadonly 1050Private ReadOnly Property IMethodSymbol_RefKind As RefKind Implements IMethodSymbol.RefKind 1056Private ReadOnly Property IMethodSymbol_ReturnType As ITypeSymbol Implements IMethodSymbol.ReturnType 1062Private ReadOnly Property IMethodSymbol_ReturnNullableAnnotation As NullableAnnotation Implements IMethodSymbol.ReturnNullableAnnotation 1068Private ReadOnly Property IMethodSymbol_CallingConvention As Reflection.Metadata.SignatureCallingConvention Implements IMethodSymbol.CallingConvention 1074Private ReadOnly Property IMethodSymbol_UnmanagedCallingConventionTypes As ImmutableArray(Of INamedTypeSymbol) Implements IMethodSymbol.UnmanagedCallingConventionTypes 1080Private ReadOnly Property IMethodSymbol_TypeArguments As ImmutableArray(Of ITypeSymbol) Implements IMethodSymbol.TypeArguments 1086Private ReadOnly Property IMethodSymbol_TypeArgumentsNullableAnnotation As ImmutableArray(Of NullableAnnotation) Implements IMethodSymbol.TypeArgumentNullableAnnotations 1092Private ReadOnly Property IMethodSymbol_TypeParameters As ImmutableArray(Of ITypeParameterSymbol) Implements IMethodSymbol.TypeParameters 1098Private ReadOnly Property IMethodSymbol_AssociatedSymbol As ISymbol Implements IMethodSymbol.AssociatedSymbol 1104Private ReadOnly Property IMethodSymbol_IsGenericMethod As Boolean Implements IMethodSymbol.IsGenericMethod 1110Private ReadOnly Property IMethodSymbol_IsAsync As Boolean Implements IMethodSymbol.IsAsync, IMethodSymbolInternal.IsAsync 1116Private ReadOnly Property IMethodSymbol_HidesBaseMethodsByName As Boolean Implements IMethodSymbol.HidesBaseMethodsByName 1122Private ReadOnly Property IMethodSymbol_RefCustomModifiers As ImmutableArray(Of CustomModifier) Implements IMethodSymbol.RefCustomModifiers 1128Private ReadOnly Property IMethodSymbol_ReturnTypeCustomModifiers As ImmutableArray(Of CustomModifier) Implements IMethodSymbol.ReturnTypeCustomModifiers 1134Private Function IMethodSymbol_GetReturnTypeAttributes() As ImmutableArray(Of AttributeData) Implements IMethodSymbol.GetReturnTypeAttributes 1138Private Function IMethodSymbol_Construct(ParamArray typeArguments() As ITypeSymbol) As IMethodSymbol Implements IMethodSymbol.Construct 1146Private Function IMethodSymbol_Construct(typeArguments As ImmutableArray(Of ITypeSymbol), typeArgumentNullableAnnotations As ImmutableArray(Of CodeAnalysis.NullableAnnotation)) As IMethodSymbol Implements IMethodSymbol.Construct 1150Private ReadOnly Property IMethodSymbol_AssociatedAnonymousDelegate As INamedTypeSymbol Implements IMethodSymbol.AssociatedAnonymousDelegate
Symbols\NamedTypeSymbol.vb (8)
406Private Function GetConstructors(Of TMethodSymbol As {IMethodSymbol, Class})(includeInstance As Boolean, includeShared As Boolean) As ImmutableArray(Of TMethodSymbol) 1212Private ReadOnly Property INamedTypeSymbol_DelegateInvokeMethod As IMethodSymbol Implements INamedTypeSymbol.DelegateInvokeMethod 1302Private ReadOnly Property INamedTypeSymbol_InstanceConstructors As ImmutableArray(Of IMethodSymbol) Implements INamedTypeSymbol.InstanceConstructors 1304Return GetConstructors(Of IMethodSymbol)(includeInstance:=True, includeShared:=False) 1308Private ReadOnly Property INamedTypeSymbol_StaticConstructors As ImmutableArray(Of IMethodSymbol) Implements INamedTypeSymbol.StaticConstructors 1310Return GetConstructors(Of IMethodSymbol)(includeInstance:=False, includeShared:=True) 1314Private ReadOnly Property INamedTypeSymbol_Constructors As ImmutableArray(Of IMethodSymbol) Implements INamedTypeSymbol.Constructors 1316Return GetConstructors(Of IMethodSymbol)(includeInstance:=True, includeShared:=True)
Symbols\PropertySymbol.vb (2)
544Private ReadOnly Property IPropertySymbol_GetMethod As IMethodSymbol Implements IPropertySymbol.GetMethod 568Private ReadOnly Property IPropertySymbol_SetMethod As IMethodSymbol Implements IPropertySymbol.SetMethod
Symbols\TypeParameterSymbol.vb (1)
375Private ReadOnly Property ITypeParameterSymbol_DeclaringMethod As IMethodSymbol Implements ITypeParameterSymbol.DeclaringMethod
VisualBasicExtensions.vb (8)
553Public Function IsOverloads(methodSymbol As IMethodSymbol) As Boolean 571Public Function HandledEvents(methodSymbol As IMethodSymbol) As ImmutableArray(Of HandledEvent) 1084Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As SubNewStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol 1097Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As MethodStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol 1110Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As DeclareStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol 1123Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As OperatorStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol 1136Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As MethodBlockBaseSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol 1214Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As AccessorStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IMethodSymbol
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (19)
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedMembers\VisualBasicRemoveUnusedMembersDiagnosticAnalyzer.vb (1)
24For Each method In DirectCast(context.Symbol, INamedTypeSymbol).GetMembers().OfType(Of IMethodSymbol)
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedParametersAndValues\VisualBasicRemoveUnusedParametersAndValuesDiagnosticAnalyzer.vb (1)
39Protected Overrides Function MethodHasHandlesClause(method As IMethodSymbol) As Boolean
src\Analyzers\VisualBasic\Analyzers\UseAutoProperty\VisualBasicUseAutoPropertyAnalyzer.vb (2)
80Protected Overrides Function GetGetterExpression(getMethod As IMethodSymbol, cancellationToken As CancellationToken) As ExpressionSyntax 103Protected Overrides Function GetSetterExpression(setMethod As IMethodSymbol, semanticModel As SemanticModel, cancellationToken As CancellationToken) As ExpressionSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (5)
154Dim methodSymbol = TryCast(symbolInfo.GetAnySymbol(), IMethodSymbol) 299If TypeOf symbol Is IMethodSymbol Then 300Dim method = DirectCast(symbol, IMethodSymbol) 395Dim method = TryCast(semanticModel.GetSymbolInfo(memberAccess, cancellationToken).Symbol, IMethodSymbol) 512Return Not symbolInfo.GetBestOrAllSymbols().OfType(Of IMethodSymbol)().Any() AndAlso
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SemanticModelExtensions.vb (1)
253Dim member = TryCast(semanticModel.GetSymbolInfo(argumentList.Parent, cancellationToken).Symbol, IMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
1087Dim method = TryCast(symbol, IMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SemanticFacts\VisualBasicSemanticFacts.vb (7)
197Public Function GetGetAwaiterMethod(model As SemanticModel, node As SyntaxNode) As IMethodSymbol Implements ISemanticFacts.GetGetAwaiterMethod 207Public Function GetDeconstructionAssignmentMethods(model As SemanticModel, deconstruction As SyntaxNode) As ImmutableArray(Of IMethodSymbol) Implements ISemanticFacts.GetDeconstructionAssignmentMethods 208Return ImmutableArray(Of IMethodSymbol).Empty 211Public Function GetDeconstructionForEachMethods(model As SemanticModel, deconstruction As SyntaxNode) As ImmutableArray(Of IMethodSymbol) Implements ISemanticFacts.GetDeconstructionForEachMethods 212Return ImmutableArray(Of IMethodSymbol).Empty 270Public Function GetLocalFunctionSymbols(compilation As Compilation, symbol As ISymbol, cancellationToken As CancellationToken) As ImmutableArray(Of IMethodSymbol) Implements ISemanticFacts.GetLocalFunctionSymbols 271Return ImmutableArray(Of IMethodSymbol).Empty
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\SpeculationAnalyzer.vb (1)
596Protected Overrides Sub GetForEachSymbols(model As SemanticModel, forEach As ForEachStatementSyntax, ByRef getEnumeratorMethod As IMethodSymbol, ByRef elementType As ITypeSymbol)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (56)
src\Analyzers\VisualBasic\CodeFixes\AddExplicitCast\VisualBasicAddExplicitCastCodeFixProvider.vb (1)
179For Each candidateSymbol In candidateSymbols.OfType(Of IMethodSymbol)()
src\Analyzers\VisualBasic\CodeFixes\ConvertToAsync\VisualBasicConvertToAsyncFunctionCodeFixProvider.vb (1)
58Dim methodSymbol = TryCast(semanticModel.GetSymbolInfo(oldNode, cancellationToken).Symbol, IMethodSymbol)
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\VisualBasicGenerateConstructorService.vb (4)
169Protected Overrides Function GetCurrentConstructor(semanticModel As SemanticModel, token As SyntaxToken, cancellationToken As CancellationToken) As IMethodSymbol 174Protected Overrides Function GetDelegatedConstructor(semanticModel As SemanticModel, constructor As IMethodSymbol, cancellationToken As CancellationToken) As IMethodSymbol 183Dim methodSymbol = TryCast(semanticModel.GetSymbolInfo(expressionStatement.Expression, cancellationToken).Symbol, IMethodSymbol)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (6)
55Protected Overrides Function TryInitializeExplicitConversionState(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef identifierToken As SyntaxToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 69Protected Overrides Function TryInitializeImplicitConversionState(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef identifierToken As SyntaxToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 83Private Shared Function TryGetConversionMethodAndTypeToGenerateIn(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 113Private Shared Function TryGetExplicitConversionMethodAndTypeToGenerateIn(document As SemanticDocument, castExpression As CastExpressionSyntax, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 129Private Shared Function TryGetImplicitConversionMethodAndTypeToGenerateIn(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 145Private Shared Function GenerateMethodSymbol(typeToGenerateIn As INamedTypeSymbol, parameterSymbol As INamedTypeSymbol) As IMethodSymbol
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateMethodService.vb (2)
45ByRef methodSymbol As IMethodSymbol, 59methodSymbol = DirectCast(semanticModel.GetDeclaredSymbol(methodStatement, cancellationToken), IMethodSymbol)
src\Analyzers\VisualBasic\CodeFixes\ImplementInterface\VisualBasicImplementInterfaceService.vb (1)
31Protected Overrides Function ToDisplayString(disposeImplMethod As IMethodSymbol, format As SymbolDisplayFormat) As String
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
59Dim method = TryCast(symbol, IMethodSymbol)
src\Analyzers\VisualBasic\CodeFixes\MakeMethodAsynchronous\VisualBasicMakeMethodAsynchronousCodeFixProvider.vb (2)
62methodSymbolOpt As IMethodSymbol, 83Private Shared Function FixFunctionBlock(methodSymbol As IMethodSymbol, node As MethodBlockSyntax, knownTypes As KnownTaskTypes) As SyntaxNode
src\Analyzers\VisualBasic\CodeFixes\MakeMethodSynchronous\VisualBasicMakeMethodSynchronousCodeFixProvider.vb (2)
38Protected Overrides Function RemoveAsyncTokenAndFixReturnType(methodSymbolOpt As IMethodSymbol, node As SyntaxNode, knownTypes As KnownTaskTypes) As SyntaxNode 54Private Shared Function FixFunctionBlock(methodSymbol As IMethodSymbol, node As MethodBlockSyntax, knownTypes As KnownTaskTypes) As SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ConstructorGenerator.vb (5)
18constructor As IMethodSymbol, 30Friend Function GenerateConstructorDeclaration(constructor As IMethodSymbol, 58Private Function GenerateStatements(constructor As IMethodSymbol) As SyntaxList(Of StatementSyntax) 82Private Function GenerateModifiers(constructor As IMethodSymbol, destination As CodeGenerationDestination, options As CodeGenerationContextInfo) As SyntaxTokenList 95Private Function CreateBaseConstructorCall(constructor As IMethodSymbol) As StatementSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ConversionGenerator.vb (3)
13method As IMethodSymbol, 24Public Function GenerateConversionDeclaration(method As IMethodSymbol, 38Private Function GenerateConversionDeclarationWorker(method As IMethodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\MethodGenerator.vb (8)
14method As IMethodSymbol, 27method As IMethodSymbol, 40method As IMethodSymbol, 52Public Shared Function GenerateMethodDeclaration(method As IMethodSymbol, 67Private Shared Function GenerateMethodDeclarationWorker(method As IMethodSymbol, 103Private Shared Function GenerateAsClause(method As IMethodSymbol, isSub As Boolean, options As CodeGenerationContextInfo) As SimpleAsClauseSyntax 137Private Overloads Shared Function GenerateTypeParameterList(method As IMethodSymbol) As TypeParameterListSyntax 141Private Shared Function GenerateModifiers(method As IMethodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\OperatorGenerator.vb (3)
13method As IMethodSymbol, 24Public Function GenerateOperatorDeclaration(method As IMethodSymbol, 38Private Function GenerateOperatorDeclarationWorker(method As IMethodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (3)
120accessor As IMethodSymbol, 147Private Function GenerateAccessorStatements(accessor As IMethodSymbol) As SyntaxList(Of StatementSyntax) 157accessor As IMethodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\StatementGenerator.vb (1)
15Friend Function GenerateStatements(method As IMethodSymbol) As SyntaxList(Of StatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
135method As IMethodSymbol, 527Public Overrides Function CreateMethodDeclaration(method As IMethodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Editing\VisualBasicImportAdder.vb (2)
106Dim method = TryCast(member, IMethodSymbol) 218Dim method = TryCast(_model.GetSymbolInfo(node.Name, cancellationToken).GetAnySymbol(), IMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\IMethodSymbolExtensions.vb (1)
14Public Function IsAggregateFunction(symbol As IMethodSymbol) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSemanticFactsService.vb (1)
138Public Function TryGetDisposeMethod(semanticModel As SemanticModel, node As SyntaxNode, cancellationToken As CancellationToken) As IMethodSymbol Implements ISemanticFactsService.TryGetDisposeMethod
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (7)
337Dim methods = symbols.OfType(Of IMethodSymbol)() 368Dim methods = symbols.OfType(Of IMethodSymbol)() 712Return lambdaTypes.Where(Function(t) t.InferredType.TypeKind = TypeKind.Delegate).SelectMany(Function(t) t.InferredType.GetMembers(WellKnownMemberNames.DelegateInvokeName).OfType(Of IMethodSymbol)().Select(Function(m) New TypeInferenceInfo(m.ReturnType))) 738Dim memberMethod = TryCast(memberSymbol, IMethodSymbol) 769Dim memberType = If(TryCast(memberSymbol, IMethodSymbol)?.ReturnType, 1037Dim expressionAddMethodSymbols = SemanticModel.GetCollectionInitializerSymbolInfo(expression).GetAllSymbols().OfType(Of IMethodSymbol) 1049Dim initializerAddMethodSymbols = SemanticModel.GetCollectionInitializerSymbolInfo(collectionInitializer).GetAllSymbols().OfType(Of IMethodSymbol)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (5)
GoToBase\VisualBasicGoToBaseService.vb (3)
21Protected Overrides Async Function FindNextConstructorInChainAsync(solution As Solution, constructor As IMethodSymbol, cancellationToken As CancellationToken) As Task(Of IMethodSymbol) 44Return TryCast(semanticModel.GetSymbolInfo(initializer, cancellationToken).GetAnySymbol(), IMethodSymbol)
NavigationBar\VisualBasicEditorNavigationBarItemService_CodeGeneration.vb (1)
259Dim methodToReplicate = TryCast(generateCodeItem.MethodToReplicateSymbolKey.Resolve(compilation, cancellationToken:=cancellationToken).Symbol, IMethodSymbol)
Utilities\NamedTypeSymbolExtensions.vb (1)
28Dim possibleInitializeComponent = baseType.GetMembers("InitializeComponent").OfType(Of IMethodSymbol).FirstOrDefault()
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (13)
CodeGen\CodeGenTuples.vb (12)
17248Dim cMabImplementations = DirectCast(DirectCast(c, TypeSymbol).GetMember("M_1"), IMethodSymbol).ExplicitInterfaceImplementations 17251Dim cMcdImplementations = DirectCast(DirectCast(c, TypeSymbol).GetMember("M_2"), IMethodSymbol).ExplicitInterfaceImplementations 17315Dim m2 = DirectCast(DirectCast(c2, TypeSymbol).GetMember("M"), IMethodSymbol) 17388Dim m2 = DirectCast(DirectCast(c2, TypeSymbol).GetMember("M"), IMethodSymbol) 17531Dim cMabImplementations = DirectCast(DirectCast(c, TypeSymbol).GetMember("M_1"), IMethodSymbol).ExplicitInterfaceImplementations 17534Dim cMcdImplementations = DirectCast(DirectCast(c, TypeSymbol).GetMember("M_2"), IMethodSymbol).ExplicitInterfaceImplementations 17578Dim cMabImplementations = DirectCast(DirectCast(c3, TypeSymbol).GetMember("M_1"), IMethodSymbol).ExplicitInterfaceImplementations 17581Dim cMcdImplementations = DirectCast(DirectCast(c3, TypeSymbol).GetMember("M_2"), IMethodSymbol).ExplicitInterfaceImplementations 17628Dim mImplementations = DirectCast(DirectCast(c3, TypeSymbol).GetMember("M"), IMethodSymbol).ExplicitInterfaceImplementations 21357Dim mImplementations = DirectCast(m, IMethodSymbol).ExplicitInterfaceImplementations 21493Dim mImplementations = DirectCast(m, IMethodSymbol).ExplicitInterfaceImplementations 22441Dim actSymbol = DirectCast(model.GetSymbolInfo(actSyntax).Symbol, IMethodSymbol)
Emit\EditAndContinue\EditAndContinueTestBase.vb (1)
107Friend Shared Function GetAllLocals(compilation As VisualBasicCompilation, method As IMethodSymbol) As ImmutableArray(Of KeyValuePair(Of ILocalSymbol, Integer))
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (1)
TypeParameterChecker.vb (1)
29Public Overrides Function GetThisParameter(method As IMethodSymbol) As IParameterSymbol
Microsoft.CodeAnalysis.VisualBasic.Features (102)
AddImport\VisualBasicAddImportFeatureService.vb (1)
326Protected Overrides Function IsViableExtensionMethod(method As IMethodSymbol,
ChangeSignature\VisualBasicChangeSignatureService.vb (5)
357Dim methodSymbol = TryCast(symbolInfo.Symbol, IMethodSymbol) 397Dim methodSymbol = TryCast(symbolInfo.Symbol, IMethodSymbol) 416Dim methodSymbol = TryCast(symbolInfo.Symbol, IMethodSymbol) 683method As IMethodSymbol, 788Protected Overrides Function TryGetRecordPrimaryConstructor(typeSymbol As INamedTypeSymbol, ByRef primaryConstructor As IMethodSymbol) As Boolean
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (4)
81Dim delegateSymbol As IMethodSymbol = Nothing 122delegateSymbol As IMethodSymbol, 169Private Shared Function TryGetDelegateSymbol(handlerExpression As ExpressionSyntax, semanticModel As SemanticModel, ByRef delegateSymbol As IMethodSymbol, cancellationToken As CancellationToken) As Boolean 170delegateSymbol = TryCast(semanticModel.GetSymbolInfo(handlerExpression, cancellationToken).GetAnySymbol(), IMethodSymbol)
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.vb (1)
162Dim methodSymbol = TryCast(enclosingDeclaration, IMethodSymbol)
CodeLens\VisualBasicDisplayInfoService.vb (1)
98Dim methodSymbol = TryCast(symbol, IMethodSymbol) ' its really a SourcePropertyAccessorSymbol but it Is Not accessible
Completion\CompletionProviders\ImplementsClauseCompletionProvider.vb (1)
121Dim method = TryCast(symbol, IMethodSymbol)
Completion\CompletionProviders\NamedParameterCompletionProvider.vb (1)
182Dim methodParameters = accessibleMembers.OfType(Of IMethodSymbol).Select(Function(m) m.Parameters.As(Of ISymbol)())
Completion\CompletionProviders\OverrideCompletionProvider.vb (4)
159Dim finalizeMethod = members.OfType(Of IMethodSymbol)().Where(Function(x) x.Name = "Finalize" AndAlso OverridesObjectMethod(x)).SingleOrDefault() 166Dim filteredMembers = members.OfType(Of IMethodSymbol)().Where(Function(m) Not m.ReturnsVoid) 178Dim filteredMembers = members.OfType(Of IMethodSymbol)().Where(Function(m) m.ReturnsVoid) 187Private Shared Function OverridesObjectMethod(method As IMethodSymbol) As Boolean
Debugging\BreakpointResolver.vb (1)
29Protected Overrides Function HasMethodBody(method As IMethodSymbol, cancellationToken As CancellationToken) As Boolean
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (9)
539Dim parameter = DirectCast(symbol, IMethodSymbol).Parameters.First() 642Dim method = TryCast(symbol, IMethodSymbol) 998Friend Overrides Function GetLambdaExpressionSymbol(model As SemanticModel, lambdaExpression As SyntaxNode, cancellationToken As CancellationToken) As IMethodSymbol 1002Return DirectCast(model.GetEnclosingSymbol(lambdaExpressionSyntax.SubOrFunctionHeader.Span.End, cancellationToken), IMethodSymbol) 1437Friend Overrides Function GetDisplayName(symbol As IMethodSymbol) As String 2020Protected Overrides Function AreHandledEventsEqual(oldMethod As IMethodSymbol, newMethod As IMethodSymbol) As Boolean 2046Dim method = DirectCast(newSymbol, IMethodSymbol) 2081Dim method = DirectCast(newSymbol, IMethodSymbol)
EncapsulateField\VisualBasicEncapsulateFieldService.vb (1)
133Return containingType.Constructors.SelectMany(Function(c As IMethodSymbol)
ExtractMethod\Extensions.vb (1)
140Dim methodSymbols = model.GetSymbolInfo(invocation, cancellationToken).GetAllSymbols().Where(Function(s) s.Kind = SymbolKind.Method).Cast(Of IMethodSymbol)()
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.vb (3)
52Protected Overrides Function UpdateMethodAfterGenerationAsync(originalDocument As SemanticDocument, methodSymbol As IMethodSymbol, cancellationToken As CancellationToken) As Task(Of SemanticDocument) 60Protected Overrides Function GenerateMethodDefinition(insertionPointNode As SyntaxNode, cancellationToken As CancellationToken) As IMethodSymbol 343Dim method = TryCast(x, IMethodSymbol)
ExtractMethod\VisualBasicSelectionResult.vb (1)
183Return DirectCast(symbol, IMethodSymbol).ReturnType
GenerateType\VisualBasicGenerateTypeService.vb (4)
296generateTypeServiceStateOptions.DelegateCreationMethodSymbol = TryCast(semanticModel.GetSymbolInfo(simpleArgumentExpression, cancellationToken).Symbol, IMethodSymbol) 338generateTypeServiceStateOptions.DelegateCreationMethodSymbol = DirectCast(symbol, IMethodSymbol) 358Private Shared Function GetMemberGroupIfPresent(semanticModel As SemanticModel, expression As ExpressionSyntax, cancellationToken As CancellationToken) As IMethodSymbol 365Return If(memberGroup.ElementAt(0).IsKind(SymbolKind.Method), DirectCast(memberGroup.ElementAt(0), IMethodSymbol), Nothing)
InitializeParameter\VisualBasicInitializeMemberFromParameterCodeRefactoringProvider.vb (1)
62Protected Overrides Function GetAccessorBody(accessor As IMethodSymbol, cancellationToken As CancellationToken) As SyntaxNode
IntroduceParameter\VisualBasicIntroduceParameterCodeRefactoringProvider.vb (1)
34Protected Overrides Function IsDestructor(methodSymbol As IMethodSymbol) As Boolean
LanguageServices\VisualBasicSymbolDisplayService.SymbolDescriptionBuilder.vb (1)
169Dim method = TryCast(symbol, IMethodSymbol)
NavigationBar\VisualBasicNavigationBarItemService.vb (8)
271Dim method = DirectCast(symbol, IMethodSymbol) 324Dim methodsImplementingEvents = containingType.GetMembers().OfType(Of IMethodSymbol) _ 327Dim eventToImplementingMethods As New Dictionary(Of IEventSymbol, List(Of IMethodSymbol)) 331Dim list As List(Of IMethodSymbol) = Nothing 334list = New List(Of IMethodSymbol) 344Dim methods As List(Of IMethodSymbol) = Nothing 412Dim method = TryCast(member, IMethodSymbol) 451Private Shared Function IsUnimplementedPartial(method As IMethodSymbol) As Boolean
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.vb (6)
84getMethod As IMethodSymbol, 117setMethod As IMethodSymbol, 144method As IMethodSymbol, 145desiredName As String) As IMethodSymbol 171explicitInterfaceImplMethod As IMethodSymbol, 172desiredName As String) As IMethodSymbol
SignatureHelp\AbstractOrdinaryMethodSignatureHelpProvider.vb (2)
56If TypeOf symbol Is IMethodSymbol Then 57Dim method = DirectCast(symbol, IMethodSymbol)
SignatureHelp\AttributeSignatureHelpProvider.vb (3)
106Private Overloads Shared Function Convert(constructor As IMethodSymbol, 132Private Shared Function GetParameters(constructor As IMethodSymbol, 181Private Shared Function GetPreambleParts(method As IMethodSymbol, semanticModel As SemanticModel, position As Integer) As IList(Of SymbolDisplayPart)
SignatureHelp\FunctionAggregationSignatureHelpProvider.vb (5)
68includeReducedExtensionMethods:=True).OfType(Of IMethodSymbol). 95Private Overloads Shared Function Convert(method As IMethodSymbol, 113Private Shared Function GetPreambleParts(method As IMethodSymbol) As IList(Of SymbolDisplayPart) 121Private Shared Function GetPostambleParts(method As IMethodSymbol, 137Private Shared Function GetParameterParts(method As IMethodSymbol, semanticModel As SemanticModel, position As Integer,
SignatureHelp\GenericNameSignatureHelpProvider.Method.vb (3)
9Private Shared Function GetPreambleParts(method As IMethodSymbol, semanticModel As SemanticModel, position As Integer) As IList(Of SymbolDisplayPart) 28Private Shared Function GetContainingType(method As IMethodSymbol) As ITypeSymbol 38Private Shared Function GetPostambleParts(method As IMethodSymbol, semanticModel As SemanticModel, position As Integer) As IList(Of SymbolDisplayPart)
SignatureHelp\GenericNameSignatureHelpProvider.vb (2)
99WhereAsArray(Function(s) TypeOf s Is INamedTypeSymbol OrElse TypeOf s Is IMethodSymbol). 132Dim method = DirectCast(symbol, IMethodSymbol)
SignatureHelp\InvocationExpressionSignatureHelpProvider.DelegateInvoke.vb (3)
39Private Shared Function GetDelegateInvokePreambleParts(invokeMethod As IMethodSymbol, semanticModel As SemanticModel, position As Integer) As IList(Of SymbolDisplayPart) 52Private Shared Function GetDelegateInvokeParameters(invokeMethod As IMethodSymbol, semanticModel As SemanticModel, position As Integer, documentationCommentFormattingService As IDocumentationCommentFormattingService, cancellationToken As CancellationToken) As IList(Of SignatureHelpSymbolParameter) 66Private Shared Function GetDelegateInvokePostambleParts(invokeMethod As IMethodSymbol,
SignatureHelp\InvocationExpressionSignatureHelpProvider.vb (1)
89Dim matchedMethodSymbol = TryCast(symbolInfo.Symbol, IMethodSymbol)
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.DelegateType.vb (2)
38Private Shared Function GetDelegateTypePreambleParts(invokeMethod As IMethodSymbol, semanticModel As SemanticModel, position As Integer) As IList(Of SymbolDisplayPart) 45Private Shared Function GetDelegateTypeParameters(invokeMethod As IMethodSymbol, semanticModel As SemanticModel, position As Integer) As IList(Of SignatureHelpSymbolParameter)
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.NormalType.vb (2)
45Private Shared Function ConvertNormalTypeConstructor(constructor As IMethodSymbol, objectCreationExpression As ObjectCreationExpressionSyntax, semanticModel As SemanticModel, 60Private Shared Function GetNormalTypePreambleParts(method As IMethodSymbol, semanticModel As SemanticModel, position As Integer) As IList(Of SymbolDisplayPart)
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedMembers\VisualBasicRemoveUnusedMembersDiagnosticAnalyzer.vb (1)
24For Each method In DirectCast(context.Symbol, INamedTypeSymbol).GetMembers().OfType(Of IMethodSymbol)
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedParametersAndValues\VisualBasicRemoveUnusedParametersAndValuesDiagnosticAnalyzer.vb (1)
39Protected Overrides Function MethodHasHandlesClause(method As IMethodSymbol) As Boolean
src\Analyzers\VisualBasic\Analyzers\UseAutoProperty\VisualBasicUseAutoPropertyAnalyzer.vb (2)
80Protected Overrides Function GetGetterExpression(getMethod As IMethodSymbol, cancellationToken As CancellationToken) As ExpressionSyntax 103Protected Overrides Function GetSetterExpression(setMethod As IMethodSymbol, semanticModel As SemanticModel, cancellationToken As CancellationToken) As ExpressionSyntax
src\Analyzers\VisualBasic\CodeFixes\AddExplicitCast\VisualBasicAddExplicitCastCodeFixProvider.vb (1)
179For Each candidateSymbol In candidateSymbols.OfType(Of IMethodSymbol)()
src\Analyzers\VisualBasic\CodeFixes\ConvertToAsync\VisualBasicConvertToAsyncFunctionCodeFixProvider.vb (1)
58Dim methodSymbol = TryCast(semanticModel.GetSymbolInfo(oldNode, cancellationToken).Symbol, IMethodSymbol)
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\VisualBasicGenerateConstructorService.vb (4)
169Protected Overrides Function GetCurrentConstructor(semanticModel As SemanticModel, token As SyntaxToken, cancellationToken As CancellationToken) As IMethodSymbol 174Protected Overrides Function GetDelegatedConstructor(semanticModel As SemanticModel, constructor As IMethodSymbol, cancellationToken As CancellationToken) As IMethodSymbol 183Dim methodSymbol = TryCast(semanticModel.GetSymbolInfo(expressionStatement.Expression, cancellationToken).Symbol, IMethodSymbol)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (6)
55Protected Overrides Function TryInitializeExplicitConversionState(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef identifierToken As SyntaxToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 69Protected Overrides Function TryInitializeImplicitConversionState(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef identifierToken As SyntaxToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 83Private Shared Function TryGetConversionMethodAndTypeToGenerateIn(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 113Private Shared Function TryGetExplicitConversionMethodAndTypeToGenerateIn(document As SemanticDocument, castExpression As CastExpressionSyntax, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 129Private Shared Function TryGetImplicitConversionMethodAndTypeToGenerateIn(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 145Private Shared Function GenerateMethodSymbol(typeToGenerateIn As INamedTypeSymbol, parameterSymbol As INamedTypeSymbol) As IMethodSymbol
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateMethodService.vb (2)
45ByRef methodSymbol As IMethodSymbol, 59methodSymbol = DirectCast(semanticModel.GetDeclaredSymbol(methodStatement, cancellationToken), IMethodSymbol)
src\Analyzers\VisualBasic\CodeFixes\ImplementInterface\VisualBasicImplementInterfaceService.vb (1)
31Protected Overrides Function ToDisplayString(disposeImplMethod As IMethodSymbol, format As SymbolDisplayFormat) As String
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
59Dim method = TryCast(symbol, IMethodSymbol)
src\Analyzers\VisualBasic\CodeFixes\MakeMethodAsynchronous\VisualBasicMakeMethodAsynchronousCodeFixProvider.vb (2)
62methodSymbolOpt As IMethodSymbol, 83Private Shared Function FixFunctionBlock(methodSymbol As IMethodSymbol, node As MethodBlockSyntax, knownTypes As KnownTaskTypes) As SyntaxNode
src\Analyzers\VisualBasic\CodeFixes\MakeMethodSynchronous\VisualBasicMakeMethodSynchronousCodeFixProvider.vb (2)
38Protected Overrides Function RemoveAsyncTokenAndFixReturnType(methodSymbolOpt As IMethodSymbol, node As SyntaxNode, knownTypes As KnownTaskTypes) As SyntaxNode 54Private Shared Function FixFunctionBlock(methodSymbol As IMethodSymbol, node As MethodBlockSyntax, knownTypes As KnownTaskTypes) As SyntaxNode
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (1)
EditAndContinue\Helpers\VisualBasicEditAndContinueTestVerifier.vb (1)
49Assert.True(TypeOf method Is IMethodSymbol, "Only methods should have a syntax map.")
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (17)
Compilation\CompilationAPITests.vb (1)
1973Dim genericMethod = DirectCast(comp.GetMember("Program.M"), IMethodSymbol)
Semantics\AnonymousTypesTests.vb (3)
1509Assert.Same(associatedDelegate, DirectCast(lambda2, IMethodSymbol).AssociatedAnonymousDelegate) 1554Assert.Same(associatedDelegate, DirectCast(lambda2, IMethodSymbol).AssociatedAnonymousDelegate) 1596Assert.Same(associatedDelegate, DirectCast(lambda2, IMethodSymbol).AssociatedAnonymousDelegate)
Semantics\InitOnlyMemberTests.vb (9)
75Assert.True(DirectCast(comp1.GetMember(Of PropertySymbol)("C.Property0").SetMethod, IMethodSymbol).IsInitOnly) 348Assert.True(DirectCast(comp1.GetMember(Of PropertySymbol)("C.Property0").SetMethod, IMethodSymbol).IsInitOnly) 569Assert.True(DirectCast(comp1.GetMember(Of PropertySymbol)("C.Item").SetMethod, IMethodSymbol).IsInitOnly) 861Assert.True(DirectCast(comp1.GetMember(Of PropertySymbol)("C.Item").SetMethod, IMethodSymbol).IsInitOnly) 1118Assert.True(DirectCast(comp1.GetMember(Of PropertySymbol)("C.Property0").SetMethod, IMethodSymbol).IsInitOnly) 1306Assert.True(DirectCast(comp1.GetMember(Of PropertySymbol)("C.Item").SetMethod, IMethodSymbol).IsInitOnly) 1959Assert.True(DirectCast(p0Set.OverriddenMethod, IMethodSymbol).IsInitOnly) 3454Assert.True(DirectCast(comp1.GetMember(Of PropertySymbol)("C.Item").SetMethod, IMethodSymbol).IsInitOnly) 3863Assert.True(DirectCast(comp1.GetMember(Of PropertySymbol)("C.Item").SetMethod, IMethodSymbol).IsInitOnly)
Semantics\NativeIntegerTests.vb (4)
25Dim method = DirectCast(type.GetMembers("F1").Single(), IMethodSymbol) 30method = DirectCast(type.GetMembers("F2").Single(), IMethodSymbol) 39method = DirectCast(type.GetMembers("F1").Single(), IMethodSymbol) 44method = DirectCast(type.GetMembers("F2").Single(), IMethodSymbol)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (19)
CrossLanguageTest.vb (2)
22Dim method = csharpCompilation.GetTypeByMetadataName("Sample").GetMembers("Create").OfType(Of IMethodSymbol).SingleOrDefault() 40method = basicCompilation.GetTypeByMetadataName("Sample").GetMembers("Create").OfType(Of IMethodSymbol).SingleOrDefault()
SymbolsTests\CheckedUserDefinedOperatorsTests.vb (3)
188Dim operators = c0_3.GetMembers().OfType(Of IMethodSymbol)().Where(Function(m) m.MethodKind <> MethodKind.Constructor).ToArray() 375Dim operators = c0_3.GetMembers().OfType(Of IMethodSymbol)().Where(Function(m) m.MethodKind <> MethodKind.Constructor).ToArray() 554Dim operators = c0_3.GetMembers().OfType(Of IMethodSymbol)().Where(Function(m) m.MethodKind <> MethodKind.Constructor).ToArray()
SymbolsTests\ExtensionMethods\ExtensionMethodTests.vb (1)
2556Dim extensionMethod = DirectCast(compilation.GetSymbolsWithName("ExtMethod", SymbolFilter.Member).Single(), IMethodSymbol)
SymbolsTests\MethodImplementationFlagsTests.vb (10)
35Dim aggressiveInliningMethod As IMethodSymbol = c.GetMember(Of MethodSymbol)("M_Aggressive") 37Dim noInliningMethod As IMethodSymbol = c.GetMember(Of MethodSymbol)("M_NoInlining") 65Dim aggressiveOptimizationMethod As IMethodSymbol = c.GetMember(Of MethodSymbol)("M_Aggressive") 67Dim noOptimizationMethod As IMethodSymbol = c.GetMember(Of MethodSymbol)("M_NoOptimization") 103Dim aggressiveOptNoInliningMethod As IMethodSymbol = c.GetMember(Of MethodSymbol)("M_AggressiveOpt_NoInlining") 105Dim noOptNoInliningMethod As IMethodSymbol = c.GetMember(Of MethodSymbol)("M_NoOpt_NoInlining") 107Dim aggressiveOptAggressiveInliningMethod As IMethodSymbol = c.GetMember(Of MethodSymbol)("M_AggressiveOpt_AggressiveInlining") 109Dim noOptAggressiveInliningMethod As IMethodSymbol = c.GetMember(Of MethodSymbol)("M_NoOpt_AggressiveInlining") 133Dim method As IMethodSymbol = c.GetMember(Of MethodSymbol)("M") 157Dim method As IMethodSymbol = c.GetMember(Of MethodSymbol)("M")
SymbolsTests\Source\MethodTests.vb (3)
1744Dim m As IMethodSymbol = comp.GetMember(Of MethodSymbol)("C.M") 1759Dim m As IMethodSymbol = comp.GetMember(Of MethodSymbol)("C.M") 1779Dim m As IMethodSymbol = comp.GetMember(Of MethodSymbol)("C.M")
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (1)
Extensions.vb (1)
337Return DirectCast(this, IMethodSymbol).ReturnsVoid
Microsoft.CodeAnalysis.VisualBasic.Workspaces (81)
CaseCorrection\VisualBasicCaseCorrectionService.Rewriter.vb (5)
96Dim definitionPart As IMethodSymbol = Nothing 108Dim definitionPart As IMethodSymbol = Nothing 169(symbol.IsKind(SymbolKind.Method) AndAlso DirectCast(symbol, IMethodSymbol).MethodKind = MethodKind.Constructor) 202Private Function GetOtherPartOfPartialMethod(methodDeclaration As MethodStatementSyntax, <Out> ByRef definitionPart As IMethodSymbol) As IMethodSymbol
Classification\SyntaxClassification\NameSyntaxClassifier.vb (2)
110Dim classification = GetClassificationForMethod(node, DirectCast(symbol, IMethodSymbol)) 210Private Shared Function GetClassificationForMethod(node As NameSyntax, methodSymbol As IMethodSymbol) As String
Classification\SyntaxClassification\OperatorOverloadSyntaxClassifier.vb (2)
41If TypeOf symbolInfo.Symbol Is IMethodSymbol AndAlso 42DirectCast(symbolInfo.Symbol, IMethodSymbol).MethodKind = MethodKind.UserDefinedOperator Then
CodeCleanup\Providers\AddMissingTokensCodeCleanupProvider.vb (1)
124Function(s) If(TryCast(s, IMethodSymbol)?.MethodKind = MethodKind.Ordinary, False))
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
1216Private Protected Overrides Function DestructorDeclaration(destructorMethod As IMethodSymbol) As SyntaxNode
Recommendations\VisualBasicRecommendationServiceRunner.vb (4)
106symbols.OfType(Of IMethodSymbol)(). 343symbols = symbols.WhereAsArray(Function(s) s.Kind <> SymbolKind.Method OrElse DirectCast(s, IMethodSymbol).MethodKind <> MethodKind.UserDefinedOperator) 377Private Function GetEnclosingCtor(node As MemberAccessExpressionSyntax) As IMethodSymbol 381Dim method = TryCast(symbol, IMethodSymbol)
Rename\VisualBasicRenameRewriterLanguageService.vb (6)
716Dim methodSymbol = DirectCast(renamedSymbol.ContainingSymbol, IMethodSymbol) 758DeclarationConflictHelpers.GetMembersWithConflictingSignatures(DirectCast(renamedSymbol, IMethodSymbol), trimOptionalParameters:=True) _ 911If TypeOf renamedSymbol Is IMethodSymbol Then 912If DirectCast(renamedSymbol, IMethodSymbol).IsOverloads AndAlso 914DirectCast(renamedSymbol, IMethodSymbol).Parameters.Length <> 0) Then 942Dim method = DirectCast(symbol, IMethodSymbol)
Simplification\Reducers\VisualBasicEscapingReducer.vb (1)
103If symbol IsNot Nothing AndAlso symbol.Kind = SymbolKind.Method AndAlso Not DirectCast(symbol, IMethodSymbol).IsConstructor Then
Simplification\Reducers\VisualBasicExtensionMethodReducer.vb (2)
41Dim targetMethodSymbol = DirectCast(targetSymbol.Symbol, IMethodSymbol) 63If newSymbol.Kind = SymbolKind.Method And oldSymbol.Equals(DirectCast(newSymbol, IMethodSymbol).GetConstructedReducedFrom()) Then
Simplification\Simplifiers\ExpressionSimplifier.vb (1)
246If isInCref AndAlso TypeOf rightSymbol Is IMethodSymbol AndAlso Not containingType.SpecialType = SpecialType.None Then
Simplification\VisualBasicSimplificationService.Expander.vb (5)
212newInvocationExpression = RewriteExtensionMethodInvocation(node, newInvocationExpression, memberAccess.Expression, DirectCast(newInvocationExpression.Expression, MemberAccessExpressionSyntax).Expression, DirectCast(targetSymbol, IMethodSymbol)) 224reducedExtensionMethod As IMethodSymbol) As InvocationExpressionSyntax 250reducedExtensionMethod As IMethodSymbol, 686If DirectCast(symbol, IMethodSymbol).TypeArguments.Length <> 0 Then 687Dim typeArguments = DirectCast(symbol, IMethodSymbol).TypeArguments
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (5)
154Dim methodSymbol = TryCast(symbolInfo.GetAnySymbol(), IMethodSymbol) 299If TypeOf symbol Is IMethodSymbol Then 300Dim method = DirectCast(symbol, IMethodSymbol) 395Dim method = TryCast(semanticModel.GetSymbolInfo(memberAccess, cancellationToken).Symbol, IMethodSymbol) 512Return Not symbolInfo.GetBestOrAllSymbols().OfType(Of IMethodSymbol)().Any() AndAlso
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SemanticModelExtensions.vb (1)
253Dim member = TryCast(semanticModel.GetSymbolInfo(argumentList.Parent, cancellationToken).Symbol, IMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
1087Dim method = TryCast(symbol, IMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SemanticFacts\VisualBasicSemanticFacts.vb (7)
197Public Function GetGetAwaiterMethod(model As SemanticModel, node As SyntaxNode) As IMethodSymbol Implements ISemanticFacts.GetGetAwaiterMethod 207Public Function GetDeconstructionAssignmentMethods(model As SemanticModel, deconstruction As SyntaxNode) As ImmutableArray(Of IMethodSymbol) Implements ISemanticFacts.GetDeconstructionAssignmentMethods 208Return ImmutableArray(Of IMethodSymbol).Empty 211Public Function GetDeconstructionForEachMethods(model As SemanticModel, deconstruction As SyntaxNode) As ImmutableArray(Of IMethodSymbol) Implements ISemanticFacts.GetDeconstructionForEachMethods 212Return ImmutableArray(Of IMethodSymbol).Empty 270Public Function GetLocalFunctionSymbols(compilation As Compilation, symbol As ISymbol, cancellationToken As CancellationToken) As ImmutableArray(Of IMethodSymbol) Implements ISemanticFacts.GetLocalFunctionSymbols 271Return ImmutableArray(Of IMethodSymbol).Empty
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\SpeculationAnalyzer.vb (1)
596Protected Overrides Sub GetForEachSymbols(model As SemanticModel, forEach As ForEachStatementSyntax, ByRef getEnumeratorMethod As IMethodSymbol, ByRef elementType As ITypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ConstructorGenerator.vb (5)
18constructor As IMethodSymbol, 30Friend Function GenerateConstructorDeclaration(constructor As IMethodSymbol, 58Private Function GenerateStatements(constructor As IMethodSymbol) As SyntaxList(Of StatementSyntax) 82Private Function GenerateModifiers(constructor As IMethodSymbol, destination As CodeGenerationDestination, options As CodeGenerationContextInfo) As SyntaxTokenList 95Private Function CreateBaseConstructorCall(constructor As IMethodSymbol) As StatementSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ConversionGenerator.vb (3)
13method As IMethodSymbol, 24Public Function GenerateConversionDeclaration(method As IMethodSymbol, 38Private Function GenerateConversionDeclarationWorker(method As IMethodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\MethodGenerator.vb (8)
14method As IMethodSymbol, 27method As IMethodSymbol, 40method As IMethodSymbol, 52Public Shared Function GenerateMethodDeclaration(method As IMethodSymbol, 67Private Shared Function GenerateMethodDeclarationWorker(method As IMethodSymbol, 103Private Shared Function GenerateAsClause(method As IMethodSymbol, isSub As Boolean, options As CodeGenerationContextInfo) As SimpleAsClauseSyntax 137Private Overloads Shared Function GenerateTypeParameterList(method As IMethodSymbol) As TypeParameterListSyntax 141Private Shared Function GenerateModifiers(method As IMethodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\OperatorGenerator.vb (3)
13method As IMethodSymbol, 24Public Function GenerateOperatorDeclaration(method As IMethodSymbol, 38Private Function GenerateOperatorDeclarationWorker(method As IMethodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (3)
120accessor As IMethodSymbol, 147Private Function GenerateAccessorStatements(accessor As IMethodSymbol) As SyntaxList(Of StatementSyntax) 157accessor As IMethodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\StatementGenerator.vb (1)
15Friend Function GenerateStatements(method As IMethodSymbol) As SyntaxList(Of StatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
135method As IMethodSymbol, 527Public Overrides Function CreateMethodDeclaration(method As IMethodSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Editing\VisualBasicImportAdder.vb (2)
106Dim method = TryCast(member, IMethodSymbol) 218Dim method = TryCast(_model.GetSymbolInfo(node.Name, cancellationToken).GetAnySymbol(), IMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\IMethodSymbolExtensions.vb (1)
14Public Function IsAggregateFunction(symbol As IMethodSymbol) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSemanticFactsService.vb (1)
138Public Function TryGetDisposeMethod(semanticModel As SemanticModel, node As SyntaxNode, cancellationToken As CancellationToken) As IMethodSymbol Implements ISemanticFactsService.TryGetDisposeMethod
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (7)
337Dim methods = symbols.OfType(Of IMethodSymbol)() 368Dim methods = symbols.OfType(Of IMethodSymbol)() 712Return lambdaTypes.Where(Function(t) t.InferredType.TypeKind = TypeKind.Delegate).SelectMany(Function(t) t.InferredType.GetMembers(WellKnownMemberNames.DelegateInvokeName).OfType(Of IMethodSymbol)().Select(Function(m) New TypeInferenceInfo(m.ReturnType))) 738Dim memberMethod = TryCast(memberSymbol, IMethodSymbol) 769Dim memberType = If(TryCast(memberSymbol, IMethodSymbol)?.ReturnType, 1037Dim expressionAddMethodSymbols = SemanticModel.GetCollectionInitializerSymbolInfo(expression).GetAllSymbols().OfType(Of IMethodSymbol) 1049Dim initializerAddMethodSymbols = SemanticModel.GetCollectionInitializerSymbolInfo(collectionInitializer).GetAllSymbols().OfType(Of IMethodSymbol)
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (4)
CodeGeneration\SyntaxGeneratorTests.vb (4)
1066Dim Conversion = gcHandleType.GetMembers().OfType(Of IMethodSymbol)().Single( 1075Conversion = doubleType.GetMembers().OfType(Of IMethodSymbol)().Single( 1093Dim additionOperatorSymbol = DirectCast(compilation.GetTypeByMetadataName("C").GetMembers(WellKnownMemberNames.AdditionOperatorName).Single(), IMethodSymbol) 1109Dim symbol = CType(model.GetDeclaredSymbol(node), IMethodSymbol)
Microsoft.CodeAnalysis.Workspaces (485)
Editing\DeclarationModifiers.cs (3)
70IMethodSymbol or 75var method = symbol as IMethodSymbol;
Editing\SyntaxGenerator.cs (16)
186public SyntaxNode MethodDeclaration(IMethodSymbol method, IEnumerable<SyntaxNode>? statements = null) 189internal SyntaxNode MethodDeclaration(IMethodSymbol method, string name, IEnumerable<SyntaxNode>? statements = null) 240bool HasNullableAnnotation(ITypeParameterSymbol typeParameter, IMethodSymbol method) 278public SyntaxNode OperatorDeclaration(IMethodSymbol method, IEnumerable<SyntaxNode>? statements = null) 329isExtension: symbol is { Ordinal: 0, ContainingSymbol: IMethodSymbol { IsExtensionMethod: true } }, 370var getMethodSymbol = property.GetMethod; 371var setMethodSymbol = property.SetMethod; 528var invoke = symbol.Type.GetMembers("Invoke").FirstOrDefault(m => m.Kind == SymbolKind.Method) as IMethodSymbol; 556IMethodSymbol constructorMethod, 569private protected abstract SyntaxNode DestructorDeclaration(IMethodSymbol destructorMethod); 734var method = (IMethodSymbol)symbol; 791TypeKind.Delegate => type.GetMembers(WellKnownMemberNames.DelegateInvokeName) is [IMethodSymbol invoke, ..] 831var method = (IMethodSymbol)symbol;
FindSymbols\FindReferences\Finders\AbstractMemberScopedReferenceFinder.cs (1)
93if (current is IMethodSymbol)
FindSymbols\FindReferences\Finders\AbstractMethodOrPropertyOrEventSymbolReferenceFinder.cs (2)
15protected static ImmutableArray<IMethodSymbol> GetReferencedAccessorSymbols( 36using var _ = ArrayBuilder<IMethodSymbol>.GetInstance(out var result);
FindSymbols\FindReferences\Finders\ConstructorInitializerSymbolReferenceFinder.cs (4)
16internal sealed class ConstructorInitializerSymbolReferenceFinder : AbstractReferenceFinder<IMethodSymbol> 18protected override bool CanFind(IMethodSymbol symbol) 22IMethodSymbol symbol, 55IMethodSymbol methodSymbol,
FindSymbols\FindReferences\Finders\ConstructorSymbolReferenceFinder.cs (11)
16internal sealed class ConstructorSymbolReferenceFinder : AbstractReferenceFinder<IMethodSymbol> 24protected override bool CanFind(IMethodSymbol symbol) 27protected override Task<ImmutableArray<string>> DetermineGlobalAliasesAsync(IMethodSymbol symbol, Project project, CancellationToken cancellationToken) 34IMethodSymbol symbol, 93IMethodSymbol methodSymbol, 126IMethodSymbol methodSymbol, FindReferencesDocumentState state, Action<FinderLocation, TData> processResult, TData processResultData, string name, string alias, CancellationToken cancellationToken) 143IMethodSymbol symbol, 157IMethodSymbol symbol, 169IMethodSymbol symbol, 189IMethodSymbol symbol, 201IMethodSymbol symbol,
FindSymbols\FindReferences\Finders\DestructorSymbolReferenceFinder.cs (4)
13internal sealed class DestructorSymbolReferenceFinder : AbstractReferenceFinder<IMethodSymbol> 15protected override bool CanFind(IMethodSymbol symbol) 19IMethodSymbol symbol, 32IMethodSymbol methodSymbol,
FindSymbols\FindReferences\Finders\ExplicitConversionSymbolReferenceFinder.cs (4)
17internal sealed partial class ExplicitConversionSymbolReferenceFinder : AbstractMethodOrPropertyOrEventSymbolReferenceFinder<IMethodSymbol> 19protected override bool CanFind(IMethodSymbol symbol) 27IMethodSymbol symbol, 63IMethodSymbol symbol,
FindSymbols\FindReferences\Finders\ExplicitInterfaceMethodReferenceFinder.cs (4)
13internal sealed class ExplicitInterfaceMethodReferenceFinder : AbstractReferenceFinder<IMethodSymbol> 15protected override bool CanFind(IMethodSymbol symbol) 19IMethodSymbol symbol, 33IMethodSymbol symbol,
FindSymbols\FindReferences\Finders\MethodTypeParameterSymbolReferenceFinder.cs (2)
25var method = (IMethodSymbol)symbol.ContainingSymbol;
FindSymbols\FindReferences\Finders\OperatorSymbolReferenceFinder.cs (4)
15internal sealed class OperatorSymbolReferenceFinder : AbstractMethodOrPropertyOrEventSymbolReferenceFinder<IMethodSymbol> 17protected override bool CanFind(IMethodSymbol symbol) 21IMethodSymbol symbol, 51IMethodSymbol symbol,
FindSymbols\FindReferences\Finders\OrdinaryMethodReferenceFinder.cs (10)
13internal sealed class OrdinaryMethodReferenceFinder : AbstractMethodOrPropertyOrEventSymbolReferenceFinder<IMethodSymbol> 15protected override bool CanFind(IMethodSymbol symbol) 23IMethodSymbol symbol, 35private static ImmutableArray<ISymbol> GetOtherPartsOfPartial(IMethodSymbol symbol) 48IMethodSymbol methodSymbol, 99private static bool IsForEachMethod(IMethodSymbol methodSymbol) 103private static bool IsDeconstructMethod(IMethodSymbol methodSymbol) 106private static bool IsGetAwaiterMethod(IMethodSymbol methodSymbol) 109private static bool IsAddMethod(IMethodSymbol methodSymbol) 113IMethodSymbol symbol,
FindSymbols\FindReferences\Finders\ParameterSymbolReferenceFinder.cs (11)
76if (parameter.ContainingSymbol is IMethodSymbol { AssociatedAnonymousDelegate.DelegateInvokeMethod: { } invokeMethod } && 146ParameterNamesMatch(syntaxFacts, (IMethodSymbol)parameter.ContainingSymbol, (IMethodSymbol)symbol.ContainingSymbol)) 158private static bool ParameterNamesMatch(ISyntaxFactsService syntaxFacts, IMethodSymbol methodSymbol1, IMethodSymbol methodSymbol2) 175if (declaredSymbol is IMethodSymbol { MethodKind: not MethodKind.AnonymousFunction }) 188if (containingSymbol is IMethodSymbol containingMethod) 208if (parameter.ContainingSymbol is IMethodSymbol containingMethod) 216var beginInvokeMethod = containingType.GetMembers(WellKnownMemberNames.DelegateBeginInvokeName) 217.OfType<IMethodSymbol>() 245if (parameter.ContainingSymbol is IMethodSymbol method)
FindSymbols\FindReferences\Finders\PropertyAccessorSymbolReferenceFinder.cs (5)
14internal sealed class PropertyAccessorSymbolReferenceFinder : AbstractMethodOrPropertyOrEventSymbolReferenceFinder<IMethodSymbol> 16protected override bool CanFind(IMethodSymbol symbol) 20IMethodSymbol symbol, 33IMethodSymbol symbol, 64IMethodSymbol symbol,
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (1)
85foreach (var constructor in containingType.Constructors)
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (1)
370=> symbol is IMethodSymbol or IPropertySymbol or IEventSymbol;
FindSymbols\ReferenceLocationExtensions.cs (2)
89var method = (IMethodSymbol)current;
FindSymbols\SymbolFinder_Hierarchy.cs (2)
111if (symbol is IMethodSymbol or IPropertySymbol or IEventSymbol) 147? ((IMethodSymbol)symbol).AssociatedSymbol?.Name
ReassignedVariable\AbstractReassignedVariableService.cs (2)
184if (methodOrProperty is IMethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet } method) 187if (methodOrProperty is not IMethodSymbol and not IPropertySymbol)
Recommendations\AbstractRecommendationService.cs (1)
87switch (((IMethodSymbol)symbol).MethodKind)
Recommendations\AbstractRecommendationServiceRunner.cs (4)
68if (parameter.ContainingSymbol is not IMethodSymbol { MethodKind: MethodKind.AnonymousFunction } owningMethod) 198if (candidateSymbol is IMethodSymbol method) 238private bool TryGetMatchingParameterTypeForArgument(IMethodSymbol method, string argumentName, int ordinalInInvocation, out ITypeSymbol parameterType) 415if (originalMember is IMethodSymbol { Parameters: [{ Type: ITypeParameterSymbol parameterType }, ..] })
Rename\ConflictEngine\DeclarationConflictHelpers.cs (5)
15public static ImmutableArray<Location> GetMembersWithConflictingSignatures(IMethodSymbol renamedMethod, bool trimOptionalParameters) 19.OfType<IMethodSymbol>() 23method => GetAllSignatures(((IMethodSymbol)method).Parameters, trimOptionalParameters)); 59if (isMethod && conflictingSymbol is IMethodSymbol conflictingMethod && renamedMember is IMethodSymbol renamedMethod)
Rename\RenameUtilities.cs (7)
188if (symbol is IMethodSymbol) 195if (string.Equals(member.MetadataName, symbol.MetadataName, StringComparison.Ordinal) && member is IMethodSymbol && !member.Equals(symbol)) 209return ((IMethodSymbol)symbol).AssociatedSymbol; 334var containingMethod = (IMethodSymbol)symbol.ContainingSymbol; 360var methodSymbol = (IMethodSymbol)symbol;
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (2)
205foreach (var method in namedType.GetMembers().OfType<IMethodSymbol>())
Shared\Extensions\IMethodSymbolExtensions.cs (4)
19public static bool CompatibleSignatureToDelegate(this IMethodSymbol method, INamedTypeSymbol delegateType) 23var invoke = delegateType.DelegateInvokeMethod; 57public static bool? IsMoreSpecificThan(this IMethodSymbol method1, IMethodSymbol method2)
Shared\Extensions\ISymbolExtensions.cs (9)
133ImmutableArray<AttributeData> attributes, bool hideAdvancedMembers, IMethodSymbol? constructor) 156ImmutableArray<AttributeData> attributes, ImmutableArray<IMethodSymbol> constructors) 165ImmutableArray<AttributeData> attributes, ImmutableArray<IMethodSymbol> constructors) 174ImmutableArray<AttributeData> attributes, ImmutableArray<IMethodSymbol> constructors) 187ImmutableArray<AttributeData> attributes, ImmutableArray<IMethodSymbol> attributeConstructors, int hiddenFlag) 193foreach (var constructor in attributeConstructors) 478if (memberSymbol is IMethodSymbol methodSymbol) 515static bool IsSameSignature(IMethodSymbol left, IMethodSymbol right)
Shared\Extensions\ISymbolExtensions_2.cs (1)
15if (symbol.ContainingSymbol is IMethodSymbol method)
Shared\Extensions\ITypeSymbolExtensions.cs (1)
131IMethodSymbol methodSymbol => typeSymbol.FindImplementations(methodSymbol, services),
Shared\Extensions\SemanticModelExtensions.cs (3)
35symbol.ContainingSymbol is IMethodSymbol method) 51if (symbol is IMethodSymbol methodSymbol && 61.OfType<IMethodSymbol>()
Shared\Extensions\SyntaxGeneratorExtensions.cs (7)
24public static IMethodSymbol CreateBaseDelegatingConstructor( 26IMethodSymbol constructor, 146IMethodSymbol? accessorGet = null; 157IMethodSymbol? accessorSet = null; 208if (symbol is IMethodSymbol method) 234private static async Task<IMethodSymbol> OverrideMethodAsync( 236IMethodSymbol overriddenMethod,
Shared\Utilities\EditorBrowsableHelpers.cs (9)
18public IMethodSymbol? EditorBrowsableAttributeConstructor { get; } = GetSpecialEditorBrowsableAttributeConstructor(compilation); 19public ImmutableArray<IMethodSymbol> TypeLibTypeAttributeConstructors { get; } = GetSpecialTypeLibTypeAttributeConstructors(compilation); 20public ImmutableArray<IMethodSymbol> TypeLibFuncAttributeConstructors { get; } = GetSpecialTypeLibFuncAttributeConstructors(compilation); 21public ImmutableArray<IMethodSymbol> TypeLibVarAttributeConstructors { get; } = GetSpecialTypeLibVarAttributeConstructors(compilation); 32public static IMethodSymbol? GetSpecialEditorBrowsableAttributeConstructor(Compilation compilation) 62public static ImmutableArray<IMethodSymbol> GetSpecialTypeLibTypeAttributeConstructors(Compilation compilation) 70public static ImmutableArray<IMethodSymbol> GetSpecialTypeLibFuncAttributeConstructors(Compilation compilation) 78public static ImmutableArray<IMethodSymbol> GetSpecialTypeLibVarAttributeConstructors(Compilation compilation) 93private static ImmutableArray<IMethodSymbol> GetSpecialTypeLibAttributeConstructorsWorker(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CompilationExtensions.cs (2)
73public static IMethodSymbol? GetTopLevelStatementsMethod(this Compilation compilation) 79if (candidateMember is IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IMethodSymbolExtensions.cs (7)
20public static ImmutableArray<IMethodSymbol> GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method) 43public static bool HasEventHandlerSignature(this IMethodSymbol method, [NotNullWhen(returnValue: true)] INamedTypeSymbol? eventArgsType) 48public static bool TryGetPredefinedComparisonOperator(this IMethodSymbol symbol, out PredefinedOperator op) 72public static PredefinedOperator GetPredefinedOperator(this IMethodSymbol symbol) 102public static bool IsEntryPoint(this IMethodSymbol methodSymbol, INamedTypeSymbol? taskType, INamedTypeSymbol? genericTaskType) 113public static bool IsAsyncReturningVoidTask(this IMethodSymbol method, Compilation compilation)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (8)
122static bool IsAccessorImplemented(IMethodSymbol? accessor, INamedTypeSymbol classOrStructType) 170IMethodSymbol method => method.ExplicitInterfaceImplementations.Length > 0, 219static bool IsNonPublicImplementableAccessor(IMethodSymbol? accessor) 226if (member is IMethodSymbol { IsStatic: true, IsAbstract: true, MethodKind: MethodKind.UserDefinedOperator } method) 319private static bool IsInaccessibleImplementableAccessor(IMethodSymbol? accessor, ISymbol within) 425case IMethodSymbol method: 637IMethodSymbol { MethodKind: MethodKind.Ordinary, CanBeReferencedByName: true } => true, 656return member is IMethodSymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (2)
28ContainingSymbol: IMethodSymbol 60ContainingSymbol: IMethodSymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (39)
78IMethodSymbol method => method.OverriddenMethod, 88IMethodSymbol method => ImmutableArray<ISymbol>.CastUp(method.ExplicitInterfaceImplementations), 137var methodSymbol = (IMethodSymbol)symbol; 178=> symbol is IMethodSymbol { MethodKind: MethodKind.AnonymousFunction }; 205=> symbol is IMethodSymbol { MethodKind: MethodKind.ReducedExtension }; 211=> symbol is IMethodSymbol { IsExtensionMethod: true }; 214=> symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction }; 223=> symbol is IMethodSymbol { MethodKind: MethodKind.Constructor }; 226=> symbol is IMethodSymbol { MethodKind: MethodKind.StaticConstructor }; 229=> symbol is IMethodSymbol { MethodKind: MethodKind.Destructor }; 232=> symbol is IMethodSymbol { MethodKind: MethodKind.UserDefinedOperator }; 235=> symbol is IMethodSymbol { MethodKind: MethodKind.Conversion }; 238=> symbol is IMethodSymbol { MethodKind: MethodKind.Ordinary }; 241=> symbol is IMethodSymbol { MethodKind: MethodKind.Ordinary or MethodKind.LocalFunction }; 280IMethodSymbol methodSymbol => methodSymbol.ReturnType, 290SymbolKind.Method => ((IMethodSymbol)symbol).Arity, 305symbol = ((IMethodSymbol)symbol).GetConstructedReducedFrom(); 310if (symbol.ContainingSymbol is IMethodSymbol method) 328var method = parameter.ContainingSymbol as IMethodSymbol; 361IMethodSymbol m => m.Parameters, 369IMethodSymbol m => m.TypeParameters, 390IMethodSymbol m => m.TypeArguments, 435if (symbol is IMethodSymbol method && method.Parameters.All(p => p.RefKind == RefKind.None)) 550=> (symbol as IMethodSymbol)?.MethodKind.IsPropertyAccessor() == true; 553=> symbol is IMethodSymbol { MethodKind: MethodKind.EventAdd or MethodKind.EventRaise or MethodKind.EventRemove }; 579var methodSymbol = symbol as IMethodSymbol; 603var getAwaiters = potentialGetAwaiters.OfType<IMethodSymbol>().Where(x => !x.Parameters.Any()); 607public static bool IsValidGetAwaiter(this IMethodSymbol symbol) 611private static bool VerifyGetAwaiter(IMethodSymbol getAwaiter) 625var methods = returnType.GetMembers().OfType<IMethodSymbol>(); 641public static bool IsValidGetEnumerator(this IMethodSymbol symbol) 645private static bool VerifyGetEnumerator(IMethodSymbol getEnumerator) 665if (!members.OfType<IMethodSymbol>().Any(x => 681public static bool IsValidGetAsyncEnumerator(this IMethodSymbol symbol) 685private static bool VerifyGetAsyncEnumerator(IMethodSymbol getAsyncEnumerator) 708if (!members.OfType<IMethodSymbol>().Any(x => x.Name == WellKnownMemberNames.MoveNextAsyncMethodName))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
106public override bool VisitMethod(IMethodSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (4)
105var funcPtrSignature = ((IFunctionPointerTypeSymbol)symbol).Signature; 154((IMethodSymbol)symbol).MethodKind == MethodKind.BuiltinOperator && 163Debug.Assert(!(symbol.IsKind(SymbolKind.Method) && ((IMethodSymbol)symbol).MethodKind == MethodKind.BuiltinOperator && symbol.ContainingSymbol.IsKind(SymbolKind.FunctionPointerType))); 165((IMethodSymbol)symbol).MethodKind == MethodKind.BuiltinOperator &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (2)
409.SelectAccessibleMembers<IMethodSymbol>(WellKnownMemberNames.CollectionInitializerAddMethodName, within ?? typeSymbol) 410.OfType<IMethodSymbol>()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (3)
232var containingMethod = TryGetContainingAnonymousFunctionOrLocalFunction(operation) ?? (containingSymbol as IMethodSymbol); 236public static IMethodSymbol? TryGetContainingAnonymousFunctionOrLocalFunction(this IOperation? operation)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (3)
72protected abstract PooledHashSet<IMethodSymbol> LambdaOrLocalFunctionsBeingAnalyzed { get; } 91public BasicBlockAnalysisData AnalyzeLocalFunctionInvocation(IMethodSymbol localFunction, CancellationToken cancellationToken) 126protected abstract BasicBlockAnalysisData AnalyzeLocalFunctionInvocationCore(IMethodSymbol localFunction, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.cs (1)
43BasicBlockAnalysisData AnalyzeLocalFunction(IMethodSymbol localFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (2)
30IMethodSymbol lambdaOrLocalFunction, 52IMethodSymbol localFunctionOrLambda,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (12)
36private readonly Func<IMethodSymbol, ControlFlowGraph, AnalysisData, CancellationToken, BasicBlockAnalysisData> _analyzeLocalFunctionOrLambdaInvocation; 55private readonly PooledDictionary<IMethodSymbol, ControlFlowGraph> _localFunctionTargetsToAccessingCfgMap; 79PooledHashSet<IMethodSymbol> lambdaOrLocalFunctionsBeingAnalyzed, 80Func<IMethodSymbol, ControlFlowGraph, AnalysisData, CancellationToken, BasicBlockAnalysisData> analyzeLocalFunctionOrLambdaInvocation, 82PooledDictionary<IMethodSymbol, ControlFlowGraph> localFunctionTargetsToAccessingCfgMap, 112protected override PooledHashSet<IMethodSymbol> LambdaOrLocalFunctionsBeingAnalyzed { get; } 119Func<IMethodSymbol, ControlFlowGraph, AnalysisData, CancellationToken, BasicBlockAnalysisData> analyzeLocalFunctionOrLambdaInvocation) 132lambdaOrLocalFunctionsBeingAnalyzed: PooledHashSet<IMethodSymbol>.GetInstance(), 135localFunctionTargetsToAccessingCfgMap: PooledDictionary<IMethodSymbol, ControlFlowGraph>.GetInstance(), 141IMethodSymbol lambdaOrLocalFunction, 321ControlFlowGraph TryGetLocalFunctionControlFlowGraphInScope(IMethodSymbol localFunction) 486protected override BasicBlockAnalysisData AnalyzeLocalFunctionInvocationCore(IMethodSymbol localFunction, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.OperationTreeAnalysisData.cs (7)
21private readonly Func<IMethodSymbol, BasicBlockAnalysisData> _analyzeLocalFunction; 26PooledHashSet<IMethodSymbol> lambdaOrLocalFunctionsBeingAnalyzed, 27Func<IMethodSymbol, BasicBlockAnalysisData> analyzeLocalFunction) 39protected override PooledHashSet<IMethodSymbol> LambdaOrLocalFunctionsBeingAnalyzed { get; } 43Func<IMethodSymbol, BasicBlockAnalysisData> analyzeLocalFunction) 48lambdaOrLocalFunctionsBeingAnalyzed: PooledHashSet<IMethodSymbol>.GetInstance(), 52protected override BasicBlockAnalysisData AnalyzeLocalFunctionInvocationCore(IMethodSymbol localFunction, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
345private void AnalyzeLocalFunctionInvocation(IMethodSymbol localFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (1)
46if (symbol is IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (3)
172switch (((IMethodSymbol)currentSymbol).MethodKind) 368SymbolCategory.Method => symbol is IMethodSymbol method && method.MethodKind == (MethodKind)_kind, 503if (Modifier.IsAsync && kind == SymbolKind.Method && ((IMethodSymbol)symbol).IsAsync)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ForEachSymbols.cs (6)
11public readonly IMethodSymbol GetEnumeratorMethod; 12public readonly IMethodSymbol MoveNextMethod; 14public readonly IMethodSymbol DisposeMethod; 17internal ForEachSymbols(IMethodSymbol getEnumeratorMethod, 18IMethodSymbol moveNextMethod, 20IMethodSymbol disposeMethod,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFacts.cs (4)
84IMethodSymbol? GetGetAwaiterMethod(SemanticModel semanticModel, SyntaxNode node); 86ImmutableArray<IMethodSymbol> GetDeconstructionAssignmentMethods(SemanticModel semanticModel, SyntaxNode node); 88ImmutableArray<IMethodSymbol> GetDeconstructionForEachMethods(SemanticModel semanticModel, SyntaxNode node); 107ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (1)
112=> symbol is IMethodSymbol methodSymbol &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
63if (isAnonymousDelegateType && symbol is IMethodSymbol methodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BuiltinOperatorSymbolKey.cs (6)
13private sealed class BuiltinOperatorSymbolKey : AbstractSymbolKey<IMethodSymbol> 17public sealed override void Create(IMethodSymbol symbol, SymbolKeyWriter visitor) 25SymbolKeyReader reader, IMethodSymbol? contextualSymbol, out string? failureReason) 30using var parameterTypes = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 56var unaryOperator = reader.Compilation.CreateBuiltinOperator(name, returnTypeSymbol, parameterTypes[0]); 60var binaryOperator = reader.Compilation.CreateBuiltinOperator(name, returnTypeSymbol, parameterTypes[0], parameterTypes[1]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (5)
32/// <item>Two <see cref="IMethodSymbol"/>s are the "same" if they have 35/// equal <see cref="IMethodSymbol.Arity"/>, 36/// the "same" <see cref="IMethodSymbol.TypeArguments"/>, and have 73/// cref="IRangeVariableSymbol"/> and <see cref="MethodKind.LocalFunction"/> <see cref="IMethodSymbol"/>s can also 319IMethodSymbol { MethodKind: MethodKind.LocalFunction } => true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (19)
12private sealed class ReducedExtensionMethodSymbolKey : AbstractSymbolKey<IMethodSymbol> 16public sealed override void Create(IMethodSymbol symbol, SymbolKeyWriter visitor) 25SymbolKeyReader reader, IMethodSymbol? contextualMethod, out string? failureReason) 42using var result = PooledArrayBuilder<IMethodSymbol>.GetInstance(); 43foreach (var reducedFrom in reducedFromResolution.OfType<IMethodSymbol>()) 56private sealed class ConstructedMethodSymbolKey : AbstractSymbolKey<IMethodSymbol> 60public sealed override void Create(IMethodSymbol symbol, SymbolKeyWriter visitor) 67SymbolKeyReader reader, IMethodSymbol? contextualMethod, out string? failureReason) 71using var typeArguments = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 102using var result = PooledArrayBuilder<IMethodSymbol>.GetInstance(); 103foreach (var method in constructedFrom.OfType<IMethodSymbol>()) 124private sealed class MethodSymbolKey : AbstractSymbolKey<IMethodSymbol> 128public sealed override void Create(IMethodSymbol symbol, SymbolKeyWriter visitor) 161SymbolKeyReader reader, IMethodSymbol? contextualSymbol, out string? failureReason) 180using var methods = GetMembersOfNamedType<IMethodSymbol>(containingType, metadataName: null); 181IMethodSymbol? method = null; 224_ = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 244private static IMethodSymbol? Resolve( 245SymbolKeyReader reader, bool isPartialImplementationPart, IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ParameterSymbolKey.cs (2)
46case IMethodSymbol method: 65var delegateInvoke = (eventSymbol.Type as INamedTypeSymbol)?.DelegateInvokeMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (5)
331private readonly List<IMethodSymbol?> _methodSymbolStack = []; 409public MethodPopper PushMethod(IMethodSymbol? method) 415private void PopMethod(IMethodSymbol? method) 422public IMethodSymbol? ResolveMethod(int index) 441public readonly ref struct MethodPopper(SymbolKeyReader reader, IMethodSymbol? method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (5)
69private readonly List<IMethodSymbol> _methodSymbolStack = []; 359public override void VisitMethod(IMethodSymbol methodSymbol) 499var method = _methodSymbolStack[i]; 513public void PushMethod(IMethodSymbol method) 516public void PopMethod(IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterOrdinalSymbolKey.cs (1)
24var method = reader.ResolveMethod(methodIndex);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (12)
359symbol = ((IMethodSymbol)symbol).GetConstructedReducedFrom()!; 364newSymbol = ((IMethodSymbol)newSymbol).GetConstructedReducedFrom()!; 384if (symbol is IMethodSymbol methodSymbol && newSymbol is IMethodSymbol newMethodSymbol) 458if (symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } methodSymbol && 459newSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } newMethodSymbol) 780GetForEachSymbols(this.OriginalSemanticModel, forEachStatement, out var originalGetEnumerator, out var originalElementType); 781GetForEachSymbols(this.SpeculativeSemanticModel, newForEachStatement, out var newGetEnumerator, out var newElementType); 797protected abstract void GetForEachSymbols(SemanticModel model, TForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType); 799private bool ReplacementBreaksForEachGetEnumerator(IMethodSymbol getEnumerator, IMethodSymbol newGetEnumerator, TExpressionSyntax newForEachStatementExpression) 876((IMethodSymbol)symbol).MethodKind == MethodKind.DelegateInvoke;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (12)
41SymbolKind.Method => HaveSameSignature((IMethodSymbol)symbol1, (IMethodSymbol)symbol2, caseSensitive), 65private static bool BadPropertyAccessor(IMethodSymbol method1, IMethodSymbol method2) 71public bool HaveSameSignature(IMethodSymbol method1, 72IMethodSymbol method2, 151var method1 = (IMethodSymbol)symbol1; 152var method2 = (IMethodSymbol)symbol2; 198private bool HaveSameSignatureAndConstraintsAndReturnType(IMethodSymbol method1, IMethodSymbol method2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (6)
147public bool ReturnTypeEquals(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies = null) 192private static bool IsConstructedFromSelf(IMethodSymbol symbol) 198private static bool CheckContainingType(IMethodSymbol x) 229private static bool IsPartialMethodDefinitionPart(IMethodSymbol symbol) 232private static bool IsPartialMethodImplementationPart(IMethodSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (8)
123SymbolKind.Method => MethodsAreEquivalent((IMethodSymbol)x, (IMethodSymbol)y, equivalentTypesWithDifferingAssemblies), 169private bool MethodsAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies, bool considerReturnRefKinds = false) 178var rx = x.ReducedFrom; 179var ry = y.ReducedFrom; 486internal bool ReturnTypesAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
65SymbolKind.Method => CombineHashCodes((IMethodSymbol)x, currentHash), 109private int CombineHashCodes(IMethodSymbol x, int currentHash)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (7)
54public TDeclarationNode AddMethod<TDeclarationNode>(TDeclarationNode destination, IMethodSymbol method, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode 83public SyntaxNode? CreateMethodDeclaration(IMethodSymbol method, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken) 126protected abstract TDeclarationNode AddMethod<TDeclarationNode>(TDeclarationNode destination, IMethodSymbol method, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 148public abstract SyntaxNode? CreateMethodDeclaration(IMethodSymbol method, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken); 349IMethodSymbol method => CreateMethodDeclaration(method, codeGenerationDestination, info, cancellationToken), 367IMethodSymbol method => AddMethod(currentDestination, method, info, availableIndices, cancellationToken), 447public Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
43var ctor = attribute.AttributeConstructor;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (28)
38IMethodSymbol? addMethod = null, 39IMethodSymbol? removeMethod = null, 40IMethodSymbol? raiseMethod = null) 57IMethodSymbol? getMethod, 58IMethodSymbol? setMethod, 85ImmutableArray<IParameterSymbol> parameters, IMethodSymbol? getMethod, IMethodSymbol? setMethod, 123public static IMethodSymbol CreateConstructorSymbol( 142public static IMethodSymbol CreateDestructorSymbol( 151internal static IMethodSymbol CreateMethodSymbol( 158ImmutableArray<IMethodSymbol> explicitInterfaceImplementations, 176public static IMethodSymbol CreateMethodSymbol( 180ImmutableArray<IMethodSymbol> explicitInterfaceImplementations, 195public static IMethodSymbol CreateOperatorSymbol( 223public static IMethodSymbol CreateConversionSymbol( 248public static IMethodSymbol CreateConversionSymbol( 360internal static IMethodSymbol CreateAccessorSymbol( 361IMethodSymbol accessor, 364ImmutableArray<IMethodSymbol> explicitInterfaceImplementations = default, 386public static IMethodSymbol CreateAccessorSymbol( 474var invokeMethod = CreateMethodSymbol( 514internal static IMethodSymbol CreateMethodSymbol( 515IMethodSymbol method, 519ImmutableArray<IMethodSymbol> explicitInterfaceImplementations = default, 553IMethodSymbol? getMethod = null, 554IMethodSymbol? setMethod = null) 577IMethodSymbol? addMethod = null, 578IMethodSymbol? removeMethod = null)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerator.cs (1)
44public static Task<Document> AddMethodDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (3)
34SyntaxNode? CreateMethodDeclaration(IMethodSymbol method, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken); 64TDeclarationNode AddMethod<TDeclarationNode>(TDeclarationNode destination, IMethodSymbol method, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 144Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (10)
20public new IMethodSymbol OriginalDefinition { get; protected set; } 50public abstract IMethodSymbol ConstructedFrom { get; } 53public abstract IMethodSymbol OverriddenMethod { get; } 54public abstract IMethodSymbol ReducedFrom { get; } 56public abstract IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType); 57public abstract ImmutableArray<IMethodSymbol> ExplicitInterfaceImplementations { get; } 58public abstract IMethodSymbol PartialDefinitionPart { get; } 59public abstract IMethodSymbol PartialImplementationPart { get; } 111public IMethodSymbol Construct(params ITypeSymbol[] typeArguments) 114public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (4)
81public abstract IMethodSymbol DelegateInvokeMethod { get; } 86public abstract ImmutableArray<IMethodSymbol> InstanceConstructors { get; } 87public abstract ImmutableArray<IMethodSymbol> StaticConstructors { get; } 88public abstract ImmutableArray<IMethodSymbol> Constructors { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAttributeData.cs (1)
21protected override IMethodSymbol CommonAttributeConstructor => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedMethodSymbol.cs (7)
69public override IMethodSymbol ConstructedFrom => _constructedFrom; 76public override IMethodSymbol OverriddenMethod 80public override IMethodSymbol ReducedFrom 87public override IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType) 93public override ImmutableArray<IMethodSymbol> ExplicitInterfaceImplementations 97public override IMethodSymbol PartialDefinitionPart 101public override IMethodSymbol PartialImplementationPart
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (4)
47public override IMethodSymbol DelegateInvokeMethod 60public override ImmutableArray<IMethodSymbol> InstanceConstructors 69public override ImmutableArray<IMethodSymbol> StaticConstructors 78public override ImmutableArray<IMethodSymbol> Constructors
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructorInfo.cs (10)
12private static readonly ConditionalWeakTable<IMethodSymbol, CodeGenerationConstructorInfo> s_constructorToInfoMap = new(); 38IMethodSymbol constructor, 50private static CodeGenerationConstructorInfo? GetInfo(IMethodSymbol method) 56public static ImmutableArray<SyntaxNode> GetThisConstructorArgumentsOpt(IMethodSymbol constructor) 59public static ImmutableArray<SyntaxNode> GetBaseConstructorArgumentsOpt(IMethodSymbol constructor) 62public static ImmutableArray<SyntaxNode> GetStatements(IMethodSymbol constructor) 65public static string GetTypeName(IMethodSymbol constructor) 68public static bool GetIsUnsafe(IMethodSymbol constructor) 71public static bool GetIsPrimaryConstructor(IMethodSymbol constructor) 83private static string GetTypeName(CodeGenerationConstructorInfo? info, IMethodSymbol constructor)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationDestructorInfo.cs (6)
14private static readonly ConditionalWeakTable<IMethodSymbol, CodeGenerationDestructorInfo> s_destructorToInfoMap = new(); 28IMethodSymbol destructor, 36private static CodeGenerationDestructorInfo GetInfo(IMethodSymbol method) 42public static ImmutableArray<SyntaxNode> GetStatements(IMethodSymbol destructor) 45public static string GetTypeName(IMethodSymbol destructor) 51private static string GetTypeName(CodeGenerationDestructorInfo info, IMethodSymbol constructor)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (6)
23IMethodSymbol? addMethod, 24IMethodSymbol? removeMethod, 25IMethodSymbol? raiseMethod) : CodeGenerationSymbol(containingType?.ContainingAssembly, containingType, attributes, declaredAccessibility, modifiers, name), IEventSymbol 32public IMethodSymbol? AddMethod { get; } = addMethod; 33public IMethodSymbol? RemoveMethod { get; } = removeMethod; 34public IMethodSymbol? RaiseMethod { get; } = raiseMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodInfo.cs (9)
14private static readonly ConditionalWeakTable<IMethodSymbol, CodeGenerationMethodInfo> s_methodToInfoMap = new(); 40IMethodSymbol method, 52private static CodeGenerationMethodInfo GetInfo(IMethodSymbol method) 58public static ImmutableArray<SyntaxNode> GetStatements(IMethodSymbol method) 61public static ImmutableArray<SyntaxNode> GetHandlesExpressions(IMethodSymbol method) 64public static bool GetIsNew(IMethodSymbol method) 67public static bool GetIsUnsafe(IMethodSymbol method) 70public static bool GetIsPartial(IMethodSymbol method) 73public static bool GetIsAsyncMethod(IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (8)
24public override ImmutableArray<IMethodSymbol> ExplicitInterfaceImplementations { get; } 34ImmutableArray<IMethodSymbol> explicitInterfaceImplementations, 103public override IMethodSymbol ConstructedFrom => this; 110public override IMethodSymbol OverriddenMethod => null; 112public override IMethodSymbol ReducedFrom => null; 117public override IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType) 120public override IMethodSymbol PartialImplementationPart => null; 122public override IMethodSymbol PartialDefinitionPart => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (7)
96public override IMethodSymbol DelegateInvokeMethod 101? this.GetMembers(WellKnownMemberNames.DelegateInvokeName).OfType<IMethodSymbol>().FirstOrDefault() 168public override ImmutableArray<IMethodSymbol> InstanceConstructors 174this.GetMembers().OfType<IMethodSymbol>().Where(m => m.MethodKind == MethodKind.Constructor && !m.IsStatic)); 178public override ImmutableArray<IMethodSymbol> StaticConstructors 184this.GetMembers().OfType<IMethodSymbol>().Where(m => m.MethodKind == MethodKind.StaticConstructor && m.IsStatic)); 188public override ImmutableArray<IMethodSymbol> Constructors
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (4)
28IMethodSymbol getMethod, 29IMethodSymbol setMethod) : CodeGenerationSymbol(containingType?.ContainingAssembly, containingType, attributes, declaredAccessibility, modifiers, name), IPropertySymbol 38public IMethodSymbol GetMethod { get; } = getMethod; 39public IMethodSymbol SetMethod { get; } = setMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (2)
86public static IMethodSymbol ContainingMethod => null; 170public ImmutableArray<AttributeData> GetAttributes(IMethodSymbol attributeConstructor)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (2)
72public IMethodSymbol DeclaringMethod 76return this.ContainingSymbol as IMethodSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (9)
20public static IMethodSymbol EnsureNonConflictingNames( 21this IMethodSymbol method, INamedTypeSymbol containingType, ISyntaxFactsService syntaxFacts) 41var updatedMethod = method.RenameTypeParameters(newTypeParameterNames); 45public static IMethodSymbol RenameTypeParameters(this IMethodSymbol method, ImmutableArray<string> newNames) 77public static IMethodSymbol RenameParameters( 78this IMethodSymbol method, ImmutableArray<string> parameterNames) 143public static IMethodSymbol RemoveInaccessibleAttributesAndAttributesOfTypes( 144this IMethodSymbol method, ISymbol accessibleWithin,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
103this SyntaxGenerator generator, IMethodSymbol method, ISymbol throughMember)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (7)
32public static IMethodSymbol CreateEqualsMethod( 49public static IMethodSymbol CreateEqualsMethod(this Compilation compilation, ImmutableArray<SyntaxNode> statements) 64public static IMethodSymbol CreateIEquatableEqualsMethod( 77var methodSymbol = constructedEquatableType 79.OfType<IMethodSymbol>() 443from method in baseType.GetMembers(EqualsName).OfType<IMethodSymbol>() 480var constructor = CodeGenerationSymbolFactory.CreateConstructorSymbol(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateGetHashCodeMethod.cs (3)
98var baseHashCode = GetBaseGetHashCodeMethod(containingType); 192public static IMethodSymbol? GetBaseGetHashCodeMethod(INamedTypeSymbol containingType) 205from method in baseType.GetMembers(GetHashCodeName).OfType<IMethodSymbol>()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (9)
103protected static IMethodSymbol? FindDisposeMethod(Compilation compilation, ITypeSymbol? type, bool isAsync) 108var methodToLookFor = isAsync 115return impl as IMethodSymbol; 117IMethodSymbol? GetDisposeMethod(string typeName, string methodName) 120return disposableType?.GetMembers().OfType<IMethodSymbol>().FirstOrDefault(m => m.Parameters.Length == 0 && m.Name == methodName); 170public IMethodSymbol GetGetAwaiterMethod(SemanticModel semanticModel, SyntaxNode node) 173public ImmutableArray<IMethodSymbol> GetDeconstructionAssignmentMethods(SemanticModel semanticModel, SyntaxNode node) 176public ImmutableArray<IMethodSymbol> GetDeconstructionForEachMethods(SemanticModel semanticModel, SyntaxNode node) 203public ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\ISemanticFactsService.cs (1)
49IMethodSymbol? TryGetDisposeMethod(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.Workspaces.UnitTests (48)
FindReferencesTests.cs (2)
391var interfaceMethod = (IMethodSymbol)(await netStandardProject.GetCompilationAsync()).GetTypeByMetadataName("N.I").GetMembers("Get").First();
SymbolKeyTests.cs (23)
398TestRoundTrip(GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().SelectMany(ms => ms.Parameters), compilation); 419var b = ((IMethodSymbol)compilation1.GlobalNamespace.GetTypeMembers("C").Single().GetMembers("M").Single()).Parameters[1]; 443var b = ((IMethodSymbol)compilation1.GlobalNamespace.GetTypeMembers("C").Single().GetMembers("M").Single()).Parameters[1]; 542var symbols = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().SelectMany(ms => GetInteriorSymbols(ms, compilation).OfType<ILocalSymbol>()).ToList(); 564var symbols = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().SelectMany(ms => GetInteriorSymbols(ms, compilation).OfType<ILabelSymbol>()).ToList(); 591var symbols = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().SelectMany(ms => GetInteriorSymbols(ms, compilation).OfType<IRangeVariableSymbol>()).ToList(); 722var method = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().First(); 723var constructed = method.Construct(compilation.GetSpecialType(SpecialType.System_Int32), method.TypeParameters[1]); 803var a_string_b_int_m_datetime = ((IMethodSymbol)a_string_b_int_m).Construct(compilation.GetSpecialType(SpecialType.System_DateTime)); 808var a_b_int_m_datetime = ((IMethodSymbol)a_b_int_m).Construct(compilation.GetSpecialType(SpecialType.System_DateTime)); 813var a_b_m_datetime = ((IMethodSymbol)a_b_m).Construct(compilation.GetSpecialType(SpecialType.System_DateTime)); 840.Where(n => !n.IsImplicitlyDeclared).Single().GetMembers("M").OfType<IMethodSymbol>().Single().TypeParameters.Single(); 955var methods = GetDeclaredSymbols(compilation1).OfType<IMethodSymbol>(); 956foreach (var method in methods) 1037var method = found as IMethodSymbol; 1074var method = found as IMethodSymbol; 1403var methods = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>();
UtilityTest\DocumentationCommentIdTests.cs (23)
155CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.#cctor", compilation, s => s.MethodKind == MethodKind.StaticConstructor); 156CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.#ctor", compilation, s => s.MethodKind == MethodKind.Constructor && s.Parameters.Length == 0); 157CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.#ctor(System.String)", compilation, s => s.MethodKind == MethodKind.Constructor && s.Parameters.Length == 1); 174CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.Finalize", compilation, s => s.MethodKind == MethodKind.Destructor); 216CheckDeclarationId<IMethodSymbol>("M:Acme.ValueType.M(System.Int32)", compilation, s => s.Name == "M" && s.Parameters is [{ Type.Name: "Int32" }]); 217CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.NestedClass.M(System.Int32)", compilation, s => s.Name == "M" && s.Parameters is [{ Type.Name: "Int32" }]); 218CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.M0", compilation, s => s.Name == "M0" && s.Parameters.Length == 0); 219CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.M1(System.Char,System.Single@,Acme.ValueType@)", compilation, s => s.Name == "M1"); 220CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.M2(System.Int16[],System.Int32[0:,0:],System.Int64[][])", compilation, s => s.Name == "M2"); 221CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.M3(System.Int64[][],Acme.Widget[0:,0:,0:][])", compilation, s => s.Name == "M3"); 222CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.M4(System.Char*,Color**)", compilation, s => s.Name == "M4"); 223CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.M5(System.Void*,System.Double*[0:,0:][])", compilation, s => s.Name == "M5"); 224CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.M6(System.Int32,System.Object[])", compilation, s => s.Name == "M6"); 225CheckDeclarationId<IMethodSymbol>("M:Acme.MyList`1.Test(`0)", compilation, s => s.Name == "Test"); 226CheckDeclarationId<IMethodSymbol>("M:Acme.UseList.Process(Acme.MyList{System.Int32})", compilation, s => s.Name == "Process"); 227CheckDeclarationId<IMethodSymbol>("M:Acme.UseList.GetValues``1(``0)", compilation, s => s.Name == "GetValues"); 228CheckDeclarationId<IMethodSymbol>("M:Acme.UseList.Process2``1(Acme.MyList{``0})", compilation, s => s.Name == "Process2"); 281CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.op_UnaryPlus(Acme.Widget)", compilation, m => m.MethodKind == MethodKind.UserDefinedOperator && m.Parameters.Length == 1); 297CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.op_Addition(Acme.Widget,Acme.Widget)", compilation, m => m.MethodKind == MethodKind.UserDefinedOperator && m.Parameters.Length == 2); 314CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.op_Explicit(Acme.Widget)~System.Int32", compilation, m => m.MethodKind == MethodKind.Conversion && m.Parameters.Length == 1 && m.ReturnType.Name == "Int32"); 315CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.op_Implicit(Acme.Widget)~System.Int64", compilation, m => m.MethodKind == MethodKind.Conversion && m.Parameters.Length == 1 && m.ReturnType.Name == "Int64"); 337var method = outerType.GetMembers("M").First() as IMethodSymbol;
Microsoft.DotNet.CodeAnalysis (6)
Analyzers\AppContextDefaultsAnalyzer.cs (2)
124return IsMethodTheDefineSwitchDefaultOne(symInfo.Symbol as IMethodSymbol); 127private bool IsMethodTheDefineSwitchDefaultOne(IMethodSymbol methodSym)
Analyzers\PinvokeAnalyzer.cs (2)
135var methodSymbol = context.Symbol as IMethodSymbol;
Analyzers\ResourceUsageAnalyzer.cs (2)
43IMethodSymbol memberSymbol = context.SemanticModel.GetSymbolInfo(memberAccessExpr).Symbol as IMethodSymbol;
Microsoft.Extensions.Logging.Generators (7)
LoggerMessageGenerator.Parser.cs (5)
103IMethodSymbol logMethodSymbol = sm.GetDeclaredSymbol(method, _cancellationToken)!; 112IMethodSymbol attrCtorSymbol = sm.GetSymbolInfo(ma, _cancellationToken).Symbol as IMethodSymbol; 686IEnumerable<IMethodSymbol> primaryConstructors = classType.InstanceConstructors 690foreach (IMethodSymbol primaryConstructor in primaryConstructors)
LoggerMessageGenerator.Roslyn3.11.cs (2)
75IMethodSymbol attributeSymbol = context.SemanticModel.GetSymbolInfo(attributeSyntax).Symbol as IMethodSymbol;
Microsoft.Extensions.Options.SourceGeneration (2)
Emitter.cs (1)
93if (members.Length == 1 && members[0] is IMethodSymbol tryValidateValueMethod)
Parser.cs (1)
202.Select(m => (IMethodSymbol)m)
Microsoft.Gen.ComplianceReports (4)
Parser.cs (2)
204var methods = typeSymbol.GetMembers().OfType<IMethodSymbol>(); 205foreach (IMethodSymbol method in methods)
src\Generators\Shared\GeneratorUtilities.cs (2)
109var ctor = context.SemanticModel.GetSymbolInfo(attributeSyntax, cancellationToken).Symbol as IMethodSymbol;
Microsoft.Gen.ContextualOptions (2)
src\Generators\Shared\GeneratorUtilities.cs (2)
109var ctor = context.SemanticModel.GetSymbolInfo(attributeSyntax, cancellationToken).Symbol as IMethodSymbol;
Microsoft.Gen.Logging (18)
Parsing\Parser.cs (4)
85var methodSymbol = sm.GetDeclaredSymbol(method, _cancellationToken)!; 366(LoggingMethod lm, bool keepMethod) ProcessMethod(MethodDeclarationSyntax method, IMethodSymbol methodSymbol, Location attrLoc) 708IEnumerable<IMethodSymbol> primaryConstructors = classType!.InstanceConstructors 712foreach (IMethodSymbol primaryConstructor in primaryConstructors)
Parsing\Parser.LogProperties.cs (1)
109foreach (var ctor in namedType.InstanceConstructors)
Parsing\Parser.Records.cs (2)
73if (m is not IMethodSymbol { MethodKind: MethodKind.Constructor } ctorMethod) 97var getMethod = property.GetMethod;
Parsing\Parser.TagProvider.cs (6)
30var providerMethod = ValidateTagProvider( 58var providerMethod = ValidateTagProvider( 74private IMethodSymbol? ValidateTagProvider( 88var methodSymbols = providerType.GetMembers(providerMethodName).Where(m => m.Kind == SymbolKind.Method).Cast<IMethodSymbol>(); 90foreach (var method in methodSymbols) 128static bool IsParameterCountValid(IMethodSymbol method)
Parsing\TypeSymbolExtensions.cs (3)
20if (member is IMethodSymbol ts) 41if (member is IMethodSymbol ts) 74if (current.GetMembers("ToString").Where(m => m.Kind == SymbolKind.Method && m.DeclaredAccessibility == Accessibility.Public).Cast<IMethodSymbol>().Any(m => m.Parameters.Length == 0))
src\Generators\Shared\GeneratorUtilities.cs (2)
109var ctor = context.SemanticModel.GetSymbolInfo(attributeSyntax, cancellationToken).Symbol as IMethodSymbol;
Microsoft.Gen.Metrics (5)
Parser.cs (3)
85IMethodSymbol? methodSymbol = semanticModel.GetDeclaredSymbol(methodSyntax, _cancellationToken); 394IMethodSymbol methodSymbol, 570private bool CheckMethodReturnType(IMethodSymbol methodSymbol)
src\Generators\Shared\GeneratorUtilities.cs (2)
109var ctor = context.SemanticModel.GetSymbolInfo(attributeSyntax, cancellationToken).Symbol as IMethodSymbol;
Microsoft.Gen.MetricsReports (5)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (3)
85IMethodSymbol? methodSymbol = semanticModel.GetDeclaredSymbol(methodSyntax, _cancellationToken); 394IMethodSymbol methodSymbol, 570private bool CheckMethodReturnType(IMethodSymbol methodSymbol)
src\Generators\Shared\GeneratorUtilities.cs (2)
109var ctor = context.SemanticModel.GetSymbolInfo(attributeSyntax, cancellationToken).Symbol as IMethodSymbol;
Microsoft.Interop.ComInterfaceGenerator (29)
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (3)
65foreach (var method in type.GetMembers().OfType<IMethodSymbol>().Where(m => !m.IsStatic && m.IsAbstract)) 146private static MarshallingInfoParser CreateComImportMarshallingInfoParser(StubEnvironment env, GeneratorDiagnosticsBag diagnostics, IMethodSymbol method, AttributeData unparsedAttributeData)
Analyzers\ConvertComImportToGeneratedComInterfaceFixer.cs (2)
125IMethodSymbol method = (IMethodSymbol)editor.SemanticModel.GetDeclaredSymbol(member, ct);
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (3)
66if (createAggregatedObject is IMethodSymbol { IsGenericMethod: true }) 78if (createWrapperOfType is IMethodSymbol { IsGenericMethod: true }) 94if (getComInterfaceForObject is IMethodSymbol { IsGenericMethod: true })
ComInterfaceGenerator.cs (2)
70.FilterAndReportDiagnostics<(ComMethodInfo MethodInfo, IMethodSymbol Symbol)>(comMethodsAndSymbolsOrDiagnostics); 236private static IncrementalMethodStubGenerationContext CalculateStubInformation(MethodDeclarationSyntax syntax, IMethodSymbol symbol, int index, StubEnvironment environment, ManagedTypeInfo owningInterface, CancellationToken ct)
ComMethodInfo.cs (14)
40public static SequenceEqualImmutableArray<DiagnosticOr<(ComMethodInfo ComMethod, IMethodSymbol Symbol)>> GetMethodsFromInterface((ComInterfaceInfo ifaceContext, INamedTypeSymbol ifaceSymbol) data, CancellationToken ct) 42var methods = ImmutableArray.CreateBuilder<DiagnosticOr<(ComMethodInfo, IMethodSymbol)>>(); 53methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(member.CreateDiagnosticInfo(GeneratorDiagnostics.InstancePropertyDeclaredInInterface, member.Name, data.ifaceSymbol.ToDisplayString()))); 56methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(member.CreateDiagnosticInfo(GeneratorDiagnostics.InstanceEventDeclaredInInterface, member.Name, data.ifaceSymbol.ToDisplayString()))); 58case IMethodSymbol { MethodKind: MethodKind.Ordinary }: 59methods.Add(CalculateMethodInfo(data.ifaceContext, (IMethodSymbol)member, ct)); 66private static DiagnosticInfo? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax comMethodDeclaringSyntax, IMethodSymbol method) 86private static DiagnosticOr<(ComMethodInfo, IMethodSymbol)> CalculateMethodInfo(ComInterfaceInfo ifaceContext, IMethodSymbol method, CancellationToken ct) 96return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(( 119return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(DiagnosticInfo.Create(GeneratorDiagnostics.MethodNotDeclaredInAttributedInterface, method.Locations.FirstOrDefault(), method.ToDisplayString())); 135return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(DiagnosticInfo.Create(GeneratorDiagnostics.CannotAnalyzeMethodPattern, method.Locations.FirstOrDefault(), method.ToDisplayString())); 141return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(diag); 153return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From((comMethodInfo, method));
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (2)
240protected static SyntaxNode AddExplicitDefaultBoolMarshalling(SyntaxGenerator generator, IMethodSymbol methodSymbol, SyntaxNode generatedDeclaration, string unmanagedTypeMemberIdentifier) 271protected static SyntaxNode AddHResultStructAsErrorMarshalling(SyntaxGenerator generator, IMethodSymbol methodSymbol, SyntaxNode generatedDeclaration)
VtableIndexStubGenerator.cs (3)
42static (context, ct) => context.TargetSymbol is IMethodSymbol methodSymbol 198private static IncrementalMethodStubGenerationContext CalculateStubInformation(MethodDeclarationSyntax syntax, IMethodSymbol symbol, StubEnvironment environment, CancellationToken ct) 391private static Diagnostic? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method)
Microsoft.Interop.JavaScript.JSImportGenerator (8)
JSExportGenerator.cs (3)
43static (context, ct) => new { Syntax = (MethodDeclarationSyntax)context.TargetNode, Symbol = (IMethodSymbol)context.TargetSymbol }); 171IMethodSymbol symbol, 335private static Diagnostic? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method)
JSImportGenerator.cs (3)
41static (context, ct) => new { Syntax = (MethodDeclarationSyntax)context.TargetNode, Symbol = (IMethodSymbol)context.TargetSymbol }); 151IMethodSymbol symbol, 214private static Diagnostic? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method)
JSSignatureContext.cs (2)
30IMethodSymbol method, 78private static string GetFullyQualifiedMethodName(StubEnvironment env, IMethodSymbol method)
Microsoft.Interop.LibraryImportGenerator (24)
Analyzers\ConvertToLibraryImportAnalyzer.cs (4)
69var method = (IMethodSymbol)context.Symbol; 93IMethodSymbol method, 179private static bool IsBestFitMapping(IMethodSymbol method, DllImportData? dllImportData)
Analyzers\ConvertToLibraryImportFixer.cs (6)
169if (editor.SemanticModel.GetDeclaredSymbol(methodSyntax, cancellationToken) is not IMethodSymbol methodSymbol) 200IMethodSymbol methodSymbol, 271private static async Task<bool> TransformCallersOfNoPreserveSigMethod(DocumentEditor editor, IMethodSymbol methodSymbol, CancellationToken cancellationToken) 415IMethodSymbol methodSymbol, 659private static bool TryGetAttribute(IMethodSymbol method, INamedTypeSymbol attributeType, out AttributeData? attr) 679private static bool MethodRequiresStringMarshalling(IMethodSymbol method)
Analyzers\CustomMarshallerAttributeAnalyzer.cs (5)
885IMethodSymbol toUnmanagedMethod = methods.ToUnmanaged ?? methods.ToUnmanagedWithBuffer; 913IMethodSymbol toManagedMethod = methods.ToManaged ?? methods.ToManagedFinally; 963private void VerifyUnmanagedCollectionElementType(DiagnosticReporter diagnosticReporter, IMethodSymbol? unmanagedValuesCollectionMethod, ITypeSymbol expectedElementType, INamedTypeSymbol expectedSpanType) 983private static void CheckForBufferSizeMember(DiagnosticReporter diagnosticReporter, DiagnosticDescriptor descriptor, INamedTypeSymbol marshallerType, IMethodSymbol callerAllocatedBufferMethod) 1212IMethodSymbol fromUnmanagedMethod = fromUnmanagedCandidates[0];
Analyzers\NativeMarshallingAttributeAnalyzer.cs (1)
169IMethodSymbol method => method.ReturnType,
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (1)
47if (methods.IsShapeMethod((IMethodSymbol)diagnosedSymbol))
LibraryImportGenerator.cs (5)
47static (context, ct) => context.TargetSymbol is IMethodSymbol methodSymbol 58? DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From(diagnostic) 59: DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From((data.Syntax, data.Symbol)); 216IMethodSymbol symbol, 531private static DiagnosticInfo? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (2)
240protected static SyntaxNode AddExplicitDefaultBoolMarshalling(SyntaxGenerator generator, IMethodSymbol methodSymbol, SyntaxNode generatedDeclaration, string unmanagedTypeMemberIdentifier) 271protected static SyntaxNode AddHResultStructAsErrorMarshalling(SyntaxGenerator generator, IMethodSymbol methodSymbol, SyntaxNode generatedDeclaration)
Microsoft.Interop.LibraryImportGenerator.Downlevel (6)
DownlevelLibraryImportGenerator.cs (5)
46static (context, ct) => context.TargetSymbol is IMethodSymbol methodSymbol 57? DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From(diagnostic) 58: DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From((data.Syntax, data.Symbol)); 162IMethodSymbol symbol, 411private static DiagnosticInfo? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method)
DownlevelLibraryImportGeneratorHelpers.cs (1)
12public static MarshallingInfoParser CreateMarshallingInfoParser(StubEnvironment env, GeneratorDiagnosticsBag diagnostics, IMethodSymbol method, InteropAttributeCompilationData interopAttributeData)
Microsoft.Interop.SourceGeneration (122)
DefaultMarshallingInfoParser.cs (1)
32public static MarshallingInfoParser Create(StubEnvironment env, GeneratorDiagnosticsBag diagnostics, IMethodSymbol method, InteropAttributeCompilationData interopAttributeData, AttributeData unparsedAttributeData)
MarshallerShape.cs (113)
99public IMethodSymbol? ToUnmanaged { get; init; } 100public IMethodSymbol? ToUnmanagedWithBuffer { get; init; } 101public IMethodSymbol? ToManaged { get; init; } 102public IMethodSymbol? ToManagedFinally { get; init; } 105public IMethodSymbol? ManagedValuesSource { get; init; } 106public IMethodSymbol? UnmanagedValuesDestination { get; init; } 107public IMethodSymbol? ManagedValuesDestination { get; init; } 108public IMethodSymbol? UnmanagedValuesSource { get; init; } 121IMethodSymbol? allocateUnmanaged = LinearCollection.AllocateContainerForUnmanagedElements(marshallerType, managedType); 122IMethodSymbol? allocateUnmanagedWithBuffer = LinearCollection.AllocateContainerForUnmanagedElementsWithCallerAllocatedBuffer(marshallerType, managedType, spanOfT); 123IMethodSymbol? managedSource = LinearCollection.GetManagedValuesSource(marshallerType, managedType, readOnlySpanOfT); 124IMethodSymbol? unmanagedDestination = LinearCollection.GetUnmanagedValuesDestination(marshallerType, spanOfT); 145IMethodSymbol? allocateManaged = LinearCollection.AllocateContainerForManagedElements(marshallerType, managedType); 146IMethodSymbol? allocateManagedGuaranteed = LinearCollection.AllocateContainerForManagedElementsFinally(marshallerType, managedType); 147IMethodSymbol? managedDestination = LinearCollection.GetManagedValuesDestination(marshallerType, managedType, spanOfT); 148IMethodSymbol? unmanagedSource = LinearCollection.GetUnmanagedValuesSource(marshallerType, readOnlySpanOfT); 170IMethodSymbol? toUnmanaged = Value.ConvertToUnmanaged(marshallerType, managedType); 174IMethodSymbol? toUnmanagedWithBuffer = Value.ConvertToUnmanagedWithCallerAllocatedBuffer(marshallerType, managedType, spanOfT); 178IMethodSymbol? toManaged = Value.ConvertToManaged(marshallerType, managedType); 182IMethodSymbol? toManagedFinally = Value.ConvertToManagedFinally(marshallerType, managedType); 204private static IMethodSymbol? GetStatelessFree(ITypeSymbol type) 208.OfType<IMethodSymbol>() 212private static IMethodSymbol? GetStatelessGetPinnableReference(ITypeSymbol type, ITypeSymbol managedType) 218.OfType<IMethodSymbol>() 257internal static IMethodSymbol? ConvertToUnmanaged(ITypeSymbol type, ITypeSymbol managedType) 261.OfType<IMethodSymbol>() 266internal static IMethodSymbol? ConvertToUnmanagedWithCallerAllocatedBuffer( 272IEnumerable<IMethodSymbol> methods = type.GetMembers(ShapeMemberNames.Value.Stateless.ConvertToUnmanaged) 273.OfType<IMethodSymbol>() 277foreach (IMethodSymbol method in methods) 288internal static IMethodSymbol? ConvertToManaged(ITypeSymbol type, ITypeSymbol managedType) 292.OfType<IMethodSymbol>() 297internal static IMethodSymbol? ConvertToManagedFinally(ITypeSymbol type, ITypeSymbol managedType) 301.OfType<IMethodSymbol>() 309internal static IMethodSymbol? AllocateContainerForUnmanagedElements(ITypeSymbol type, ITypeSymbol managedType) 313.OfType<IMethodSymbol>() 320internal static IMethodSymbol? AllocateContainerForUnmanagedElementsWithCallerAllocatedBuffer(ITypeSymbol type, ITypeSymbol managedType, ITypeSymbol spanOfT) 323IEnumerable<IMethodSymbol> methods = type.GetMembers(ShapeMemberNames.LinearCollection.Stateless.AllocateContainerForUnmanagedElements) 324.OfType<IMethodSymbol>() 330foreach (IMethodSymbol method in methods) 341internal static IMethodSymbol? GetManagedValuesSource(ITypeSymbol type, ITypeSymbol managedType, ITypeSymbol readOnlySpanOfT) 345.OfType<IMethodSymbol>() 351internal static IMethodSymbol? GetUnmanagedValuesDestination(ITypeSymbol type, ITypeSymbol spanOfT) 355.OfType<IMethodSymbol>() 361internal static IMethodSymbol? AllocateContainerForManagedElements(ITypeSymbol type, ITypeSymbol managedType) 365.OfType<IMethodSymbol>() 371internal static IMethodSymbol? AllocateContainerForManagedElementsFinally(ITypeSymbol type, ITypeSymbol managedType) 375.OfType<IMethodSymbol>() 381internal static IMethodSymbol? GetManagedValuesDestination(ITypeSymbol type, ITypeSymbol managedType, ITypeSymbol spanOfT) 385.OfType<IMethodSymbol>() 391internal static IMethodSymbol? GetUnmanagedValuesSource(ITypeSymbol type, ITypeSymbol readOnlySpanOfT) 395.OfType<IMethodSymbol>() 410public IMethodSymbol? FromManaged { get; init; } 411public IMethodSymbol? FromManagedWithBuffer { get; init; } 412public IMethodSymbol? ToManaged { get; init; } 413public IMethodSymbol? ToManagedGuaranteed { get; init; } 414public IMethodSymbol? FromUnmanaged { get; init; } 415public IMethodSymbol? ToUnmanaged { get; init; } 416public IMethodSymbol? Free { get; init; } 417public IMethodSymbol? OnInvoked { get; init; } 418public IMethodSymbol? StatelessGetPinnableReference { get; init; } 419public IMethodSymbol? StatefulGetPinnableReference { get; init; } 422public IMethodSymbol? ManagedValuesSource { get; init; } 423public IMethodSymbol? UnmanagedValuesDestination { get; init; } 424public IMethodSymbol? ManagedValuesDestination { get; init; } 425public IMethodSymbol? UnmanagedValuesSource { get; init; } 427public bool IsShapeMethod(IMethodSymbol method) 453IMethodSymbol? fromManaged = GetFromManagedMethod(marshallerType, managedType); 455IMethodSymbol? fromManagedWithCallerAllocatedBuffer = GetFromManagedWithCallerAllocatedBufferMethod(marshallerType, managedType, spanOfT); 457IMethodSymbol? toUnmanaged = GetToUnmanagedMethod(marshallerType); 460IMethodSymbol? managedSource = null; 461IMethodSymbol? unmanagedDestination = null; 494IMethodSymbol toManaged = GetToManagedMethod(marshallerType, managedType); 495IMethodSymbol toManagedFinally = GetToManagedFinallyMethod(marshallerType, managedType); 496IMethodSymbol fromUnmanaged = GetFromUnmanagedMethod(marshallerType, unmanagedType); 497IMethodSymbol? managedDestination = null; 498IMethodSymbol? unmanagedSource = null; 527IMethodSymbol free = GetStatefulFreeMethod(marshallerType); 533IMethodSymbol OnInvoked = GetOnInvokedMethod(marshallerType); 539IMethodSymbol statelessGetPinnableReference = GetStatelessGetPinnableReference(marshallerType, managedType); 545IMethodSymbol statefulGetPinnableReference = GetStatefulGetPinnableReference(marshallerType); 561private static IMethodSymbol? GetFromManagedMethod(ITypeSymbol type, ITypeSymbol managedType) 564.OfType<IMethodSymbol>() 569private static IMethodSymbol? GetFromManagedWithCallerAllocatedBufferMethod( 574IEnumerable<IMethodSymbol> methods = type.GetMembers(ShapeMemberNames.Value.Stateful.FromManaged) 575.OfType<IMethodSymbol>() 579foreach (IMethodSymbol method in methods) 590private static IMethodSymbol? GetToManagedMethod(ITypeSymbol type, ITypeSymbol managedType) 593.OfType<IMethodSymbol>() 598private static IMethodSymbol? GetToManagedFinallyMethod(ITypeSymbol type, ITypeSymbol managedType) 601.OfType<IMethodSymbol>() 606private static IMethodSymbol? GetToUnmanagedMethod(ITypeSymbol type) 609.OfType<IMethodSymbol>() 613public static ImmutableArray<IMethodSymbol> GetFromUnmanagedMethodCandidates(ITypeSymbol type) 616.OfType<IMethodSymbol>() 621private static IMethodSymbol? GetFromUnmanagedMethod(ITypeSymbol type, ITypeSymbol? unmanagedType) 623ImmutableArray<IMethodSymbol> candidates = GetFromUnmanagedMethodCandidates(type); 652private static IMethodSymbol? GetStatefulFreeMethod(ITypeSymbol type) 655.OfType<IMethodSymbol>() 659private static IMethodSymbol? GetOnInvokedMethod(ITypeSymbol type) 662.OfType<IMethodSymbol>() 666private static IMethodSymbol? GetStatelessGetPinnableReference(ITypeSymbol type, ITypeSymbol managedType) 669.OfType<IMethodSymbol>() 675private static IMethodSymbol? GetStatefulGetPinnableReference(ITypeSymbol type) 678.OfType<IMethodSymbol>() 685internal static IMethodSymbol? GetManagedValuesSource(ITypeSymbol type, ITypeSymbol readOnlySpanOfT) 689.OfType<IMethodSymbol>() 694internal static IMethodSymbol? GetUnmanagedValuesDestination(ITypeSymbol type, ITypeSymbol spanOfT) 698.OfType<IMethodSymbol>() 703internal static IMethodSymbol? GetManagedValuesDestination(ITypeSymbol type, ITypeSymbol spanOfT) 707.OfType<IMethodSymbol>() 713internal static IMethodSymbol? GetUnmanagedValuesSource(ITypeSymbol type, ITypeSymbol readOnlySpanOfT) 717.OfType<IMethodSymbol>()
Marshalling\MarshallerHelpers.cs (1)
375public static void ValidateCountInfoAvailableAtCall(MarshalDirection stubDirection, TypePositionInfo info, GeneratorDiagnosticsBag generatorDiagnostics, IMethodSymbol symbol, DiagnosticDescriptor outParamDescriptor, DiagnosticDescriptor returnValueDescriptor)
MethodSignatureElementInfoProvider.cs (2)
16private readonly IMethodSymbol _method; 19public MethodSignatureElementInfoProvider(Compilation compilation, GeneratorDiagnosticsBag generatorDiagnostics, IMethodSymbol method, ImmutableArray<IUseSiteAttributeParser> useSiteAttributeParsers)
SafeHandleMarshallingInfoProvider.cs (1)
46foreach (IMethodSymbol ctor in named.InstanceConstructors)
SignatureContext.cs (3)
56IMethodSymbol method, 102IMethodSymbol method, 149private static bool MethodIsSkipLocalsInit(StubEnvironment env, IMethodSymbol method)
TypePositionInfo.cs (1)
105public static Location GetLocation(TypePositionInfo info, IMethodSymbol methodSymbol)
Microsoft.ML.CodeAnalyzer.Tests (2)
Code\RelaxTestNamingTest.cs (2)
121var method = (IMethodSymbol)context.Symbol;
Microsoft.ML.InternalCodeAnalyzer (4)
BaseTestClassAnalyzer.cs (1)
76if (member is IMethodSymbol method && method.IsTestMethod(_knownTestAttributes, _factAttribute))
ContractsCheckAnalyzer.cs (1)
196if (!(symbolInfo.Symbol is IMethodSymbol methodSymbol))
IMethodSymbolExtensions.cs (1)
12public static bool IsTestMethod(this IMethodSymbol method, ConcurrentDictionary<INamedTypeSymbol, bool> knownTestAttributes, INamedTypeSymbol factAttribute)
RelaxTestNamingSuppressor.cs (1)
46if (declaredSymbol is IMethodSymbol method
Microsoft.VisualStudio.LanguageServices (33)
CallHierarchy\CallHierarchyProvider.cs (1)
85if (symbol is IMethodSymbol methodSymbol)
Implementation\VsRefactorNotifyService.cs (2)
163var methodSymbol = symbol as IMethodSymbol;
Library\ObjectBrowser\AbstractDescriptionBuilder.cs (2)
211BuildMethodDeclaration((IMethodSymbol)symbol, options); 240protected abstract void BuildMethodDeclaration(IMethodSymbol methodSymbol, _VSOBJDESCOPTIONS options);
Library\ObjectBrowser\AbstractListItemFactory.cs (1)
344if (member is IMethodSymbol methodSymbol)
Library\ObjectBrowser\Lists\MemberListItem.cs (2)
41var methodSymbol = (IMethodSymbol)symbol;
Progression\GraphBuilder.cs (6)
276node = await GetOrCreateNodeForMethodAsync(graph, (IMethodSymbol)symbol, solution, cancellationToken).ConfigureAwait(false); 385var methodSymbol = (IMethodSymbol)symbol; 502else if (symbol is IMethodSymbol methodSymbol) 508private static void UpdateMethodPropertiesForNode(IMethodSymbol symbol, GraphNode node) 617private static async Task<GraphNode> GetOrCreateNodeForMethodAsync(Graph graph, IMethodSymbol method, Solution solution, CancellationToken cancellationToken)
Progression\GraphNodeIdCreation.cs (2)
322if (member is IMethodSymbol methodSymbol && methodSymbol.MethodKind == MethodKind.Conversion) 469if (containingSymbol is IMethodSymbol method && method.AssociatedSymbol != null && method.AssociatedSymbol.Kind == SymbolKind.Property)
Progression\GraphQueries\CallsGraphQuery.cs (2)
54if (newSymbol != null && newSymbol is IMethodSymbol && 55(newSymbol.CanBeReferencedByName || ((IMethodSymbol)newSymbol).MethodKind == MethodKind.Constructor))
Progression\GraphQueries\ImplementedByGraphQuery.cs (1)
29IMethodSymbol or
Progression\GraphQueries\ImplementsGraphQuery.cs (1)
35else if (symbol is IMethodSymbol or
Progression\GraphQueries\OverridesGraphQuery.cs (1)
27if (symbol is IMethodSymbol or
Progression\SymbolContainment.cs (1)
79if (member is IMethodSymbol method && method.AssociatedSymbol != null)
ProjectSystem\AbstractEntryPointFinder.cs (1)
33public override void VisitMethod(IMethodSymbol symbol)
Snippets\SnippetExpansionClient.cs (4)
549var methodSymbols = symbols.OfType<IMethodSymbol>().ToImmutableArray(); 744if (newSymbol is not IMethodSymbol method) 773public void MoveToSpecificMethod(IMethodSymbol method, CancellationToken cancellationToken) 1166public IMethodSymbol? _method;
Venus\ContainedLanguageCodeSupport.cs (6)
109var methods = type.GetMembers().OfType<IMethodSymbol>().Where(m => m.CompatibleSignatureToDelegate((INamedTypeSymbol)eventType)); 189var invokeMethod = ((INamedTypeSymbol)eventType).DelegateInvokeMethod; 190var newMethod = CodeGenerationSymbolFactory.CreateMethodSymbol( 377var method = (IMethodSymbol)member; 450return string.Format("{0}({1})", member.Name, string.Join(",", ((IMethodSymbol)member).Parameters.Select(p => p.Type.ToDisplayString())));
Microsoft.VisualStudio.LanguageServices.CSharp (19)
CodeModel\CSharpCodeModelService.cs (4)
994if (symbol is IMethodSymbol methodSymbol) 2186public override EnvDTE.vsCMFunction GetFunctionKind(IMethodSymbol symbol) 3618var methodSymbol = (IMethodSymbol)symbol;
CodeModel\CSharpCodeModelService_Prototype.cs (5)
33return GetFunctionPrototype((IMethodSymbol)symbol, flags); 56return GetFunctionPrototype(methodDeclaration, (IMethodSymbol)symbol, flags); 139private string GetFunctionPrototype(IMethodSymbol symbol, PrototypeFlags flags) 160private string GetFunctionPrototype(BaseMethodDeclarationSyntax node, IMethodSymbol symbol, PrototypeFlags flags) 387private void AppendFunctionPrototype(StringBuilder builder, IMethodSymbol symbol, PrototypeFlags flags, string baseName)
CodeModel\MethodXml\MethodXmlBuilder.cs (2)
17private MethodXmlBuilder(IMethodSymbol symbol, SemanticModel semanticModel) 611var symbol = semanticModel.GetDeclaredSymbol(methodDeclaration);
LanguageService\CSharpHelpContextService.cs (1)
199if (symbol is IMethodSymbol method && method.MethodKind == MethodKind.BuiltinOperator)
ObjectBrowser\DescriptionBuilder.cs (5)
40var delegateInvokeMethod = typeSymbol.DelegateInvokeMethod; 190protected override void BuildMethodDeclaration(IMethodSymbol methodSymbol, _VSOBJDESCOPTIONS options) 249var methodSymbol = memberSymbol as IMethodSymbol; 332private void BuildGenericConstraints(IMethodSymbol methodSymbol)
Progression\CSharpProgressionLanguageService.cs (2)
119case IMethodSymbol m: return IncludeReturnType(m) ? m.ReturnType : null; 126private static bool IncludeReturnType(IMethodSymbol f)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
GlyphExtensionsTests.cs (1)
226var methodTypeMock = symbolMock.As<IMethodSymbol>();
Microsoft.VisualStudio.LanguageServices.UnitTests (4)
CommonControls\NewTypeDestinationSelectionViewModelTests.vb (2)
238Dim extractableMembers = DirectCast(symbol, INamedTypeSymbol).GetMembers().Where(Function(s) Not (TypeOf s Is IMethodSymbol) OrElse DirectCast(s, IMethodSymbol).MethodKind <> MethodKind.Constructor)
ExtractInterface\ExtractInterfaceViewModelTests.vb (2)
301Dim extractableMembers = DirectCast(symbol, INamedTypeSymbol).GetMembers().Where(Function(s) Not (TypeOf s Is IMethodSymbol) OrElse DirectCast(s, IMethodSymbol).MethodKind <> MethodKind.Constructor)
Microsoft.VisualStudio.LanguageServices.VisualBasic (15)
CodeModel\MethodXML\MethodXmlBuilder.vb (3)
20Private Sub New(symbol As IMethodSymbol, semanticModel As SemanticModel) 127Dim eventAccessor As IMethodSymbol 664Dim delegateSymbol = TryCast(SemanticModel.GetSymbolInfo(delegateExpression).Symbol, IMethodSymbol)
CodeModel\VisualBasicCodeModelService.vb (4)
1385Dim methodSymbol = TryCast(symbol, IMethodSymbol) 2538Public Overrides Function GetFunctionKind(symbol As IMethodSymbol) As EnvDTE.vsCMFunction 4168Not TypeOf symbol Is IMethodSymbol Then 4174Dim methodSymbol = DirectCast(symbol, IMethodSymbol)
CodeModel\VisualBasicCodeModelService_Prototype.vb (2)
41Dim methodSymbol = DirectCast(symbol, IMethodSymbol) 95Dim methodSymbol = DirectCast(symbol, IMethodSymbol)
ObjectBrowser\DescriptionBuilder.vb (5)
114Protected Overrides Sub BuildMethodDeclaration(methodSymbol As IMethodSymbol, options As _VSOBJDESCOPTIONS) 125Private Sub BuildOperatorDeclaration(methodSymbol As IMethodSymbol) 150Private Sub BuildDeclareMethodDeclaration(methodSymbol As IMethodSymbol) 197Private Sub BuildRegularMethodDeclaration(methodSymbol As IMethodSymbol) 334Dim methodSymbol = TryCast(memberSymbol, IMethodSymbol)
Venus\ContainedLanguageStaticEventBinding.vb (1)
30Cast(Of IMethodSymbol)()
Mvc.Analyzers.Test (38)
CodeAnalysisExtensionsTest.cs (20)
27var method = (IMethodSymbol)testClass.GetMembers("Method").First(); 55var method = (IMethodSymbol)testClass.GetMembers("Method").First(); 92var method = (IMethodSymbol)testClass.GetMembers("Method").First(); 129var method = (IMethodSymbol)testClass.GetMembers("Method").First(); 166var method = (IMethodSymbol)testClass.GetMembers("Method").First(); 211var method = (IMethodSymbol)testClass.GetMembers("VirtualMethod").First(); 254var method = (IMethodSymbol)testClass.GetMembers("NotVirtualMethod").First(); 475var testMethod = (IMethodSymbol)testClass.GetMembers("SomeMethod").First(); 592var method = (IMethodSymbol)testClass.GetMembers("SomeMethod").First(); 626var method = (IMethodSymbol)testClass.GetMembers("SomeMethod").First();
TopLevelParameterNameAnalyzerTest.cs (18)
322var method = (IMethodSymbol)modelType.GetMembers("ActionMethod").First(); 412var method = (IMethodSymbol)modelType.GetMembers("ActionMethod").First(); 437var method = (IMethodSymbol)type.GetMembers("Action").First(); 462var method = (IMethodSymbol)type.GetMembers("Action").First(); 486var method = (IMethodSymbol)type.GetMembers("Action").First(); 510var method = (IMethodSymbol)type.GetMembers("Action").First(); 534var method = (IMethodSymbol)type.GetMembers("Action").First(); 557var method = (IMethodSymbol)type.GetMembers("Action").First(); 580var method = (IMethodSymbol)type.GetMembers("Action").First();
Mvc.Api.Analyzers.Test (87)
ActualApiResponseMetadataFactoryTest.cs (8)
76var method = (IMethodSymbol)returnType.GetMembers().First(); 370var method = (IMethodSymbol)type.GetMembers(methodName).First(); 393var method = (IMethodSymbol)Assert.Single(controllerType.GetMembers(test)); 412var method = (IMethodSymbol)returnType.GetMembers().First();
ApiControllerFactsTest.cs (12)
37var method = (IMethodSymbol)compilation.GetTypeByMetadataName("TestNamespace.TestController").GetMembers("Get").First(); 53var method = (IMethodSymbol)type.GetMembers(nameof(ApiConventionAnalyzerTest_IndexModel.OnGet)).First(); 69var method = (IMethodSymbol)type.GetMembers(nameof(ApiConventionAnalyzerTest_NotApiController.Index)).First(); 85var method = (IMethodSymbol)type.GetMembers(nameof(ApiConventionAnalyzerTest_NotAction.Index)).First(); 101var method = (IMethodSymbol)type.GetMembers(nameof(ApiConventionAnalyzerTest_Valid.Index)).First(); 117var method = (IMethodSymbol)type.GetMembers(nameof(IsApiControllerAction_ReturnsTrue_IfAttributeIsDeclaredOnAssemblyController.Action)).First();
DeclaredApiResponseMetadataTest.cs (8)
48var declaredMetadata = DeclaredApiResponseMetadata.ForProducesResponseType(200, AttributeData, Mock.Of<IMethodSymbol>()); 66var declaredMetadata = DeclaredApiResponseMetadata.ForProducesResponseType(201, AttributeData, Mock.Of<IMethodSymbol>()); 84var declaredMetadata = DeclaredApiResponseMetadata.ForProducesResponseType(201, AttributeData, Mock.Of<IMethodSymbol>()); 98var declaredMetadata = DeclaredApiResponseMetadata.ForProducesResponseType(302, AttributeData, Mock.Of<IMethodSymbol>()); 115var declaredMetadata = DeclaredApiResponseMetadata.ForProducesDefaultResponse(AttributeData, Mock.Of<IMethodSymbol>()); 129var declaredMetadata = DeclaredApiResponseMetadata.ForProducesDefaultResponse(AttributeData, Mock.Of<IMethodSymbol>()); 143var declaredMetadata = DeclaredApiResponseMetadata.ForProducesDefaultResponse(AttributeData, Mock.Of<IMethodSymbol>()); 157protected override IMethodSymbol CommonAttributeConstructor => throw new System.NotImplementedException();
MvcFactsTest.cs (11)
151var disposableDispose = GetDisposableDispose(compilation); 153var method = (IMethodSymbol)typeSymbol.GetMembers(methodName).First(); 183var disposableDispose = GetDisposableDispose(compilation); 185var method = typeSymbol.GetMembers(nameof(IDisposable.Dispose)).OfType<IMethodSymbol>().First(f => !f.ReturnsVoid); 198var disposableDispose = GetDisposableDispose(compilation); 200var method = (IMethodSymbol)typeSymbol.GetMembers(methodName).First(); 209private IMethodSymbol GetDisposableDispose(Compilation compilation) 212return (IMethodSymbol)type.GetMembers(nameof(IDisposable.Dispose)).First();
SymbolApiConventionMatcherTest.cs (10)
432var method = (IMethodSymbol)testController.GetMembers(methodName).First(); 433var conventionMethod = (IMethodSymbol)testConvention.GetMembers(conventionMethodName).First(); 505var method = (IMethodSymbol)testConvention.GetMembers(nameof(TestConvention.Get)).First(); 524var method = (IMethodSymbol)testConvention.GetMembers(nameof(TestConvention.MethodParameterWithRandomAttributes)).First(); 543var method = (IMethodSymbol)testConvention.GetMembers(nameof(TestConvention.MethodWithAnyTypeMatchBehaviorParameter)).First();
SymbolApiResponseMetadataProviderTest.cs (38)
19var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerWithoutConvention.GetPerson)).First(); 37var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerWithoutConvention.PostPerson)).First(); 55var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerActionWithAttributes.ActionWithProducesAttribute)).First(); 73var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerActionWithAttributes.ActionWithProducesResponseType_StatusCodeInConstructor)).First(); 96var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerActionWithAttributes.ActionWithProducesResponseType_StatusCodeAndTypeInConstructor)).First(); 119var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerActionWithAttributes.ActionWithProducesResponseType_StatusCodeInConstructorAndProperty)).First(); 142var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerActionWithAttributes.ActionWithProducesResponseType_StatusCodeAndTypeInConstructorAndProperty)).First(); 165var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerActionWithAttributes.ActionWithCustomProducesResponseTypeAttributeWithArguments)).First(); 187var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerActionWithAttributes.GetResponseMetadata_ReturnsValuesFromApiConventionMethodAttribute)).First(); 218var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerActionWithAttributes.GetResponseMetadata_WithProducesResponseTypeAndApiConventionMethod)).First(); 240var method = (IMethodSymbol)controller.GetMembers(nameof(GetResponseMetadata_ControllerActionWithAttributes.ActionWithCustomApiResponseMetadataProvider)).First(); 273var method = (IMethodSymbol)controller.GetMembers(methodName).First(); 296var method = (IMethodSymbol)controller.GetMembers().First(); 318var method = (IMethodSymbol)controller.GetMembers().First(); 392var method = (IMethodSymbol)controller.GetMembers(actionName).First(); 408var method = (IMethodSymbol)type.GetMembers("Action").First(); 426var method = (IMethodSymbol)type.GetMembers("Action").First(); 444var method = (IMethodSymbol)type.GetMembers("Action").First(); 462var method = (IMethodSymbol)type.GetMembers("Action").First();
Roslyn.Test.PdbUtilities (11)
Reader\PdbValidation.cs (11)
35IMethodSymbol debugEntryPoint = null, 49IMethodSymbol debugEntryPoint = null, 65IMethodSymbol debugEntryPoint = null, 81IMethodSymbol debugEntryPoint = null, 154IMethodSymbol debugEntryPoint = null, 169IMethodSymbol debugEntryPoint = null, 193IMethodSymbol debugEntryPoint = null, 207IMethodSymbol debugEntryPoint = null, 229IMethodSymbol debugEntryPoint, 511IMethodSymbol debugEntryPoint = null, 525private static void EmitWithPdb(MemoryStream peStream, MemoryStream pdbStream, Compilation compilation, IMethodSymbol debugEntryPoint, IEnumerable<EmbeddedText> embeddedTexts, bool portable)
SemanticSearch.BuildTask (5)
GenerateFilteredReferenceAssembliesTask.cs (5)
199List<IMethodSymbol> methods, 218case IMethodSymbol method: 286var methods = new List<IMethodSymbol>(); 391private static unsafe void UpdateMethodDefinitions(BinaryWriter writer, MetadataReader metadataReader, ImmutableArray<ApiPattern> patterns, ImmutableArray<IMethodSymbol> symbols, int metadataOffset) 399var symbol = GetSymbolWithToken(symbols, ref symbolIndex, handle);
System.Private.CoreLib.Generators (3)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (3)
167var methodSymbol = (IMethodSymbol)context.Symbol; 451private static void AnalyzeOperation(IOperation operation, IMethodSymbol methodSymbol, OperationAnalysisContext context, IntrinsicsAnalyzerOnLoadData onLoadData)
System.Text.Json.SourceGeneration (14)
Helpers\RoslynExtensions.cs (2)
104public static bool CanUseDefaultConstructorForDeserialization(this ITypeSymbol type, out IMethodSymbol? constructorInfo) 116public static IEnumerable<IMethodSymbol> GetExplicitlyDeclaredInstanceConstructors(this INamedTypeSymbol type)
JsonSourceGenerator.Parser.cs (10)
585if (type.CanUseDefaultConstructorForDeserialization(out IMethodSymbol? defaultCtor)) 609if (!TryGetDeserializationConstructor(type, useDefaultCtorInAnnotatedStructs, out IMethodSymbol? constructor)) 1431IMethodSymbol? constructor, 1711out IMethodSymbol? deserializationCtor) 1713IMethodSymbol? ctorWithAttribute = null; 1714IMethodSymbol? publicParameterlessCtor = null; 1715IMethodSymbol? lonePublicCtor = null; 1723IMethodSymbol[] publicCtors = namedType.GetExplicitlyDeclaredInstanceConstructors().Where(ctor => ctor.DeclaredAccessibility is Accessibility.Public).ToArray(); 1730foreach (IMethodSymbol constructor in publicCtors) 1749foreach (IMethodSymbol constructor in namedType.GetExplicitlyDeclaredInstanceConstructors().Where(ctor => ctor.DeclaredAccessibility is not Accessibility.Public))
JsonSourceGenerator.Roslyn3.11.cs (2)
123IMethodSymbol? attributeSymbol = context.SemanticModel.GetSymbolInfo(attributeSyntax, cancellationToken).Symbol as IMethodSymbol;
System.Text.RegularExpressions.Generator (9)
RegexGenerator.Parser.cs (2)
56ISymbol? regexMemberSymbol = context.TargetSymbol is IMethodSymbol or IPropertySymbol ? context.TargetSymbol : null; 113if (regexMemberSymbol is IMethodSymbol regexMethodSymbol)
UpgradeToGeneratedRegexAnalyzer.cs (7)
51HashSet<IMethodSymbol> staticMethodsToDetect = GetMethodSymbolHash(regexTypeSymbol, 62static HashSet<IMethodSymbol> GetMethodSymbolHash(INamedTypeSymbol regexTypeSymbol, HashSet<string> methodNames) 68HashSet<IMethodSymbol> hash = new HashSet<IMethodSymbol>(SymbolEqualityComparer.Default); 73if (member is IMethodSymbol method && 90private static void AnalyzeInvocation(OperationAnalysisContext context, INamedTypeSymbol regexTypeSymbol, HashSet<IMethodSymbol> staticMethodsToDetect) 94IMethodSymbol method = invocationOperation.TargetMethod;
System.Windows.Forms.Analyzers.CSharp (3)
System\Windows\Forms\CSharp\Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.cs (1)
35|| context.SemanticModel.GetSymbolInfo(memberAccessExpr).Symbol is not IMethodSymbol methodSymbol
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (2)
61IMethodSymbol? shouldSerializeMethod = classSymbol 63.OfType<IMethodSymbol>()
System.Windows.Forms.Analyzers.VisualBasic (3)
Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.vb (1)
40Dim methodSymbol = TryCast(context.SemanticModel.GetSymbolInfo(memberAccessExpr).Symbol, IMethodSymbol)
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (2)
64Dim shouldSerializeMethod As IMethodSymbol = classSymbol.GetMembers(). 65OfType(Of IMethodSymbol)().