1476 references to MethodDeclarationSyntax
ILLink.RoslynAnalyzer (3)
TrimAnalysis\TrimDataFlowAnalysis.cs (3)
96 var method = op.Syntax.FirstAncestorOrSelf<MethodDeclarationSyntax> (); 97 if (method is MethodDeclarationSyntax)
Microsoft.Analyzers.Extra (2)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (2)
169foreach (var method in targetClass.Members.Where(m => m.IsKind(SyntaxKind.MethodDeclaration)).OfType<MethodDeclarationSyntax>())
Microsoft.AspNetCore.App.Analyzers (5)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (4)
190var methodSyntax = container.FirstAncestorOrSelf<MethodDeclarationSyntax>(); 293private static SyntaxToken? TryGetMvcActionRouteToken(CompletionContext context, SemanticModel semanticModel, MethodDeclarationSyntax method) 430MethodDeclarationSyntax methodDeclaration => methodDeclaration.ParameterList,
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (1)
113if (attributeParent is MethodDeclarationSyntax methodDeclarationSyntax)
Microsoft.AspNetCore.Mvc.Api.Analyzers (4)
AddResponseTypeAttributeCodeFixAction.cs (4)
132var methodSyntax = diagnosticNode.FirstAncestorOrSelf<MethodDeclarationSyntax>(); 258MethodDeclarationSyntax methodSyntax, 270public MethodDeclarationSyntax MethodSyntax { get; }
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (14)
HubClientProxyGenerator.cs (1)
35private static void Execute(Compilation compilation, ImmutableArray<MethodDeclarationSyntax> methodDeclarationSyntaxes, ImmutableArray<MemberAccessExpressionSyntax> memberAccessExpressionSyntaxes, SourceProductionContext context)
HubClientProxyGenerator.Parser.cs (6)
29Parent: MethodDeclarationSyntax 36internal static MethodDeclarationSyntax? GetSemanticTargetForAttribute(GeneratorSyntaxContext context) 47return (MethodDeclarationSyntax)attributeSyntax.Parent.Parent; 183internal SourceGenerationSpec Parse(ImmutableArray<MethodDeclarationSyntax> methodDeclarationSyntaxes, ImmutableArray<MemberAccessExpressionSyntax> syntaxList) 194foreach (var extraneous in methodDeclarationSyntaxes) 206var methodDeclarationSyntax = methodDeclarationSyntaxes[0];
HubServerProxyGenerator.cs (1)
35private static void Execute(Compilation compilation, ImmutableArray<MethodDeclarationSyntax> methodDeclarationSyntaxes, ImmutableArray<MemberAccessExpressionSyntax> memberAccessExpressionSyntaxes, SourceProductionContext context)
HubServerProxyGenerator.Parser.cs (6)
29Parent: MethodDeclarationSyntax 36internal static MethodDeclarationSyntax? GetSemanticTargetForAttribute(GeneratorSyntaxContext context) 47return (MethodDeclarationSyntax)attributeSyntax.Parent.Parent; 173internal SourceGenerationSpec Parse(ImmutableArray<MethodDeclarationSyntax> methodDeclarationSyntaxes, ImmutableArray<MemberAccessExpressionSyntax> syntaxList) 184foreach (var extraneous in methodDeclarationSyntaxes) 195var methodDeclarationSyntax = methodDeclarationSyntaxes[0];
Microsoft.CodeAnalysis.CSharp (45)
Binder\BinderFactory.BinderFactoryVisitor.cs (5)
135public override Binder VisitMethodDeclaration(MethodDeclarationSyntax methodDecl) 474MethodDeclarationSyntax methodDeclSyntax = (MethodDeclarationSyntax)baseMethodDeclarationSyntax; 1333MethodDeclarationSyntax methodDeclSyntax = (MethodDeclarationSyntax)memberSyntax;
Binder\LocalBinderFactory.cs (1)
148public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
Compilation\CSharpSemanticModel.cs (2)
461var methodDecl = node.FirstAncestorOrSelf<MethodDeclarationSyntax>();
Compilation\SyntaxTreeSemanticModel.cs (2)
1628var methodDecl = (MethodDeclarationSyntax)declaration;
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (2)
598MethodDeclarationSyntax methodSyntax = (MethodDeclarationSyntax)syntax;
Parser\LanguageParser.cs (2)
3465private MethodDeclarationSyntax ParseMethodDeclaration( 5122return ((CSharp.Syntax.MethodDeclarationSyntax)decl).Modifiers;
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (2)
295if (node is MethodDeclarationSyntax methodDecl && methodDecl.TypeParameterList != null) 389arrowExpr = ((MethodDeclarationSyntax)node).ExpressionBody;
Symbols\MethodSymbolExtensions.cs (1)
203if (node is MethodDeclarationSyntax methodDeclaration)
Symbols\Source\ModifierUtils.cs (1)
29if (readonlyToken.Parent is MethodDeclarationSyntax or AccessorDeclarationSyntax or BasePropertyDeclarationSyntax or EventDeclarationSyntax)
Symbols\Source\SourceMemberContainerSymbol.cs (2)
4978var methodSyntax = (MethodDeclarationSyntax)m;
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
1534MethodDeclarationSyntax { ReturnType: var methodReturnType } => methodReturnType,
Symbols\Source\SourceOrdinaryMethodSymbol.cs (16)
25MethodDeclarationSyntax syntax, 51MethodDeclarationSyntax syntax, 90NamedTypeSymbol containingType, Location location, MethodDeclarationSyntax syntax, MethodKind methodKind, 115var syntax = GetSyntax(); 207var syntax = GetSyntax(); 268internal MethodDeclarationSyntax GetSyntax() 271return (MethodDeclarationSyntax)syntaxReferenceOpt.GetSyntax(); 424private static DeclarationModifiers MakeDeclarationModifiers(MethodDeclarationSyntax syntax, NamedTypeSymbol containingType, Location location, DeclarationModifiers allowedModifiers, BindingDiagnosticBag diagnostics) 687private static (DeclarationModifiers mods, bool hasExplicitAccessMod) MakeModifiers(MethodDeclarationSyntax syntax, NamedTypeSymbol containingType, MethodKind methodKind, bool hasBody, Location location, BindingDiagnosticBag diagnostics) 921MethodDeclarationSyntax syntax, 979MethodDeclarationSyntax syntax, 1015var syntax = GetSyntax(); 1035var syntax = GetSyntax(); 1062var syntax = GetSyntax(); 1085var syntax = this.GetSyntax(); 1091private ImmutableArray<TypeParameterSymbol> MakeTypeParameters(MethodDeclarationSyntax syntax, BindingDiagnosticBag diagnostics)
Symbols\VarianceSafety.cs (2)
142var syntax = m.GetDeclaringSyntax<MethodDeclarationSyntax>();
Syntax\LookupPosition.cs (1)
198internal static bool IsInMethodTypeParameterScope(int position, MethodDeclarationSyntax methodDecl)
Syntax\MethodDeclarationSyntax.cs (1)
27public static MethodDeclarationSyntax MethodDeclaration(
Syntax\SyntaxExtensions.cs (2)
311public static MethodDeclarationSyntax Update( 312this MethodDeclarationSyntax syntax,
Syntax\SyntaxFacts.cs (1)
167return ((MethodDeclarationSyntax)parent).ReturnType == node;
Syntax\SyntaxNodeExtensions.cs (1)
268(current.Parent is MethodDeclarationSyntax method && method.ReturnType == current) ||
Microsoft.CodeAnalysis.CSharp.CodeStyle (31)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (4)
30public static Location GetUseTopLevelStatementsDiagnosticLocation(MethodDeclarationSyntax methodDeclaration, bool isHidden) 46MethodDeclarationSyntax methodDeclaration, 138if (member is not FieldDeclarationSyntax and not MethodDeclarationSyntax) 142if (member is MethodDeclarationSyntax { Body: null, ExpressionBody: null })
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (2)
66var methodDeclarations = root.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax or ClassDeclarationSyntax).OfType<MethodDeclarationSyntax>(); 67foreach (var methodDeclaration in methodDeclarations)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
200MethodDeclarationSyntax methodDeclaration => methodDeclaration.Identifier,
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (11)
18UseExpressionBodyHelper<MethodDeclarationSyntax> 35protected override BlockSyntax GetBody(MethodDeclarationSyntax declaration) 38protected override ArrowExpressionClauseSyntax GetExpressionBody(MethodDeclarationSyntax declaration) 41protected override SyntaxToken GetSemicolonToken(MethodDeclarationSyntax declaration) 44protected override MethodDeclarationSyntax WithSemicolonToken(MethodDeclarationSyntax declaration, SyntaxToken token) 47protected override MethodDeclarationSyntax WithExpressionBody(MethodDeclarationSyntax declaration, ArrowExpressionClauseSyntax expressionBody) 50protected override MethodDeclarationSyntax WithBody(MethodDeclarationSyntax declaration, BlockSyntax body) 54SemanticModel semanticModel, MethodDeclarationSyntax declaration)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
106MethodDeclarationSyntax method => method.ReturnType,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (1)
35case MethodDeclarationSyntax methodDeclaration:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (5)
52return ((MethodDeclarationSyntax)member).Identifier; 83return ((MethodDeclarationSyntax)member).Arity; 105return ((MethodDeclarationSyntax)member).TypeParameterList; 123return ((MethodDeclarationSyntax)member).WithParameterList((ParameterListSyntax)parameterList); 147return ((MethodDeclarationSyntax)member).ReturnType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
280=> node is MethodDeclarationSyntax or AnonymousFunctionExpressionSyntax or LocalFunctionStatementSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (2)
70var method = (MethodDeclarationSyntax)declaration;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpHeaderFacts.cs (1)
66var node = TryGetAncestorForLocation<MethodDeclarationSyntax>(root, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
1545=> node is MethodDeclarationSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
124MethodDeclarationSyntax or
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (46)
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (4)
60private static async Task<MethodDeclarationSyntax?> GetMethodDeclarationAsync( 82if ((await methodReference.GetSyntaxAsync(cancellationToken).ConfigureAwait(false)) is not MethodDeclarationSyntax methodDeclaration) 95private static MethodDeclarationSyntax ConvertToAsyncFunction(MethodDeclarationSyntax methodDeclaration)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (2)
219foreach (var method in typeDeclaration.Members.OfType<MethodDeclarationSyntax>())
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
145MethodDeclarationSyntax method => (method.ReturnType, method.Modifiers.Any(SyntaxKind.AsyncKeyword)),
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (3)
30=> node is MethodDeclarationSyntax; 55var methodDeclaration = (MethodDeclarationSyntax)node;
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
38token.GetAncestor<MethodDeclarationSyntax>() ??
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (2)
75var newMethodDeclarationSyntax = (node as MethodDeclarationSyntax)?.WithReturnType(newReturnType);
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (3)
79MethodDeclarationSyntax method => FixMethod(keepVoid, methodSymbol, method, knownTypes, cancellationToken), 86private static MethodDeclarationSyntax FixMethod( 89MethodDeclarationSyntax method,
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (2)
36case MethodDeclarationSyntax method: return FixMethod(methodSymbol, method, knownTypes); 44private static SyntaxNode FixMethod(IMethodSymbol methodSymbol, MethodDeclarationSyntax method, KnownTaskTypes knownTypes)
src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
47if (declaration is MethodDeclarationSyntax or BasePropertyDeclarationSyntax)
src\Analyzers\CSharp\CodeFixes\MakeTypeAbstract\CSharpMakeTypeAbstractCodeFixProvider.cs (1)
26case MethodDeclarationSyntax method:
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (2)
140MethodDeclarationSyntax method => 262node.Parent?.Parent is MethodDeclarationSyntax arrowMethod)
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\CSharpRemoveAsyncModifierCodeFixProvider.cs (2)
41MethodDeclarationSyntax method => method.WithBody(block).WithExpressionBody(null).WithSemicolonToken(default), 54MethodDeclarationSyntax method => RemoveAsyncModifierHelpers.WithoutAsyncModifier(method, method.ReturnType),
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (1)
12internal static SyntaxNode WithoutAsyncModifier(MethodDeclarationSyntax method, TypeSyntax returnType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
155=> members.FirstOrDefault(m => m is MethodDeclarationSyntax); 164=> members.LastOrDefault(m => m is MethodDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
796var methodDeclarationSyntax = (MethodDeclarationSyntax)syntaxNode;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (4)
118return Compare((MethodDeclarationSyntax)x, (MethodDeclarationSyntax)y); 199private int Compare(MethodDeclarationSyntax x, MethodDeclarationSyntax y)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (11)
37var declaration = GenerateMethodDeclaration(method, CodeGenerationDestination.Namespace, info, cancellationToken); 50var declaration = GenerateMethodDeclaration( 65var methodDeclaration = GenerateMethodDeclaration( 74public static MethodDeclarationSyntax GenerateMethodDeclaration( 79var reusableSyntax = GetReuseableSyntaxNodeForSymbol<MethodDeclarationSyntax>(method, info); 85var declaration = GenerateMethodDeclarationWorker( 111private static MethodDeclarationSyntax GenerateMethodDeclarationWorker( 126var methodDeclaration = MethodDeclaration( 183private static MethodDeclarationSyntax UseExpressionBodyIfDesired( 184CSharpCodeGenerationContextInfo info, MethodDeclarationSyntax methodDeclaration, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
1130MethodDeclarationSyntax or LocalFunctionStatementSyntax or ConstructorDeclarationSyntax or DelegateDeclarationSyntax or TypeDeclarationSyntax => true, 1213var method = tokenOnLeftOfPosition.Parent.GetAncestorOrThis<MethodDeclarationSyntax>();
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
CompleteStatement\CompleteStatementCommandHandler.cs (1)
291if (currentNode is MethodDeclarationSyntax method)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (21)
RefactoringHelpers\RefactoringHelpersTests.cs (19)
714await TestMissingAsync<MethodDeclarationSyntax>(testText); 727await TestAsync<MethodDeclarationSyntax>(testText); 740await TestAsync<MethodDeclarationSyntax>(testText); 771await TestMissingAsync<MethodDeclarationSyntax>(testText); 785await TestAsync<MethodDeclarationSyntax>(testText); 804await TestAsync<MethodDeclarationSyntax>(testText); 822await TestAsync<MethodDeclarationSyntax>(testText); 842await TestAsync<MethodDeclarationSyntax>(testText); 864await TestAsync<MethodDeclarationSyntax>(testText); 884await TestMissingAsync<MethodDeclarationSyntax>(testText); 902await TestMissingAsync<MethodDeclarationSyntax>(testText); 922await TestMissingAsync<MethodDeclarationSyntax>(testText); 940await TestMissingAsync<MethodDeclarationSyntax>(testText); 962await TestAsync<MethodDeclarationSyntax>(testText); 984await TestAsync<MethodDeclarationSyntax>(testText); 1537await TestMissingAsync<MethodDeclarationSyntax>(testText); 1551await TestAsync<MethodDeclarationSyntax>(testText); 1565await TestAsync<MethodDeclarationSyntax>(testText); 1579await TestAsync<MethodDeclarationSyntax>(testText);
Structure\MetadataAsSource\MethodDeclarationStructureTests.cs (1)
14public class MethodDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<MethodDeclarationSyntax>
Structure\MethodDeclarationStructureTests.cs (1)
16public class MethodDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<MethodDeclarationSyntax>
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (3)
CodeGen\CodeGenOperators.cs (3)
5409ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single())); 5699ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single())); 5735ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single()));
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
Emit\NumericIntPtrTests.cs (2)
10686var methods = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 10688foreach (var method in methods)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (218)
Attributes\AttributeTests.cs (1)
710var m0 = semanticModel.GetDeclaredSymbol(root.DescendantNodes().OfType<MethodDeclarationSyntax>().Last());
Attributes\AttributeTests_RefReadOnly.cs (8)
1379var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1421var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1450var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1477var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User");
Diagnostics\GetDiagnosticsTests.cs (1)
1028MethodDeclarationSyntax methodDecl => methodDecl.Identifier.GetLocation(),
RefStructInterfacesTests.cs (118)
6629var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 6766var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 6882var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7014var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 7143var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 7473var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7663var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7882var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 8076var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8269var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8442var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8548var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8932var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9136var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9332var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9500var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9715var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 9936var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10151var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10348var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10443var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10543var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 10740var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 10980var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 11199var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 11423var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 12149var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 12417var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 12662var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 12925var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 13192var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 13454var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 14152var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 14493var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 14855var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 15206var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15554var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15733var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15988var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 16759var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16824var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16889var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16973var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17061var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17154var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17251var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17335var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17656var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17853var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 18076var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 18276var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18477var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18653var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18761var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 19129var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19300var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19473var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19625var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19967var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single();
Semantics\CollectionExpressionTests.cs (41)
7534var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8257var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8328var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8412var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8497var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26013var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26139var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26253var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26311var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26382var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26464var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26530var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26591var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26661var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26836var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26901var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "CreateCollection"); 26957var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 27274var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 27352var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 27439var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 27523var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 27616var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 27701var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 27769var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create");
Semantics\OutVarTests.cs (18)
1287MethodDeclarationSyntax methodDeclParent; 1290((methodDeclParent = containingReturnOrThrow.Parent.Parent as MethodDeclarationSyntax) == null || 34329var method = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2); 34543var method = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2); 36363var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36409var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36449var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36491var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36526var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36564var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Semantics\ParamsCollectionTests.cs (10)
3596var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 3886var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 14555VerifyFlowGraphForTest<MethodDeclarationSyntax>(comp, """ 14585VerifyOperationTreeForTest<MethodDeclarationSyntax>(comp, """ 14646VerifyFlowGraphForTest<MethodDeclarationSyntax>(comp, """ 14676VerifyOperationTreeForTest<MethodDeclarationSyntax>(comp, """ 14763VerifyFlowGraphForTest<MethodDeclarationSyntax>(comp, """ 14803VerifyOperationTreeForTest<MethodDeclarationSyntax>(comp, """
Semantics\PrimaryConstructorTests.cs (8)
4863case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 5008case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 5076case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 5860case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 5952case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 6010case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 6861var mDefinition = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Semantics\RecordTests.cs (13)
1816var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 8130var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 8630var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 8735var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 27370case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 27515case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 27583case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 30442var mDefinition = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (2)
EndToEndTests.cs (2)
493var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Features (129)
AddDebuggerDisplay\CSharpAddDebuggerDisplayCodeRefactoringProvider.cs (1)
20: AbstractAddDebuggerDisplayCodeRefactoringProvider<TypeDeclarationSyntax, MethodDeclarationSyntax>
ChangeSignature\CSharpChangeSignatureService.cs (1)
320if (updatedNode is MethodDeclarationSyntax method)
CodeLens\CSharpCodeLensMemberFinder.cs (1)
66public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
CodeRefactorings\AddAwait\CSharpAddAwaitCodeRefactoringProvider.cs (1)
38case MethodDeclarationSyntax methodDeclaration:
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (3)
130var method = MethodGenerator.GenerateMethodDeclaration(methodSymbol, CodeGenerationDestination.Unspecified, info, cancellationToken); 274private static MethodDeclarationSyntax WithBodyFrom( 275MethodDeclarationSyntax method, LocalFunctionStatementSyntax localFunction)
Completion\CompletionProviders\AwaitCompletionProvider.cs (2)
44MethodDeclarationSyntax method => method.ReturnType.SpanStart, 60MethodDeclarationSyntax method => method.ReturnType,
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
207result = IsLastTokenOfType<MethodDeclarationSyntax>(
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (1)
321MethodDeclarationSyntax method => [.. namedType.GetMembers(method.Identifier.ValueText).OfType<IMethodSymbol>()],
Completion\CompletionProviders\OverrideCompletionProvider.cs (1)
35?? (SyntaxNode?)token.GetAncestor<MethodDeclarationSyntax>()
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (6)
38var declaration = (MethodDeclarationSyntax)method.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 60?? (SyntaxNode?)token.GetAncestor<MethodDeclarationSyntax>() 66var methodDeclaration = (MethodDeclarationSyntax)caretTarget; 84var declarations = method.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<MethodDeclarationSyntax>();
Completion\KeywordRecommenders\TypeVarKeywordRecommender.cs (1)
40var method = typeParameters.GetAncestorOrThis<MethodDeclarationSyntax>();
Completion\KeywordRecommenders\WhereKeywordRecommender.cs (1)
74if (tokenParent.IsParentKind<MethodDeclarationSyntax>(SyntaxKind.MethodDeclaration, out var methodDeclaration))
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (3)
87var method = (MethodDeclarationSyntax)generator.MethodDeclaration( 91method = (MethodDeclarationSyntax)generator.WithAccessibility(
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (4)
30Document document, MethodDeclarationSyntax methodDeclaration, CancellationToken cancellationToken) 102MethodDeclarationSyntax methodDeclaration, 156MethodDeclarationSyntax methodDeclaration, 193else if (member is MethodDeclarationSyntax otherMethod)
ConvertProgram\ConvertToTopLevelStatementsCodeFixProvider.cs (2)
51var methodDeclaration = (MethodDeclarationSyntax)diagnostics[0].AdditionalLocations[0].FindNode(cancellationToken);
ConvertProgram\ConvertToTopLevelStatementsCodeRefactoringProvider.cs (1)
42var methodDeclaration = await context.TryGetRelevantNodeAsync<MethodDeclarationSyntax>().ConfigureAwait(false);
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (2)
1682var methodDeclaration = (MethodDeclarationSyntax)node;
EditAndContinue\SyntaxComparer.cs (1)
1447return ((MethodDeclarationSyntax)node).Identifier;
EditAndContinue\SyntaxUtilities.cs (2)
24MethodDeclarationSyntax methodDeclaration => CreateSimpleBody(BlockOrExpression(methodDeclaration.Body, methodDeclaration.ExpressionBody)), 223MethodDeclarationSyntax method => method.Modifiers.Any(SyntaxKind.AsyncKeyword),
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (5)
1013MethodDeclarationSyntax method => TweakNewLinesInMethod(method), 1024private static MethodDeclarationSyntax TweakNewLinesInMethod(MethodDeclarationSyntax method) 1062var nodeIsMethodOrLocalFunction = syntaxNode is MethodDeclarationSyntax or LocalFunctionStatementSyntax; 1070var returnType = syntaxNode is MethodDeclarationSyntax method ? method.ReturnType : ((LocalFunctionStatementSyntax)syntaxNode).ReturnType;
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (3)
27var isMethodOrLocalFunction = method is MethodDeclarationSyntax or LocalFunctionStatementSyntax; 38var isMethodOrLocalFunction = method is MethodDeclarationSyntax or LocalFunctionStatementSyntax; 127MethodDeclarationSyntax methodDeclaration => (methodDeclaration.Body, methodDeclaration.ExpressionBody, methodDeclaration.SemicolonToken),
ExtractMethod\CSharpSelectionResult.StatementResult.cs (1)
32MethodDeclarationSyntax method => method.Modifiers.Any(SyntaxKind.AsyncKeyword),
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (1)
72MethodDeclarationSyntax methodDeclaration => TryAddAsyncModifier(methodDeclaration.Modifiers, spans),
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
160MethodDeclarationSyntax member => (member, member.ExplicitInterfaceSpecifier, member.Identifier),
ImplementInterface\CSharpImplementImplicitlyCodeRefactoringProvider.cs (1)
54MethodDeclarationSyntax member => member.WithExplicitInterfaceSpecifier(null),
InheritanceMargin\CSharpInheritanceMarginService.cs (1)
68MethodDeclarationSyntax methodDeclarationNode => methodDeclarationNode.Identifier,
LineSeparators\CSharpLineSeparatorService.cs (1)
129if (node is MethodDeclarationSyntax methodDecl)
Organizing\Organizers\MethodDeclarationOrganizer.cs (3)
17internal class MethodDeclarationOrganizer : AbstractSyntaxNodeOrganizer<MethodDeclarationSyntax> 25protected override MethodDeclarationSyntax Organize( 26MethodDeclarationSyntax syntax,
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (9)
28internal class CSharpReplaceMethodWithPropertyService : AbstractReplaceMethodWithPropertyService<MethodDeclarationSyntax>, IReplaceMethodWithPropertyService 48if (getAndSetMethods.GetMethodDeclaration is not MethodDeclarationSyntax getMethodDeclaration) 120var getMethodDeclaration = (MethodDeclarationSyntax)getAndSetMethods.GetMethodDeclaration; 121var setMethodDeclaration = getAndSetMethods.SetMethodDeclaration as MethodDeclarationSyntax; 211var getMethodDeclaration = getAndSetMethods.GetMethodDeclaration as MethodDeclarationSyntax; 246if (getAndSetMethods.SetMethodDeclaration is not MethodDeclarationSyntax setMethodDeclaration || setMethod?.Parameters.Length != 1)
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (12)
114var methodDeclaration = GetSetMethodWorker(); 123MethodDeclarationSyntax GetSetMethodWorker() 126var methodDeclaration = (MethodDeclarationSyntax)generator.MethodDeclaration(setMethod, desiredSetMethodName); 171var methodDeclaration = GetGetMethodWorker(); 179MethodDeclarationSyntax GetGetMethodWorker() 181var methodDeclaration = (MethodDeclarationSyntax)generator.MethodDeclaration(getMethod, desiredGetMethodName); 226private static MethodDeclarationSyntax CopyLeadingTrivia( 228MethodDeclarationSyntax methodDeclaration, 250private static MethodDeclarationSyntax UseExpressionOrBlockBodyIfDesired( 252MethodDeclarationSyntax methodDeclaration,
Snippets\AbstractCSharpMainMethodSnippetProvider.cs (1)
16: AbstractMainMethodSnippetProvider<MethodDeclarationSyntax, StatementSyntax, TypeSyntax>
Snippets\CSharpIntMainSnippetProvider.cs (2)
39protected override int GetTargetCaretPosition(MethodDeclarationSyntax methodDeclaration, SourceText sourceText) 50protected override async Task<Document> AddIndentationToDocumentAsync(Document document, MethodDeclarationSyntax methodDeclaration, CancellationToken cancellationToken)
Snippets\CSharpVoidMainSnippetProvider.cs (2)
36protected override int GetTargetCaretPosition(MethodDeclarationSyntax methodDeclaration, SourceText sourceText) 42protected override Task<Document> AddIndentationToDocumentAsync(Document document, MethodDeclarationSyntax methodDeclaration, CancellationToken cancellationToken)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (4)
30public static Location GetUseTopLevelStatementsDiagnosticLocation(MethodDeclarationSyntax methodDeclaration, bool isHidden) 46MethodDeclarationSyntax methodDeclaration, 138if (member is not FieldDeclarationSyntax and not MethodDeclarationSyntax) 142if (member is MethodDeclarationSyntax { Body: null, ExpressionBody: null })
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (2)
66var methodDeclarations = root.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax or ClassDeclarationSyntax).OfType<MethodDeclarationSyntax>(); 67foreach (var methodDeclaration in methodDeclarations)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
200MethodDeclarationSyntax methodDeclaration => methodDeclaration.Identifier,
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (11)
18UseExpressionBodyHelper<MethodDeclarationSyntax> 35protected override BlockSyntax GetBody(MethodDeclarationSyntax declaration) 38protected override ArrowExpressionClauseSyntax GetExpressionBody(MethodDeclarationSyntax declaration) 41protected override SyntaxToken GetSemicolonToken(MethodDeclarationSyntax declaration) 44protected override MethodDeclarationSyntax WithSemicolonToken(MethodDeclarationSyntax declaration, SyntaxToken token) 47protected override MethodDeclarationSyntax WithExpressionBody(MethodDeclarationSyntax declaration, ArrowExpressionClauseSyntax expressionBody) 50protected override MethodDeclarationSyntax WithBody(MethodDeclarationSyntax declaration, BlockSyntax body) 54SemanticModel semanticModel, MethodDeclarationSyntax declaration)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
106MethodDeclarationSyntax method => method.ReturnType,
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (4)
60private static async Task<MethodDeclarationSyntax?> GetMethodDeclarationAsync( 82if ((await methodReference.GetSyntaxAsync(cancellationToken).ConfigureAwait(false)) is not MethodDeclarationSyntax methodDeclaration) 95private static MethodDeclarationSyntax ConvertToAsyncFunction(MethodDeclarationSyntax methodDeclaration)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (2)
219foreach (var method in typeDeclaration.Members.OfType<MethodDeclarationSyntax>())
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
145MethodDeclarationSyntax method => (method.ReturnType, method.Modifiers.Any(SyntaxKind.AsyncKeyword)),
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (3)
30=> node is MethodDeclarationSyntax; 55var methodDeclaration = (MethodDeclarationSyntax)node;
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
38token.GetAncestor<MethodDeclarationSyntax>() ??
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
75var newMethodDeclarationSyntax = (node as MethodDeclarationSyntax)?.WithReturnType(newReturnType);
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (3)
79MethodDeclarationSyntax method => FixMethod(keepVoid, methodSymbol, method, knownTypes, cancellationToken), 86private static MethodDeclarationSyntax FixMethod( 89MethodDeclarationSyntax method,
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (2)
36case MethodDeclarationSyntax method: return FixMethod(methodSymbol, method, knownTypes); 44private static SyntaxNode FixMethod(IMethodSymbol methodSymbol, MethodDeclarationSyntax method, KnownTaskTypes knownTypes)
src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
47if (declaration is MethodDeclarationSyntax or BasePropertyDeclarationSyntax)
src\Analyzers\CSharp\CodeFixes\MakeTypeAbstract\CSharpMakeTypeAbstractCodeFixProvider.cs (1)
26case MethodDeclarationSyntax method:
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (2)
140MethodDeclarationSyntax method => 262node.Parent?.Parent is MethodDeclarationSyntax arrowMethod)
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\CSharpRemoveAsyncModifierCodeFixProvider.cs (2)
41MethodDeclarationSyntax method => method.WithBody(block).WithExpressionBody(null).WithSemicolonToken(default), 54MethodDeclarationSyntax method => RemoveAsyncModifierHelpers.WithoutAsyncModifier(method, method.ReturnType),
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (1)
12internal static SyntaxNode WithoutAsyncModifier(MethodDeclarationSyntax method, TypeSyntax returnType)
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (2)
295if (node is MethodDeclarationSyntax methodDecl && methodDecl.TypeParameterList != null) 389arrowExpr = ((MethodDeclarationSyntax)node).ExpressionBody;
Structure\CSharpBlockStructureProvider.cs (1)
41builder.Add<MethodDeclarationSyntax, MethodDeclarationStructureProvider>();
Structure\CSharpStructureHelpers.cs (1)
280MethodDeclarationSyntax methodDeclaration => methodDeclaration.Modifiers.FirstOrNull() ?? methodDeclaration.ReturnType.GetFirstToken(),
Structure\Providers\MethodDeclarationStructureProvider.cs (2)
12internal class MethodDeclarationStructureProvider : AbstractSyntaxNodeStructureProvider<MethodDeclarationSyntax> 16MethodDeclarationSyntax methodDeclaration,
Testing\CSharpTestMethodFinder.cs (2)
19internal class CSharpTestMethodFinder([ImportMany] IEnumerable<ITestFrameworkMetadata> testFrameworks) : AbstractTestMethodFinder<MethodDeclarationSyntax>(testFrameworks) 27protected override bool IsTestMethod(MethodDeclarationSyntax method)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (30)
Diagnostics\Suppression\SuppressionTests.cs (4)
1085var method = (MethodDeclarationSyntax)context.Node; 2079var method = (MethodDeclarationSyntax)context.Node;
EditAndContinue\ActiveStatementTests.cs (1)
12557if (node.Parent is MethodDeclarationSyntax methodDecl && methodDecl.Identifier.Text == "G")
EditAndContinue\BreakpointSpansTests.cs (8)
111VerifyAllSpansInDeclaration<MethodDeclarationSyntax>(@" 145VerifyAllSpansInDeclaration<MethodDeclarationSyntax>(@" 171VerifyAllSpansInDeclaration<MethodDeclarationSyntax>(@" 200VerifyAllSpansInDeclaration<MethodDeclarationSyntax>(@" 224VerifyAllSpansInDeclaration<MethodDeclarationSyntax>(@" 235VerifyAllSpansInDeclaration<MethodDeclarationSyntax>(@" 272VerifyAllSpansInDeclaration<MethodDeclarationSyntax>(@" 284VerifyAllSpansInDeclaration<MethodDeclarationSyntax>(@"
EditAndContinue\Helpers\EditingTestBase.cs (4)
242var oldDeclaration = (MethodDeclarationSyntax)((ClassDeclarationSyntax)((CompilationUnitSyntax)edits.Match.OldRoot).Members[0]).Members[0]; 246var newDeclaration = (MethodDeclarationSyntax)((ClassDeclarationSyntax)((CompilationUnitSyntax)edits.Match.NewRoot).Members[0]).Members[0];
EditAndContinue\SyntaxUtilitiesTests.cs (12)
184var m0 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M0"); 185var m1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M1"); 186var m2 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M2"); 187var m3 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M3"); 253var m1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M1"); 254var m2 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M2");
Testing\CSharpTestMethodFinderTests.cs (1)
559var testMethodNames = testMethods.Cast<MethodDeclarationSyntax>().Select(m => m.Identifier.Text).ToArray();
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (54)
IOperation\IOperationTests.cs (4)
589var methodDeclSyntax = literal.Ancestors().OfType<MethodDeclarationSyntax>().Single(); 617var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0];
IOperation\IOperationTests_IAnonymousFunctionExpression.cs (2)
847var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 902var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()));
IOperation\IOperationTests_ICoalesceAssignmentOperation.cs (2)
253var m = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
IOperation\IOperationTests_IDynamicObjectCreationExpression.cs (3)
421VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 540VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 665VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics);
IOperation\IOperationTests_IFieldReferenceExpression.cs (2)
711var methodDecl = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
IOperation\IOperationTests_ILocalFunctionStatement.cs (2)
1793var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First())); 1848var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First()));
IOperation\IOperationTests_INoPiaObjectCreationOperation.cs (4)
272VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(consumer, expectedFlowGraph, expectedDiagnostics, references: new[] { piaCompilation.EmitToImageReference(embedInteropTypes: true) }); 363VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(consumer, expectedFlowGraph, expectedDiagnostics, references: new[] { piaCompilation.EmitToImageReference(embedInteropTypes: true) }); 429VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(consumer, expectedFlowGraph, expectedDiagnostics, references: new[] { piaCompilation.EmitToImageReference(embedInteropTypes: true) }); 573VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(consumer, expectedFlowGraph, expectedDiagnostics, references: new[] { piaCompilation.EmitToImageReference(embedInteropTypes: true) });
IOperation\IOperationTests_IObjectCreationExpression.cs (31)
782var m1 = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1069var main = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1295var m1 = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1574var main = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2276var m = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2400var m = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M"); 11672VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 11838VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 12082VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 12388VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 12685VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 12995VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 13269VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 13355VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 13480VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 13649VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics, useLatestFrameworkReferences: true); 13825VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics, useLatestFrameworkReferences: true); 13901VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 13974VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 14110VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 14235VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 14309VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 14456VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 14581VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 14666VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics);
IOperation\IOperationTests_ITypeParameterObjectCreationTests.cs (4)
274VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 390VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 468VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics); 549VerifyFlowGraphAndDiagnosticsForTest<MethodDeclarationSyntax>(source, expectedFlowGraph, expectedDiagnostics);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (88)
Semantics\ArglistTests.cs (2)
961var meth = clss.Members[0] as MethodDeclarationSyntax;
Semantics\ConditionalOperatorTests.cs (2)
1290var methodTest = (MethodDeclarationSyntax)classC.Members.First();
Semantics\ExpressionBodiedMemberTests.cs (2)
41var node = tree.GetRoot() 43.OfType<MethodDeclarationSyntax>()
Semantics\FunctionPointerTests.cs (3)
3678.OfType<MethodDeclarationSyntax>() 3816.OfType<MethodDeclarationSyntax>() 3950.OfType<MethodDeclarationSyntax>()
Semantics\LambdaTests.cs (9)
3986var m = newTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 7646var methodSyntax = (MethodDeclarationSyntax)method.DeclaringSyntaxReferences.Single().GetSyntax(); 8083var m2Syntax = (MethodDeclarationSyntax)m2.DeclaringSyntaxReferences.Single().GetSyntax(); 8085var newMethod = m2Syntax.WithBody(SyntaxFactory.Block(newStmt)); 8163var methodSyntax = (MethodDeclarationSyntax)comp.GetMember<MethodSymbol>("C.M").GetNonNullSyntaxNode();
Semantics\LocalFunctionTests.cs (8)
348var m = newTree.GetRoot() 349.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 404var m = newTree.GetRoot() 405.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 444var mMethod = (MethodDeclarationSyntax)newTree.FindNodeOrTokenByKind(SyntaxKind.MethodDeclaration, occurrence: 1).AsNode(); 8739var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Semantics\NativeIntegerTests.cs (1)
3639var method = model.GetDeclaredSymbol(nodes.OfType<MethodDeclarationSyntax>().Single());
Semantics\NullableContextTests.cs (4)
68var methodDeclPosition = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().SpanStart; 581verifyContextState(tree, syntaxNodes.OfType<MethodDeclarationSyntax>().Single(), expectedWarningsStateForMethod, expectedAnnotationsStateForMethod); 731var methodDeclarations = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 732foreach (var methodDeclaration in methodDeclarations)
Semantics\NullableReferenceTypesTests.cs (1)
157629var method1 = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single());
Semantics\ObjectAndCollectionInitializerTests.cs (4)
4058var node1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 4136var node1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Semantics\OperatorTests.cs (3)
7330var methodBody = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body; 8812var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Semantics\QueryTests.cs (16)
1454dynamic methodM = (MethodDeclarationSyntax)classC.Members[0]; 1663dynamic methodM = (MethodDeclarationSyntax)classC.Members[0]; 1723dynamic methodM = (MethodDeclarationSyntax)classC.Members[0]; 1761dynamic methodM = (MethodDeclarationSyntax)classC.Members[0]; 2898dynamic main = (MethodDeclarationSyntax)classC.Members[0]; 2931dynamic main = (MethodDeclarationSyntax)classC.Members[0]; 3421var methodM = (MethodDeclarationSyntax)classC.Members[0]; 3465var methodM = (MethodDeclarationSyntax)classC.Members[0]; 3512var methodM = (MethodDeclarationSyntax)classC.Members[0]; 3551var methodM = (MethodDeclarationSyntax)classC.Members[0]; 3599var methodM = (MethodDeclarationSyntax)classC.Members[0];
Semantics\ReadOnlyStructsTests.cs (2)
1265var testMethodSyntax = (MethodDeclarationSyntax)c.DeclaringSyntaxReferences.Single().GetSyntax();
Semantics\RecordStructTests.cs (9)
554var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 574var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 596var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 6585case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 6677case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }: 6735case MethodDeclarationSyntax { Identifier: { ValueText: "M" } }:
Semantics\SemanticErrorTests.cs (2)
3328var mainMethod = (MethodDeclarationSyntax)classError.Members[1];
Semantics\TargetTypedConditionalOperatorTests.cs (2)
338var methodTest = (MethodDeclarationSyntax)classC.Members.First();
Semantics\UnsafeTests.cs (2)
5197var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
SourceGeneration\GeneratorDriverTests_Attributes_FullyQualifiedName.cs (14)
463var input = ctx.ForAttributeWithMetadataName<MethodDeclarationSyntax>("System.CLSCompliantAttribute"); 472step => Assert.True(step.Outputs.Single().Value is MethodDeclarationSyntax { Identifier.ValueText: "M" })); 496var input = ctx.ForAttributeWithMetadataName<MethodDeclarationSyntax>("System.CLSCompliantAttribute"); 505step => Assert.True(step.Outputs.Single().Value is MethodDeclarationSyntax { Identifier.ValueText: "M" })); 528var input = ctx.ForAttributeWithMetadataName<MethodDeclarationSyntax>("System.CLSCompliantAttribute"); 537step => Assert.True(step.Outputs.Single().Value is MethodDeclarationSyntax { Identifier.ValueText: "M", Body: null, ExpressionBody: null })); 560var input = ctx.ForAttributeWithMetadataName<MethodDeclarationSyntax>("System.CLSCompliantAttribute"); 569step => Assert.True(step.Outputs.Single().Value is MethodDeclarationSyntax { Identifier.ValueText: "M", Body: not null })); 1336var input = ctx.ForAttributeWithMetadataName<MethodDeclarationSyntax>("System.Runtime.InteropServices.LibraryImportAttribute"); 1346{ Value: MethodDeclarationSyntax { Identifier.ValueText: "SomeFunction" } }, 1347{ Value: MethodDeclarationSyntax { Identifier.ValueText: "SomeFunction2" } }])); 1382var input = ctx.ForAttributeWithMetadataName<MethodDeclarationSyntax>("System.Runtime.InteropServices.LibraryImportAttribute"); 1392{ Value: MethodDeclarationSyntax { Identifier.ValueText: "SomeFunction" } }, 1393{ Value: MethodDeclarationSyntax { Identifier.ValueText: "SomeFunction2" } }]));
SourceGeneration\SyntaxAwareGeneratorTests.cs (2)
475Assert.DoesNotContain(receiver1.VisitedNodes, n => n is MethodDeclarationSyntax); 476Assert.Contains(receiver2.VisitedNodes, n => n is MethodDeclarationSyntax);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (196)
Compilation\GetSemanticInfoTests.cs (14)
244var mainMethod = testClass.Members[1] as MethodDeclarationSyntax; 297var main = (MethodDeclarationSyntax)c.Members[1]; 376var mainMethod = testClass.Members[1] as MethodDeclarationSyntax; 479var mainMethod = testClass.Members[1] as MethodDeclarationSyntax; 532var mainMethod = testClass.Members[0] as MethodDeclarationSyntax; 973var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 997var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0];
Compilation\SemanticModelAPITests.cs (56)
43var m = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(decl => decl.Identifier.ValueText == "M"); 44var m2 = m.WithoutTrailingTrivia(); 702var method = decl.Members[0] as MethodDeclarationSyntax; 880var pMethod01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 881var pMethod02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last(); 1500var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1549var methodDecl = (MethodDeclarationSyntax)interfaceDecl.Members[0]; 1646var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1777var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1828var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1878var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1917var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1954var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1991var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 2172var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[2]; 2217var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[2]; 2257var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 2349var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 2352var speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement); 2562var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 2567var speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement); 2634var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 2638var speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement); 2671var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 2675var speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement); 2762var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 2774var speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement); 2863var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[1]; 3087var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 3873var methodDecl = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 3910var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (88)
278var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 566var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 588var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 821var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 857var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 901var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 973var memDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 980memDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1083var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[2]; 1173var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[2]; 1223var methodM = (MethodDeclarationSyntax)typeDeclC.Members[1]; 1332var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1435var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1488var methodDecl = (MethodDeclarationSyntax)classDecl.Members[0]; 1496methodDecl = (MethodDeclarationSyntax)structDecl.Members[0]; 1537var methodDecl = (MethodDeclarationSyntax)interfaceDecl.Members[0]; 1549methodDecl = (MethodDeclarationSyntax)interfaceDecl.Members[0]; 1712var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1815var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 1871var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 2008var methodDecl = (MethodDeclarationSyntax)typeDecl.Members[0]; 2052var methodM = (MethodDeclarationSyntax)typeDeclA.Members[0]; 2250var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2286var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2323var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2359var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2395var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2425var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2457var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2494var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2531var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2562var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[1]; 2591var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[1]; 2616var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2641var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2671var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2699var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2849var explicitMethodNode = (MethodDeclarationSyntax)classMemberNodes[0]; 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); 3211var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[2]).Members[0]; 3234var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 3265var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 3668dynamic methodDecl = (MethodDeclarationSyntax)tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("Main", StringComparison.Ordinal)).Parent; 3709var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 5175var methodDeclM = (MethodDeclarationSyntax)typeDeclC.Members.Single();
SymbolDisplay\SymbolDisplayTests.cs (3)
6062var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 6072methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (2)
1042var explicitInterfaceImplementation = nodes.OfType<MethodDeclarationSyntax>().Single(d => d.ExplicitInterfaceSpecifier != null);
Symbols\AnonymousTypesSymbolTests.cs (2)
1683var mainSyntax = mainMethod.DeclaringSyntaxReferences.Single().GetSyntax() as MethodDeclarationSyntax;
Symbols\FunctionPointerTypeSymbolTests.cs (12)
53.OfType<MethodDeclarationSyntax>() 125.OfType<MethodDeclarationSyntax>() 205.OfType<MethodDeclarationSyntax>() 406.OfType<MethodDeclarationSyntax>() 486.OfType<MethodDeclarationSyntax>() 603.OfType<MethodDeclarationSyntax>() 686.OfType<MethodDeclarationSyntax>() 1685var mDeclSyntax = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Skip(2).Single(); 1796var methodDecls = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 1819var m2DeclSyntax = methodDecls[1]; 1865var m3DeclSyntax = methodDecls[2];
Symbols\ImplicitClassTests.cs (2)
117var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Symbols\MethodEqualityTests.cs (2)
210var mDecl = (MethodDeclarationSyntax)cDecl.Members[0];
Symbols\Source\FileModifierTests.cs (4)
3641var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3711var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3773var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3814var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!;
Symbols\Source\MethodTests.cs (2)
2540var methods = syntax.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 2572var methods = syntax.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray();
Symbols\Source\NullablePublicAPITests.cs (6)
3507var mDeclaration = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(m => m.Identifier.ValueText == "M"); 4513var methodDeclaration = (MethodDeclarationSyntax)SyntaxFactory.ParseMemberDeclaration(@" 4545var methodDeclaration = (MethodDeclarationSyntax)SyntaxFactory.ParseMemberDeclaration(@"
Symbols\Source\UpdatedContainingSymbolAndNullableAnntotationTests.cs (1)
41Symbol m2 = model.GetDeclaredSymbol(root.DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(1)).GetSymbol();
Symbols\TypeTests.cs (2)
1679var mnode = (MethodDeclarationSyntax)tree.FindNodeOrTokenByKind(SyntaxKind.MethodDeclaration);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (321)
Generated\Syntax.Test.xml.Generated.cs (5)
10778private static MethodDeclarationSyntax GenerateMethodDeclaration() 13261var node = GenerateMethodDeclaration(); 13274var newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithReturnType(node.ReturnType).WithExplicitInterfaceSpecifier(node.ExplicitInterfaceSpecifier).WithIdentifier(node.Identifier).WithTypeParameterList(node.TypeParameterList).WithParameterList(node.ParameterList).WithConstraintClauses(node.ConstraintClauses).WithBody(node.Body).WithExpressionBody(node.ExpressionBody).WithSemicolonToken(node.SemicolonToken); 18857var oldNode = GenerateMethodDeclaration(); 18873var oldNode = GenerateMethodDeclaration();
IncrementalParsing\BinaryExpression.cs (4)
32var method = type.Members[0] as MethodDeclarationSyntax; 208MethodDeclarationSyntax method = classType.Members[0] as MethodDeclarationSyntax;
IncrementalParsing\ChangingIdentifiers.cs (4)
275MethodDeclarationSyntax method = classType.Members[0] as MethodDeclarationSyntax; 282var method = newTree.GetCompilationUnitRoot().Members[0] as MethodDeclarationSyntax;
IncrementalParsing\CompoundAssignment.cs (2)
147var method = classType.Members[0] as MethodDeclarationSyntax;
IncrementalParsing\UnaryExpression.cs (2)
90var method = classType.Members[0] as MethodDeclarationSyntax;
LexicalAndXml\XmlDocCommentTests.cs (9)
1832Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1834var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType; 1867Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1869var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType; 1972Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1975var method = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax; 2047Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 2049var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType;
Parsing\DeclarationParsingTests.cs (32)
2499var ms = (MethodDeclarationSyntax)cs.Members[0]; 2545var ms = (MethodDeclarationSyntax)cs.Members[0]; 2591var ms = (MethodDeclarationSyntax)cs.Members[0]; 2694var ms = (MethodDeclarationSyntax)cs.Members[0]; 2762var ms = (MethodDeclarationSyntax)cs.Members[0]; 2809var ms = (MethodDeclarationSyntax)structDecl.Members[0]; 2856var ms = (MethodDeclarationSyntax)structDecl.Members[0]; 3008var ms = (MethodDeclarationSyntax)cs.Members[0]; 3060var ms = (MethodDeclarationSyntax)cs.Members[0]; 3121var ms = (MethodDeclarationSyntax)cs.Members[0]; 3186var ms = (MethodDeclarationSyntax)cs.Members[0]; 3260var ms = (MethodDeclarationSyntax)cs.Members[0]; 3325var ms = (MethodDeclarationSyntax)cs.Members[0]; 3377var ms = (MethodDeclarationSyntax)cs.Members[0]; 3423var ms = (MethodDeclarationSyntax)cs.Members[0]; 5885var mainMethod = (MethodDeclarationSyntax)@class.Members[0];
Parsing\LocalFunctionParsingTests.cs (10)
1228var m = Assert.IsType<MethodDeclarationSyntax>(file.DescendantNodes() 1296var m = Assert.IsType<MethodDeclarationSyntax>(c.Members[0]); 1300var m2 = Assert.IsType<MethodDeclarationSyntax>(c.Members[1]); 1348var m = Assert.IsType<MethodDeclarationSyntax>(c.Members[0]); 1358var m2 = Assert.IsType<MethodDeclarationSyntax>(c.Members[1]);
Parsing\ParserErrorMessageTests.cs (3)
3767var methodDeclaration = (MethodDeclarationSyntax)tree.GetRoot().DescendantNodes().Single(node => node is MethodDeclarationSyntax);
Parsing\ParsingErrorRecoveryTests.cs (224)
3042var ms = (MethodDeclarationSyntax)agg.Members[0]; 3065var ms = (MethodDeclarationSyntax)agg.Members[0]; 3089var ms = (MethodDeclarationSyntax)agg.Members[0]; 3113var ms = (MethodDeclarationSyntax)agg.Members[0]; 3135var ms = (MethodDeclarationSyntax)agg.Members[0]; 3158var ms = (MethodDeclarationSyntax)agg.Members[0]; 3181var ms = (MethodDeclarationSyntax)agg.Members[0]; 3204var ms = (MethodDeclarationSyntax)agg.Members[0]; 3227var ms = (MethodDeclarationSyntax)agg.Members[0]; 3250var ms = (MethodDeclarationSyntax)agg.Members[0]; 3271var ms = (MethodDeclarationSyntax)agg.Members[0]; 3292var ms = (MethodDeclarationSyntax)agg.Members[0]; 3313var ms = (MethodDeclarationSyntax)agg.Members[0]; 3334var ms = (MethodDeclarationSyntax)agg.Members[0]; 3355var ms = (MethodDeclarationSyntax)agg.Members[0]; 3376var ms = (MethodDeclarationSyntax)agg.Members[0]; 3398var ms = (MethodDeclarationSyntax)agg.Members[0]; 3421var ms = (MethodDeclarationSyntax)agg.Members[0]; 3444var ms = (MethodDeclarationSyntax)agg.Members[0]; 3467var ms = (MethodDeclarationSyntax)agg.Members[0]; 3491var ms = (MethodDeclarationSyntax)agg.Members[0]; 3514var ms = (MethodDeclarationSyntax)agg.Members[0]; 3537var ms = (MethodDeclarationSyntax)agg.Members[0]; 3554var md = (file.Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax; 3580var ms = (MethodDeclarationSyntax)agg.Members[0]; 3605var ms = (MethodDeclarationSyntax)agg.Members[0]; 3630var ms = (MethodDeclarationSyntax)agg.Members[0]; 3656var ms = (MethodDeclarationSyntax)agg.Members[0]; 3680var ms = (MethodDeclarationSyntax)agg.Members[0]; 3704var ms = (MethodDeclarationSyntax)agg.Members[0]; 3729var ms = (MethodDeclarationSyntax)agg.Members[0]; 3753var ms = (MethodDeclarationSyntax)agg.Members[0]; 3777var ms = (MethodDeclarationSyntax)agg.Members[0]; 3801var ms = (MethodDeclarationSyntax)agg.Members[0]; 3826var ms = (MethodDeclarationSyntax)agg.Members[0]; 3850var ms = (MethodDeclarationSyntax)agg.Members[0]; 3874var ms = (MethodDeclarationSyntax)agg.Members[0]; 3899var ms = (MethodDeclarationSyntax)agg.Members[0]; 3925var ms = (MethodDeclarationSyntax)agg.Members[0]; 3951var ms = (MethodDeclarationSyntax)agg.Members[0]; 3978var ms = (MethodDeclarationSyntax)agg.Members[0]; 4003var ms = (MethodDeclarationSyntax)agg.Members[0]; 4028var ms = (MethodDeclarationSyntax)agg.Members[0]; 4054var ms = (MethodDeclarationSyntax)agg.Members[0]; 4075var ms = (MethodDeclarationSyntax)agg.Members[0]; 4120var ms = (MethodDeclarationSyntax)agg.Members[0]; 4141var ms = (MethodDeclarationSyntax)agg.Members[0]; 4162var ms = (MethodDeclarationSyntax)agg.Members[0]; 4183var ms = (MethodDeclarationSyntax)agg.Members[0]; 4205var ms = (MethodDeclarationSyntax)agg.Members[0]; 4227var ms = (MethodDeclarationSyntax)agg.Members[0]; 4250var ms = (MethodDeclarationSyntax)agg.Members[0]; 4273var ms = (MethodDeclarationSyntax)agg.Members[0]; 4294var ms = (MethodDeclarationSyntax)agg.Members[0]; 4317var ms = (MethodDeclarationSyntax)agg.Members[0]; 4340var ms = (MethodDeclarationSyntax)agg.Members[0]; 4366var ms = (MethodDeclarationSyntax)agg.Members[0]; 4388var ms = (MethodDeclarationSyntax)agg.Members[0]; 4414var ms = (MethodDeclarationSyntax)agg.Members[0]; 4441var ms = (MethodDeclarationSyntax)agg.Members[0]; 4462var ms = (MethodDeclarationSyntax)agg.Members[0]; 4485var ms = (MethodDeclarationSyntax)agg.Members[0]; 4510var ms = (MethodDeclarationSyntax)agg.Members[0]; 4535var ms = (MethodDeclarationSyntax)agg.Members[0]; 4557var ms = (MethodDeclarationSyntax)agg.Members[0]; 4582var ms = (MethodDeclarationSyntax)agg.Members[0]; 4608var ms = (MethodDeclarationSyntax)agg.Members[0]; 4635var ms = (MethodDeclarationSyntax)agg.Members[0]; 4662var ms = (MethodDeclarationSyntax)agg.Members[0]; 4690var ms = (MethodDeclarationSyntax)agg.Members[0]; 4717var ms = (MethodDeclarationSyntax)agg.Members[0]; 4744var ms = (MethodDeclarationSyntax)agg.Members[0]; 4773var ms = (MethodDeclarationSyntax)agg.Members[0]; 4802var ms = (MethodDeclarationSyntax)agg.Members[0]; 4832var ms = (MethodDeclarationSyntax)agg.Members[0]; 4861var ms = (MethodDeclarationSyntax)agg.Members[0]; 4890var ms = (MethodDeclarationSyntax)agg.Members[0]; 4917var ms = (MethodDeclarationSyntax)agg.Members[0]; 4944var ms = (MethodDeclarationSyntax)agg.Members[0]; 4971var ms = (MethodDeclarationSyntax)agg.Members[0]; 4999var ms = (MethodDeclarationSyntax)agg.Members[0]; 5026var ms = (MethodDeclarationSyntax)agg.Members[0]; 5054var ms = (MethodDeclarationSyntax)agg.Members[0]; 5080var ms = (MethodDeclarationSyntax)agg.Members[0]; 5110var ms = (MethodDeclarationSyntax)agg.Members[0]; 5139var ms = (MethodDeclarationSyntax)agg.Members[0]; 5169var ms = (MethodDeclarationSyntax)agg.Members[0]; 5822var ms = (MethodDeclarationSyntax)agg.Members[0]; 5861var ms = (MethodDeclarationSyntax)agg.Members[0]; 5890var ms = (MethodDeclarationSyntax)agg.Members[0]; 5919var ms = (MethodDeclarationSyntax)agg.Members[0]; 5949var ms = (MethodDeclarationSyntax)agg.Members[0]; 5978var ms = (MethodDeclarationSyntax)agg.Members[0]; 6012var ms = (MethodDeclarationSyntax)agg.Members[0]; 6039var ms = (MethodDeclarationSyntax)agg.Members[0]; 6066var ms = (MethodDeclarationSyntax)agg.Members[0]; 6093var ms = (MethodDeclarationSyntax)agg.Members[0]; 6121var ms = (MethodDeclarationSyntax)agg.Members[0]; 6148var ms = (MethodDeclarationSyntax)agg.Members[0]; 6178var ms = (MethodDeclarationSyntax)agg.Members[0]; 6209var ms = (MethodDeclarationSyntax)agg.Members[0]; 6237var ms = (MethodDeclarationSyntax)agg.Members[0]; 6284var ms = (MethodDeclarationSyntax)agg.Members[0]; 6318var ms = (MethodDeclarationSyntax)agg.Members[0]; 6348var ms = (MethodDeclarationSyntax)agg.Members[0]; 6631var md = (MethodDeclarationSyntax)agg.Members[0]; 6676var md = (MethodDeclarationSyntax)agg.Members[0]; 6720var md = (MethodDeclarationSyntax)agg.Members[0]; 6770var md = (MethodDeclarationSyntax)agg.Members[0]; 6818var md = (MethodDeclarationSyntax)agg.Members[0]; 6865var md = (MethodDeclarationSyntax)agg.Members[0]; 6920var subitem1 = (MethodDeclarationSyntax)item1.Members[0];
Syntax\LambdaUtilitiesTests.cs (2)
57var methodDef = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(d => d.Identifier.ValueText == "M").Single();
Syntax\SyntaxFactoryTests.cs (1)
561var syntaxNode = SyntaxFactory.MethodDeclaration(
Syntax\SyntaxListTests.cs (1)
236var newMethodDeclaration = SyntaxFactory.MethodDeclaration(SyntaxFactory.ParseTypeName("void"), "M");
Syntax\SyntaxNodeTests.cs (22)
911tree1.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo( 912tree2.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 922tree1.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo( 923tree2.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 2075MethodDeclarationSyntax method = root.Members[0].Members[0]; 2725var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2729var m2 = m.RemoveNode(m.Body, SyntaxRemoveOptions.KeepExteriorTrivia); 2759var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2794var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2832var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2872var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2904var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 3503var method = (MethodDeclarationSyntax)@class.Members.Single(); 3590var method = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Extensions.cs (2)
42public static MethodDeclarationSyntax AsMethodDeclarationSyntax(this SyntaxNode node) 44return node as MethodDeclarationSyntax;
Microsoft.CodeAnalysis.CSharp.Workspaces (64)
Classification\ClassificationHelpers.cs (2)
206else if (token.Parent is MethodDeclarationSyntax methodDeclaration && methodDeclaration.Identifier == token) 331private static bool IsExtensionMethod(MethodDeclarationSyntax methodDeclaration)
CodeGeneration\CSharpSyntaxGenerator.cs (20)
612if (declaration is MethodDeclarationSyntax method) 626SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 815return ((MethodDeclarationSyntax)member) 1756MethodDeclarationSyntax method => method.WithTypeParameterList(typeParameterList), 1769MethodDeclarationSyntax method 1778private static MethodDeclarationSyntax WithoutConstraints(MethodDeclarationSyntax method) 1810MethodDeclarationSyntax method => method.WithConstraintClauses(WithTypeConstraints(method.ConstraintClauses, typeParameterName, kinds, isUnmanagedType, types)), 1818var method = (MethodDeclarationSyntax)declaration; 1882MethodDeclarationSyntax methodDeclaration => methodDeclaration.Identifier.ValueText, 1909MethodDeclarationSyntax methodDeclaration => ReplaceWithTrivia(declaration, methodDeclaration.Identifier, id), 1946return NotVoid(((MethodDeclarationSyntax)declaration).ReturnType); 1985SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 2210return ((MethodDeclarationSyntax)declaration).WithParameterList(list); 2277var method = (MethodDeclarationSyntax)declaration; 2333var method = (MethodDeclarationSyntax)declaration; 2459SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).Body?.Statements,
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (6)
34MethodDeclarationSyntax, 351var method = (MethodDeclarationSyntax)node; 496private static string GetMethodSuffix(MethodDeclarationSyntax method) 662private static bool IsExtensionMethod(MethodDeclarationSyntax method) 686protected override string GetReceiverTypeName(MethodDeclarationSyntax methodDeclaration)
Rename\LocalConflictVisitor.cs (1)
30public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
Simplification\Reducers\CSharpEscapingReducer.cs (2)
75var enclosingMethodBlock = parent.GetAncestorsOrThis(n => n is MethodDeclarationSyntax).FirstOrDefault(); 77if (enclosingMethodBlock != null && ((MethodDeclarationSyntax)enclosingMethodBlock).Modifiers.Any(SyntaxKind.AsyncKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (1)
35case MethodDeclarationSyntax methodDeclaration:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (5)
52return ((MethodDeclarationSyntax)member).Identifier; 83return ((MethodDeclarationSyntax)member).Arity; 105return ((MethodDeclarationSyntax)member).TypeParameterList; 123return ((MethodDeclarationSyntax)member).WithParameterList((ParameterListSyntax)parameterList); 147return ((MethodDeclarationSyntax)member).ReturnType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
280=> node is MethodDeclarationSyntax or AnonymousFunctionExpressionSyntax or LocalFunctionStatementSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (2)
70var method = (MethodDeclarationSyntax)declaration;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpHeaderFacts.cs (1)
66var node = TryGetAncestorForLocation<MethodDeclarationSyntax>(root, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
1545=> node is MethodDeclarationSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
124MethodDeclarationSyntax or
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
155=> members.FirstOrDefault(m => m is MethodDeclarationSyntax); 164=> members.LastOrDefault(m => m is MethodDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
796var methodDeclarationSyntax = (MethodDeclarationSyntax)syntaxNode;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (4)
118return Compare((MethodDeclarationSyntax)x, (MethodDeclarationSyntax)y); 199private int Compare(MethodDeclarationSyntax x, MethodDeclarationSyntax y)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (11)
37var declaration = GenerateMethodDeclaration(method, CodeGenerationDestination.Namespace, info, cancellationToken); 50var declaration = GenerateMethodDeclaration( 65var methodDeclaration = GenerateMethodDeclaration( 74public static MethodDeclarationSyntax GenerateMethodDeclaration( 79var reusableSyntax = GetReuseableSyntaxNodeForSymbol<MethodDeclarationSyntax>(method, info); 85var declaration = GenerateMethodDeclarationWorker( 111private static MethodDeclarationSyntax GenerateMethodDeclarationWorker( 126var methodDeclaration = MethodDeclaration( 183private static MethodDeclarationSyntax UseExpressionBodyIfDesired( 184CSharpCodeGenerationContextInfo info, MethodDeclarationSyntax methodDeclaration, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
1130MethodDeclarationSyntax or LocalFunctionStatementSyntax or ConstructorDeclarationSyntax or DelegateDeclarationSyntax or TypeDeclarationSyntax => true, 1213var method = tokenOnLeftOfPosition.Parent.GetAncestorOrThis<MethodDeclarationSyntax>();
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (72)
CodeGeneration\SyntaxGeneratorTests.cs (70)
804VerifySyntax<MethodDeclarationSyntax>( 808VerifySyntax<MethodDeclarationSyntax>( 812VerifySyntax<MethodDeclarationSyntax>( 816VerifySyntax<MethodDeclarationSyntax>( 820VerifySyntax<MethodDeclarationSyntax>( 824VerifySyntax<MethodDeclarationSyntax>( 828VerifySyntax<MethodDeclarationSyntax>( 832VerifySyntax<MethodDeclarationSyntax>( 836VerifySyntax<MethodDeclarationSyntax>( 840VerifySyntax<MethodDeclarationSyntax>( 844VerifySyntax<MethodDeclarationSyntax>( 1169VerifySyntax<MethodDeclarationSyntax>( 1192VerifySyntax<MethodDeclarationSyntax>( 1196VerifySyntax<MethodDeclarationSyntax>( 1201VerifySyntax<MethodDeclarationSyntax>( 1472VerifySyntax<MethodDeclarationSyntax>( 1501VerifySyntax<MethodDeclarationSyntax>( 1505VerifySyntax<MethodDeclarationSyntax>( 1525VerifySyntax<MethodDeclarationSyntax>( 1856VerifySyntax<MethodDeclarationSyntax>( 1862VerifySyntax<MethodDeclarationSyntax>( 1999VerifySyntax<MethodDeclarationSyntax>( 2005VerifySyntax<MethodDeclarationSyntax>( 2010VerifySyntax<MethodDeclarationSyntax>( 2016VerifySyntax<MethodDeclarationSyntax>( 2050VerifySyntax<MethodDeclarationSyntax>( 2056VerifySyntax<MethodDeclarationSyntax>( 2062VerifySyntax<MethodDeclarationSyntax>( 2068VerifySyntax<MethodDeclarationSyntax>( 2074VerifySyntax<MethodDeclarationSyntax>( 2082VerifySyntax<MethodDeclarationSyntax>( 2088VerifySyntax<MethodDeclarationSyntax>( 2094VerifySyntax<MethodDeclarationSyntax>( 2100VerifySyntax<MethodDeclarationSyntax>( 2106VerifySyntax<MethodDeclarationSyntax>( 2112VerifySyntax<MethodDeclarationSyntax>( 2166VerifySyntax<MethodDeclarationSyntax>( 2229VerifySyntax<MethodDeclarationSyntax>( 2250VerifySyntax<MethodDeclarationSyntax>( 2271VerifySyntax<MethodDeclarationSyntax>( 2292VerifySyntax<MethodDeclarationSyntax>( 2376VerifySyntax<MethodDeclarationSyntax>( 2404VerifySyntax<MethodDeclarationSyntax>( 2432VerifySyntax<MethodDeclarationSyntax>( 2463VerifySyntax<MethodDeclarationSyntax>( 2500VerifySyntax<MethodDeclarationSyntax>( 2799var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("m"); 3298var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("p"); 3334var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("p"); 4282VerifySyntax<MethodDeclarationSyntax>( 4333VerifySyntax<MethodDeclarationSyntax>( 4341VerifySyntax<MethodDeclarationSyntax>( 4350VerifySyntax<MethodDeclarationSyntax>( 4359VerifySyntax<MethodDeclarationSyntax>( 4368VerifySyntax<MethodDeclarationSyntax>( 4375VerifySyntax<MethodDeclarationSyntax>( 4441VerifySyntax<MethodDeclarationSyntax>( 4453VerifySyntax<MethodDeclarationSyntax>( 4465VerifySyntax<MethodDeclarationSyntax>( 4478VerifySyntax<MethodDeclarationSyntax>( 4490VerifySyntax<MethodDeclarationSyntax>( 4502VerifySyntax<MethodDeclarationSyntax>( 4514VerifySyntax<MethodDeclarationSyntax>( 4526VerifySyntax<MethodDeclarationSyntax>( 4539VerifySyntax<MethodDeclarationSyntax>( 4552VerifySyntax<MethodDeclarationSyntax>( 4693VerifySyntax<MethodDeclarationSyntax>(
Formatting\FormattingTreeEditTests.cs (2)
56var method = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
CodeGeneration\CodeGenerationTests.CSharp.cs (1)
1442await TestUpdateDeclarationAsync<MethodDeclarationSyntax>(input, expected, getType: GetTypeSymbol(typeof(int)));
SymbolKey\SymbolKeyCrossLanguageTests.cs (1)
46var method = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.Workspaces.UnitTests (17)
CodeCleanup\CodeCleanupTests.cs (1)
365public static CSharp.Syntax.MethodDeclarationSyntax CreateCSharpMethod(string returnType = "void", string methodName = "Method")
Editing\SyntaxEditorTests.cs (4)
223var methodX = (MethodDeclarationSyntax)editor.Generator.GetMembers(cls)[0]; 267var methodX = (MethodDeclarationSyntax)editor.Generator.GetMembers(cls)[0];
FindReferencesTests.cs (1)
286var methodlist = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax>().ToList();
SymbolKeyTests.cs (2)
1023n => n is CSharp.Syntax.MethodDeclarationSyntax).Single(); 1060n => n is CSharp.Syntax.MethodDeclarationSyntax).Single();
SyntaxNodeTests.cs (4)
96var methodDecl = classDecl.DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 109var latestMethod = classDeclWithField.GetCurrentNodes(methodDecl).First(); 127var finalMethodDecl = root2.GetCurrentNodes(methodDecl).First();
SyntaxPathTests.cs (5)
164Assert.Equal("M1", ((MethodDeclarationSyntax)n1).Identifier.ValueText); 167Assert.Equal("M2", ((MethodDeclarationSyntax)n2).Identifier.ValueText); 170Assert.Equal("M3", ((MethodDeclarationSyntax)n3).Identifier.ValueText); 232Assert.Equal("M1", ((MethodDeclarationSyntax)n1).Identifier.ValueText); 235Assert.Equal("M2", ((MethodDeclarationSyntax)n2).Identifier.ValueText);
Microsoft.DotNet.GenFacades (2)
NotSupportedAssemblyGenerator.cs (2)
113public override SyntaxNode VisitMethodDeclaration(MethodDeclarationSyntax node) 215private string GetMethodDefinition(MethodDeclarationSyntax node) => GetFullyQualifiedName((TypeDeclarationSyntax)node.Parent) + "." + node.Identifier.ValueText;
Microsoft.Extensions.Logging.Generators (5)
LoggerMessageGenerator.Parser.cs (2)
96var method = member as MethodDeclarationSyntax;
LoggerMessageGenerator.Roslyn3.11.cs (3)
65node is MethodDeclarationSyntax m && m.AttributeLists.Count > 0; 69var methodDeclarationSyntax = (MethodDeclarationSyntax)context.Node;
Microsoft.Gen.ContextualOptions.Unit.Tests (2)
EmitterTests.cs (2)
64.OfType<MethodDeclarationSyntax>() 93.OfType<MethodDeclarationSyntax>()
Microsoft.Gen.Logging (5)
Parsing\Parser.cs (5)
71var method = member as MethodDeclarationSyntax; 366(LoggingMethod lm, bool keepMethod) ProcessMethod(MethodDeclarationSyntax method, IMethodSymbol methodSymbol, Location attrLoc) 455private static bool HasXmlDocumentation(MethodDeclarationSyntax method) 603private Location? GetLoggerMessageAttribute(MethodDeclarationSyntax methodSyntax, SemanticModel sm, SymbolHolder symbols)
Microsoft.Gen.Metrics (3)
Parser.cs (3)
83var methodSyntax = (MethodDeclarationSyntax)memberSyntax; 393MethodDeclarationSyntax methodSyntax,
Microsoft.Gen.MetricsReports (3)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (3)
83var methodSyntax = (MethodDeclarationSyntax)memberSyntax; 393MethodDeclarationSyntax methodSyntax,
Microsoft.Interop.ComInterfaceGenerator (24)
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (1)
75GeneratorDiagnosticsBag diagnostics = new(new DiagnosticDescriptorProvider(), new MethodSignatureDiagnosticLocations((MethodDeclarationSyntax)method.DeclaringSyntaxReferences[0].GetSyntax()), SR.ResourceManager, typeof(FxResources.Microsoft.Interop.ComInterfaceGenerator.SR));
ComInterfaceGenerator.cs (2)
236private static IncrementalMethodStubGenerationContext CalculateStubInformation(MethodDeclarationSyntax syntax, IMethodSymbol symbol, int index, StubEnvironment environment, ManagedTypeInfo owningInterface, CancellationToken ct) 517private static readonly MethodDeclarationSyntax CreateManagedVirtualFunctionTableMethodTemplate = MethodDeclaration(TypeSyntaxes.VoidStarStar, CreateManagedVirtualFunctionTableMethodName)
ComMethodContext.cs (6)
102private MethodDeclarationSyntax? _unreachableExceptionStub; 104public MethodDeclarationSyntax UnreachableExceptionStub => _unreachableExceptionStub ??= CreateUnreachableExceptionStub(); 106private MethodDeclarationSyntax CreateUnreachableExceptionStub() 123private MethodDeclarationSyntax? _shadow; 125public MethodDeclarationSyntax Shadow => _shadow ??= GenerateShadow(); 127private MethodDeclarationSyntax GenerateShadow()
ComMethodInfo.cs (5)
20public MethodDeclarationSyntax Syntax { get; init; } 26MethodDeclarationSyntax syntax, 66private static DiagnosticInfo? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax comMethodDeclaringSyntax, IMethodSymbol method) 123MethodDeclarationSyntax? comMethodDeclaringSyntax = null; 129comMethodDeclaringSyntax = (MethodDeclarationSyntax)declaringSyntax;
GeneratedStubCodeContext.cs (1)
12SyntaxEquivalentNode<MethodDeclarationSyntax> Stub,
VirtualMethodPointerStubGenerator.cs (4)
23public static (MethodDeclarationSyntax, ImmutableArray<DiagnosticInfo>) GenerateManagedToNativeStub( 115private static MethodDeclarationSyntax PrintGeneratedSource( 130public static (MethodDeclarationSyntax, ImmutableArray<DiagnosticInfo>) GenerateNativeToManagedStub( 165MethodDeclarationSyntax unmanagedToManagedStub =
VtableIndexStubGenerator.cs (5)
41static (node, ct) => node is MethodDeclarationSyntax, 43? new { Syntax = (MethodDeclarationSyntax)context.TargetNode, Symbol = methodSymbol } 198private static IncrementalMethodStubGenerationContext CalculateStubInformation(MethodDeclarationSyntax syntax, IMethodSymbol symbol, StubEnvironment environment, CancellationToken ct) 391private static Diagnostic? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method) 441MethodDeclarationSyntax populateVtableMethod = MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)),
Microsoft.Interop.JavaScript.JSImportGenerator (9)
JSExportGenerator.cs (4)
42static (node, ct) => node is MethodDeclarationSyntax, 43static (context, ct) => new { Syntax = (MethodDeclarationSyntax)context.TargetNode, Symbol = (IMethodSymbol)context.TargetSymbol }); 170MethodDeclarationSyntax originalSyntax, 335private static Diagnostic? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method)
JSImportGenerator.cs (5)
40static (node, ct) => node is MethodDeclarationSyntax, 41static (context, ct) => new { Syntax = (MethodDeclarationSyntax)context.TargetNode, Symbol = (IMethodSymbol)context.TargetSymbol }); 113MethodDeclarationSyntax stubMethod = MethodDeclaration(stub.SignatureContext.StubReturnType, userDeclaredMethod.Identifier) 150MethodDeclarationSyntax originalSyntax, 214private static Diagnostic? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method)
Microsoft.Interop.LibraryImportGenerator (9)
Analyzers\ConvertToLibraryImportAnalyzer.cs (1)
141GeneratorDiagnosticsBag diagnostics = new(new DiagnosticDescriptorProvider(), new MethodSignatureDiagnosticLocations((MethodDeclarationSyntax)method.DeclaringSyntaxReferences[0].GetSyntax()), SR.ResourceManager, typeof(FxResources.Microsoft.Interop.LibraryImportGenerator.SR));
LibraryImportGenerator.cs (8)
46static (node, ct) => node is MethodDeclarationSyntax, 48? new { Syntax = (MethodDeclarationSyntax)context.TargetNode, Symbol = methodSymbol } 58? DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From(diagnostic) 59: DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From((data.Syntax, data.Symbol)); 173private static MethodDeclarationSyntax PrintGeneratedSource( 219MethodDeclarationSyntax originalSyntax, 417MethodDeclarationSyntax stubMethod = MethodDeclaration(stub.SignatureContext.StubReturnType, userDeclaredMethod.Identifier) 541private static DiagnosticInfo? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method)
Microsoft.Interop.LibraryImportGenerator.Downlevel (8)
DownlevelLibraryImportGenerator.cs (8)
45static (node, ct) => node is MethodDeclarationSyntax, 47? new { Syntax = (MethodDeclarationSyntax)context.TargetNode, Symbol = methodSymbol } 57? DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From(diagnostic) 58: DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From((data.Syntax, data.Symbol)); 115private static MethodDeclarationSyntax PrintGeneratedSource( 161MethodDeclarationSyntax originalSyntax, 296MethodDeclarationSyntax stubMethod = MethodDeclaration(stub.SignatureContext.StubReturnType, userDeclaredMethod.Identifier) 411private static DiagnosticInfo? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method)
Microsoft.Interop.SourceGeneration (1)
MethodSignatureDiagnosticLocations.cs (1)
47public MethodSignatureDiagnosticLocations(MethodDeclarationSyntax syntax)
Microsoft.ML.InternalCodeAnalyzer (4)
ContractsCheckAnalyzer.cs (1)
168var enclosingParams = ((node as MethodDeclarationSyntax)?.ParameterList
ContractsCheckNameofFixProvider.cs (1)
114var paramList = (temp as MethodDeclarationSyntax)?.ParameterList
NameAnalyzer.cs (2)
105var node = (MethodDeclarationSyntax)context.Node;
Microsoft.VisualStudio.LanguageServices.CSharp (23)
CodeModel\CSharpCodeModelService.CodeModelEventCollector.cs (1)
830if (method is MethodDeclarationSyntax methodDecl)
CodeModel\CSharpCodeModelService.cs (16)
811return ((MethodDeclarationSyntax)node).ExplicitInterfaceSpecifier?.ToString() + 812((MethodDeclarationSyntax)node).Identifier.ToString(); 892return ((MethodDeclarationSyntax)node).WithIdentifier(newIdentifier); 2266Debug.Assert(memberNode is MethodDeclarationSyntax or 2303if (member is MethodDeclarationSyntax method) 2342if (member is MethodDeclarationSyntax method) 2895if (node is not MethodDeclarationSyntax methodDeclaration) 3384else if (container is MethodDeclarationSyntax method) 3578private static bool IsExtensionMethod(MethodDeclarationSyntax methodDeclaration) 3595private static bool IsPartialMethod(MethodDeclarationSyntax methodDeclaration) 3611var methodDeclaration = (MethodDeclarationSyntax)node; 3629var methodDeclaration = (MethodDeclarationSyntax)node; 3683return node is MethodDeclarationSyntax methodDeclaration 3685&& newNode is MethodDeclarationSyntax newMethodDeclaration
CodeModel\CSharpCodeModelService.NodeLocator.cs (2)
395startPosition = ((MethodDeclarationSyntax)node).Identifier.SpanStart; 958endPosition = ((MethodDeclarationSyntax)node).Identifier.Span.End;
CodeModel\CSharpCodeModelService.NodeNameGenerator.cs (2)
203var methodDeclaration = (MethodDeclarationSyntax)node;
CodeModel\MethodXml\MethodXmlBuilder.cs (1)
609public static string Generate(MethodDeclarationSyntax methodDeclaration, SemanticModel semanticModel)
LanguageService\CSharpHelpContextService.cs (1)
385if (token.Parent.GetAncestorOrThis<MethodDeclarationSyntax>() != null)
Mvc.Api.Analyzers.Test (2)
ActualApiResponseMetadataFactoryTest.cs (2)
374var methodSyntax = (MethodDeclarationSyntax)syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan);
System.Text.RegularExpressions.Generator (4)
RegexGenerator.cs (1)
60(node, _) => node is MethodDeclarationSyntax or PropertyDeclarationSyntax or IndexerDeclarationSyntax or AccessorDeclarationSyntax,
UpgradeToGeneratedRegexCodeFixer.cs (3)
183MethodDeclarationSyntax newMethod = (MethodDeclarationSyntax)generator.MethodDeclaration( 232newMethod = (MethodDeclarationSyntax)generator.AddAttributes(newMethod, attributes);