src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (5)
96protected abstract TExpression? GetGetterExpression(IMethodSymbol getMethod, CancellationToken cancellationToken);
97protected abstract TExpression? GetSetterExpression(SemanticModel semanticModel, IMethodSymbol setMethod, CancellationToken cancellationToken);
100SemanticModel semanticModel, IMethodSymbol accessor, HashSet<string> fieldNames, HashSet<IFieldSymbol> result, CancellationToken cancellationToken);
264IMethodSymbol getMethod,
282SemanticModel semanticModel, IMethodSymbol setMethod, HashSet<string> fieldNames, CancellationToken cancellationToken)
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\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\Utilities\AbstractSpeculationAnalyzer.cs (12)
114SemanticModel model, TForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType, out ImmutableArray<ILocalSymbol> localVariables);
378symbol = ((IMethodSymbol)symbol).GetConstructedReducedFrom()!;
383newSymbol = ((IMethodSymbol)newSymbol).GetConstructedReducedFrom()!;
403if (symbol is IMethodSymbol methodSymbol && newSymbol is IMethodSymbol newMethodSymbol)
477if (symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } methodSymbol &&
478newSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } newMethodSymbol)
780GetForEachSymbols(this.OriginalSemanticModel, forEachStatement, out var originalGetEnumerator, out var originalElementType, out var originalLocalVariables);
781GetForEachSymbols(this.SpeculativeSemanticModel, newForEachStatement, out var newGetEnumerator, out var newElementType, out var newLocalVariables);
808private bool ReplacementBreaksForEachGetEnumerator(IMethodSymbol getEnumerator, IMethodSymbol newGetEnumerator, TExpressionSyntax newForEachStatementExpression)
879((IMethodSymbol)symbol).MethodKind == MethodKind.DelegateInvoke;
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\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\AbstractGenerateParameterizedMemberService.State.cs (1)
83.OfType<IMethodSymbol>();
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (5)
168IMethodSymbol method => GenerateMethod(compilation, method, throughMember, modifiers, accessibility),
176Compilation compilation, IMethodSymbol method, ISymbol? throughMember,
247private IMethodSymbol? GetEventAddOrRemoveMethod(
248IEventSymbol @event, IMethodSymbol? accessor, ISymbol? throughMember,
266private bool ShouldGenerateAccessor([NotNullWhen(true)] IMethodSymbol? method)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (8)
266if (member is not IMethodSymbol method)
305IMethodSymbol method => [GenerateMethod(compilation, method, conflictingMember as IMethodSymbol, accessibility, modifiers, generateAbstractly, useExplicitInterfaceSymbol, memberName)],
314var accessor = CodeGenerationSymbolFactory.CreateAccessorSymbol(
329private IMethodSymbol? GetAddOrRemoveMethod(
330IEventSymbol @event, bool generateInvisibly, IMethodSymbol accessor, string memberName,
366if (member is IMethodSymbol method1 && baseMember is IMethodSymbol method2)
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\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\CodeGenerationSymbolFactory.cs (28)
38IMethodSymbol? addMethod = null,
39IMethodSymbol? removeMethod = null,
40IMethodSymbol? raiseMethod = null)
57IMethodSymbol? getMethod,
58IMethodSymbol? setMethod,
85ImmutableArray<IParameterSymbol> parameters, IMethodSymbol? getMethod, IMethodSymbol? setMethod,
124public static IMethodSymbol CreateConstructorSymbol(
143public static IMethodSymbol CreateDestructorSymbol(
152internal static IMethodSymbol CreateMethodSymbol(
159ImmutableArray<IMethodSymbol> explicitInterfaceImplementations,
177public static IMethodSymbol CreateMethodSymbol(
181ImmutableArray<IMethodSymbol> explicitInterfaceImplementations,
196public static IMethodSymbol CreateOperatorSymbol(
224public static IMethodSymbol CreateConversionSymbol(
249public static IMethodSymbol CreateConversionSymbol(
361internal static IMethodSymbol CreateAccessorSymbol(
362IMethodSymbol accessor,
365ImmutableArray<IMethodSymbol> explicitInterfaceImplementations = default,
387public static IMethodSymbol CreateAccessorSymbol(
475var invokeMethod = CreateMethodSymbol(
515internal static IMethodSymbol CreateMethodSymbol(
516IMethodSymbol method,
520ImmutableArray<IMethodSymbol> explicitInterfaceImplementations = default,
554IMethodSymbol? getMethod = null,
555IMethodSymbol? setMethod = null,
580IMethodSymbol? addMethod = null,
581IMethodSymbol? removeMethod = null)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (12)
103protected static IMethodSymbol? FindDisposeMethod(Compilation compilation, ITypeSymbol? type, bool isAsync)
115if (impl is IMethodSymbol implMethod)
133.FirstOrDefault(m => m is IMethodSymbol { DeclaredAccessibility: Accessibility.Public, ReturnType: var returnType, Parameters.Length: 0 } &&
134SymbolEqualityComparer.Default.Equals(returnType, valueTaskType)) is IMethodSymbol disposeMethodFromPattern)
149.FirstOrDefault(m => m is IMethodSymbol { DeclaredAccessibility: Accessibility.Public, ReturnsVoid: true, Parameters.Length: 0 }) is IMethodSymbol disposeMethodFromPattern)
162(INamedTypeSymbol?, IMethodSymbol?) GetIDisposableInterfaceAndDisposeMethod(string typeName, string methodName)
165return (disposableType, disposableType?.GetMembers().OfType<IMethodSymbol>().FirstOrDefault(m => m.Parameters.Length == 0 && m.Name == methodName));
215public IMethodSymbol GetGetAwaiterMethod(SemanticModel semanticModel, SyntaxNode node)
218public ImmutableArray<IMethodSymbol> GetDeconstructionAssignmentMethods(SemanticModel semanticModel, SyntaxNode node)
221public ImmutableArray<IMethodSymbol> GetDeconstructionForEachMethods(SemanticModel semanticModel, SyntaxNode node)
248public ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (12)
32IMethodSymbol method,
45IMethodSymbol method,
60IMethodSymbol method,
75IMethodSymbol method, CodeGenerationDestination destination,
93IMethodSymbol method,
112IMethodSymbol method, CodeGenerationDestination destination,
165IMethodSymbol method, CodeGenerationDestination destination,
220IMethodSymbol method, bool isExplicit, CSharpCodeGenerationContextInfo info)
236IMethodSymbol method)
243private static SyntaxList<TypeParameterConstraintClauseSyntax> GenerateDefaultConstraints(IMethodSymbol method)
317IMethodSymbol method, CSharpCodeGenerationContextInfo info)
323IMethodSymbol method, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info)
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)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (12)
32IMethodSymbol method,
45IMethodSymbol method,
60IMethodSymbol method,
75IMethodSymbol method, CodeGenerationDestination destination,
93IMethodSymbol method,
112IMethodSymbol method, CodeGenerationDestination destination,
165IMethodSymbol method, CodeGenerationDestination destination,
220IMethodSymbol method, bool isExplicit, CSharpCodeGenerationContextInfo info)
236IMethodSymbol method)
243private static SyntaxList<TypeParameterConstraintClauseSyntax> GenerateDefaultConstraints(IMethodSymbol method)
317IMethodSymbol method, CSharpCodeGenerationContextInfo info)
323IMethodSymbol method, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info)
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)
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);
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,
416var methodSymbol = (IMethodSymbol)parameter.ContainingSymbol;
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)
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;
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (5)
96protected abstract TExpression? GetGetterExpression(IMethodSymbol getMethod, CancellationToken cancellationToken);
97protected abstract TExpression? GetSetterExpression(SemanticModel semanticModel, IMethodSymbol setMethod, CancellationToken cancellationToken);
100SemanticModel semanticModel, IMethodSymbol accessor, HashSet<string> fieldNames, HashSet<IFieldSymbol> result, CancellationToken cancellationToken);
264IMethodSymbol getMethod,
282SemanticModel semanticModel, IMethodSymbol setMethod, HashSet<string> fieldNames, CancellationToken cancellationToken)
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\AbstractGenerateParameterizedMemberService.State.cs (1)
83.OfType<IMethodSymbol>();
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (5)
168IMethodSymbol method => GenerateMethod(compilation, method, throughMember, modifiers, accessibility),
176Compilation compilation, IMethodSymbol method, ISymbol? throughMember,
247private IMethodSymbol? GetEventAddOrRemoveMethod(
248IEventSymbol @event, IMethodSymbol? accessor, ISymbol? throughMember,
266private bool ShouldGenerateAccessor([NotNullWhen(true)] IMethodSymbol? method)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (8)
266if (member is not IMethodSymbol method)
305IMethodSymbol method => [GenerateMethod(compilation, method, conflictingMember as IMethodSymbol, accessibility, modifiers, generateAbstractly, useExplicitInterfaceSymbol, memberName)],
314var accessor = CodeGenerationSymbolFactory.CreateAccessorSymbol(
329private IMethodSymbol? GetAddOrRemoveMethod(
330IEventSymbol @event, bool generateInvisibly, IMethodSymbol accessor, string memberName,
366if (member is IMethodSymbol method1 && baseMember is IMethodSymbol method2)
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\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\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
FindSymbols\FindReferences\Finders\ConstructorSymbolReferenceFinder.cs (12)
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,
129IMethodSymbol methodSymbol, FindReferencesDocumentState state, Action<FinderLocation, TData> processResult, TData processResultData, string name, string alias, CancellationToken cancellationToken)
146IMethodSymbol symbol,
160IMethodSymbol symbol,
172IMethodSymbol symbol,
192IMethodSymbol symbol,
204IMethodSymbol symbol,
265IMethodSymbol symbol,
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\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\Utilities\AbstractSpeculationAnalyzer.cs (12)
114SemanticModel model, TForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType, out ImmutableArray<ILocalSymbol> localVariables);
378symbol = ((IMethodSymbol)symbol).GetConstructedReducedFrom()!;
383newSymbol = ((IMethodSymbol)newSymbol).GetConstructedReducedFrom()!;
403if (symbol is IMethodSymbol methodSymbol && newSymbol is IMethodSymbol newMethodSymbol)
477if (symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } methodSymbol &&
478newSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } newMethodSymbol)
780GetForEachSymbols(this.OriginalSemanticModel, forEachStatement, out var originalGetEnumerator, out var originalElementType, out var originalLocalVariables);
781GetForEachSymbols(this.SpeculativeSemanticModel, newForEachStatement, out var newGetEnumerator, out var newElementType, out var newLocalVariables);
808private bool ReplacementBreaksForEachGetEnumerator(IMethodSymbol getEnumerator, IMethodSymbol newGetEnumerator, TExpressionSyntax newForEachStatementExpression)
879((IMethodSymbol)symbol).MethodKind == MethodKind.DelegateInvoke;
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\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\CodeGenerationSymbolFactory.cs (28)
38IMethodSymbol? addMethod = null,
39IMethodSymbol? removeMethod = null,
40IMethodSymbol? raiseMethod = null)
57IMethodSymbol? getMethod,
58IMethodSymbol? setMethod,
85ImmutableArray<IParameterSymbol> parameters, IMethodSymbol? getMethod, IMethodSymbol? setMethod,
124public static IMethodSymbol CreateConstructorSymbol(
143public static IMethodSymbol CreateDestructorSymbol(
152internal static IMethodSymbol CreateMethodSymbol(
159ImmutableArray<IMethodSymbol> explicitInterfaceImplementations,
177public static IMethodSymbol CreateMethodSymbol(
181ImmutableArray<IMethodSymbol> explicitInterfaceImplementations,
196public static IMethodSymbol CreateOperatorSymbol(
224public static IMethodSymbol CreateConversionSymbol(
249public static IMethodSymbol CreateConversionSymbol(
361internal static IMethodSymbol CreateAccessorSymbol(
362IMethodSymbol accessor,
365ImmutableArray<IMethodSymbol> explicitInterfaceImplementations = default,
387public static IMethodSymbol CreateAccessorSymbol(
475var invokeMethod = CreateMethodSymbol(
515internal static IMethodSymbol CreateMethodSymbol(
516IMethodSymbol method,
520ImmutableArray<IMethodSymbol> explicitInterfaceImplementations = default,
554IMethodSymbol? getMethod = null,
555IMethodSymbol? setMethod = null,
580IMethodSymbol? addMethod = null,
581IMethodSymbol? removeMethod = null)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (12)
103protected static IMethodSymbol? FindDisposeMethod(Compilation compilation, ITypeSymbol? type, bool isAsync)
115if (impl is IMethodSymbol implMethod)
133.FirstOrDefault(m => m is IMethodSymbol { DeclaredAccessibility: Accessibility.Public, ReturnType: var returnType, Parameters.Length: 0 } &&
134SymbolEqualityComparer.Default.Equals(returnType, valueTaskType)) is IMethodSymbol disposeMethodFromPattern)
149.FirstOrDefault(m => m is IMethodSymbol { DeclaredAccessibility: Accessibility.Public, ReturnsVoid: true, Parameters.Length: 0 }) is IMethodSymbol disposeMethodFromPattern)
162(INamedTypeSymbol?, IMethodSymbol?) GetIDisposableInterfaceAndDisposeMethod(string typeName, string methodName)
165return (disposableType, disposableType?.GetMembers().OfType<IMethodSymbol>().FirstOrDefault(m => m.Parameters.Length == 0 && m.Name == methodName));
215public IMethodSymbol GetGetAwaiterMethod(SemanticModel semanticModel, SyntaxNode node)
218public ImmutableArray<IMethodSymbol> GetDeconstructionAssignmentMethods(SemanticModel semanticModel, SyntaxNode node)
221public ImmutableArray<IMethodSymbol> GetDeconstructionForEachMethods(SemanticModel semanticModel, SyntaxNode node)
248public ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken)