438 references to LocalFunctionStatementSyntax
ILLink.CodeFixProvider (1)
BaseAttributeCodeFixProvider.cs (1)
114 case LocalFunctionStatementSyntax or BaseMethodDeclarationSyntax or AccessorDeclarationSyntax when targets.HasFlag (AttributeableParentTargets.MethodOrConstructor):
Microsoft.CodeAnalysis.CSharp (57)
Binder\Binder_Statements.cs (3)
70result = BindLocalFunctionStatement((LocalFunctionStatementSyntax)node, diagnostics); 554private BoundStatement BindLocalFunctionStatement(LocalFunctionStatementSyntax node, BindingDiagnosticBag diagnostics) 3557LocalFunctionStatementSyntax => (MessageID?)null,
Binder\LocalBinderFactory.cs (2)
405public override void VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) 440private static LocalFunctionSymbol FindLocalFunction(LocalFunctionStatementSyntax node, Binder enclosing)
Binder\LocalScopeBinder.cs (5)
228var decl = (LocalFunctionStatementSyntax)innerStatement; 320var decl = (LocalFunctionStatementSyntax)innerStatement; 345protected LocalFunctionSymbol MakeLocalFunction(LocalFunctionStatementSyntax declaration)
Compilation\CSharpSemanticModel.cs (2)
2942public abstract IMethodSymbol GetDeclaredSymbol(LocalFunctionStatementSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 5088return this.GetDeclaredSymbol((LocalFunctionStatementSyntax)node, cancellationToken);
Compilation\MemberSemanticModel.cs (6)
230LocalFunctionStatementSyntax ownerOfTypeParametersInScope = null; 254var localFunction = (LocalFunctionStatementSyntax)stmt; 621public override IMethodSymbol GetDeclaredSymbol(LocalFunctionStatementSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 714internal LocalFunctionSymbol GetDeclaredLocalFunction(LocalFunctionStatementSyntax declarationSyntax) 852var localFunction = GetDeclaredSymbol((LocalFunctionStatementSyntax)paramList.Parent, cancellationToken).GetSymbol<MethodSymbol>();
Compilation\PublicSemanticModel.cs (1)
39LocalFunctionStatementSyntax or
Compilation\SpeculativeSemanticModelWithMemberModel.cs (1)
280public override IMethodSymbol GetDeclaredSymbol(LocalFunctionStatementSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (2)
1479public override IMethodSymbol GetDeclaredSymbol(LocalFunctionStatementSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 2154case LocalFunctionStatementSyntax localDecl:
CSharpExtensions.cs (1)
1627public static IMethodSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, LocalFunctionStatementSyntax node, CancellationToken cancellationToken = default(CancellationToken))
FlowAnalysis\NullableWalker.cs (1)
989LocalFunctionStatementSyntax localFunctionSyntax => localFunctionSyntax.GetLastToken(),
Lowering\ClosureConversion\ClosureConversion.cs (1)
1453else if (syntax is LocalFunctionStatementSyntax localFunction)
Parser\LanguageParser.cs (9)
2565if (tryParseLocalDeclarationStatementFromStartPoint<LocalFunctionStatementSyntax>(attributes, ref afterAttributesPoint, out result)) 2762tryParseLocalDeclarationStatementFromStartPoint<LocalFunctionStatementSyntax>(attributes, ref afterAttributesPoint, out result)) 4985out var localFunction); 5001out LocalFunctionStatementSyntax localFunction) 5164out LocalFunctionStatementSyntax localFunction, 10027out var localFunction); 10203out var localFunction); 10217out LocalFunctionStatementSyntax localFunction) 10381private LocalFunctionStatementSyntax TryParseLocalFunctionStatementBody(
Symbols\MethodSymbolExtensions.cs (1)
207else if (node is LocalFunctionStatementSyntax statement)
Symbols\Source\LocalFunctionSymbol.cs (5)
40LocalFunctionStatementSyntax syntax) 102internal LocalFunctionStatementSyntax Syntax => (LocalFunctionStatementSyntax)syntaxReferenceOpt.GetSyntax(); 473var syntax = Syntax; 503var syntax = Syntax;
Symbols\Source\SourceMethodSymbolWithAttributes.cs (2)
57case LocalFunctionStatementSyntax localFunction: 1529LocalFunctionStatementSyntax { ReturnType: var localReturnType } => localReturnType,
Syntax\LambdaUtilities.cs (7)
116return GetLocalFunctionBody((LocalFunctionStatementSyntax)newLambda); 127LocalFunctionStatementSyntax localFunctionStatementSyntax => (CSharpSyntaxNode?)localFunctionStatementSyntax.Body ?? localFunctionStatementSyntax.ExpressionBody!.Expression, 156var localFunction = (LocalFunctionStatementSyntax)parent; 161return arrowExpressionClause.Expression == node && arrowExpressionClause.Parent is LocalFunctionStatementSyntax; 350lambdaBody1 = GetLocalFunctionBody((LocalFunctionStatementSyntax)node); 484private static SyntaxNode? GetLocalFunctionBody(LocalFunctionStatementSyntax localFunctionStatementSyntax)
Syntax\LocalFunctionStatementSyntax.cs (3)
12public LocalFunctionStatementSyntax Update(SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) 24public static LocalFunctionStatementSyntax LocalFunctionStatement(SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) 30public static LocalFunctionStatementSyntax LocalFunctionStatement(SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken)
Syntax\LookupPosition.cs (3)
229internal static bool IsInLocalFunctionTypeParameterScope(int position, LocalFunctionStatementSyntax localFunction) 442LocalFunctionStatementSyntax localFunctionStmt = (LocalFunctionStatementSyntax)statement;
Syntax\SyntaxFacts.cs (1)
188return ((LocalFunctionStatementSyntax)parent).ReturnType == node;
Syntax\SyntaxNodeExtensions.cs (1)
267(current.Parent is LocalFunctionStatementSyntax localFunction && localFunction.ReturnType == current) ||
Microsoft.CodeAnalysis.CSharp.CodeStyle (33)
src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticDiagnosticAnalyzer.cs (2)
38var localFunction = (LocalFunctionStatementSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticHelper.cs (5)
17private static bool TryGetDataFlowAnalysis(LocalFunctionStatementSyntax localFunction, SemanticModel semanticModel, [NotNullWhen(returnValue: true)] out DataFlowAnalysis? dataFlow) 23private static bool CanBeCalledFromStaticContext(LocalFunctionStatementSyntax localFunction, DataFlowAnalysis dataFlow) 30static bool IsChildOrSelf(LocalFunctionStatementSyntax containingLocalFunction, ISymbol calledLocationFunction) 38public static bool CanMakeLocalFunctionStaticBecauseNoCaptures(LocalFunctionStatementSyntax localFunction, SemanticModel semanticModel) 43public static bool CanMakeLocalFunctionStaticByRefactoringCaptures(LocalFunctionStatementSyntax localFunction, SemanticModel semanticModel, out ImmutableArray<ISymbol> captures)
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForLocalFunctionHelper.cs (11)
18UseExpressionBodyHelper<LocalFunctionStatementSyntax> 35protected override BlockSyntax GetBody(LocalFunctionStatementSyntax statement) 38protected override ArrowExpressionClauseSyntax GetExpressionBody(LocalFunctionStatementSyntax statement) 41protected override SyntaxToken GetSemicolonToken(LocalFunctionStatementSyntax statement) 44protected override LocalFunctionStatementSyntax WithSemicolonToken(LocalFunctionStatementSyntax statement, SyntaxToken token) 47protected override LocalFunctionStatementSyntax WithExpressionBody(LocalFunctionStatementSyntax statement, ArrowExpressionClauseSyntax expressionBody) 50protected override LocalFunctionStatementSyntax WithBody(LocalFunctionStatementSyntax statement, BlockSyntax body) 54SemanticModel semanticModel, LocalFunctionStatementSyntax statement)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
105LocalFunctionStatementSyntax localFunction => localFunction.ReturnType,
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
220while (index + 1 < statements.Count && statements[index + 1] is LocalFunctionStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (3)
18var localFunctionStatement = destinationBlock.FirstAncestorOrSelf<LocalFunctionStatementSyntax>(); 38case LocalFunctionStatementSyntax localFunctionStatement:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
468public static IMethodSymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, LocalFunctionStatementSyntax syntax, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (5)
151LocalFunctionStatementSyntax localFunction => localFunction.ParameterList, 280=> node is MethodDeclarationSyntax or AnonymousFunctionExpressionSyntax or LocalFunctionStatementSyntax; 343case LocalFunctionStatementSyntax localFunction when localFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 743LocalFunctionStatementSyntax localFunction => localFunction.Modifiers, 755LocalFunctionStatementSyntax localFunction => localFunction.WithModifiers(modifiers),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
470else if (currentToken.Parent is LocalFunctionStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
212if (node is AnonymousFunctionExpressionSyntax or LocalFunctionStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
314LocalFunctionStatementSyntax localFunc => localFunc.Modifiers,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpHeaderFacts.cs (1)
79var node = TryGetAncestorForLocation<LocalFunctionStatementSyntax>(root, position);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (35)
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAboveReturnCodeFixProvider.cs (1)
48if (exprOrStatement is LocalFunctionStatementSyntax { ExpressionBody: { } localFunctionExpressionBody })
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAtStartCodeFixProvider.cs (1)
33if (location is LocalFunctionStatementSyntax { ExpressionBody: { } })
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
148LocalFunctionStatementSyntax localFunction => (localFunction.ReturnType, localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword)),
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (4)
30LocalFunctionStatementSyntax localFunction, 42LocalFunctionStatementSyntax localFunction, 175var localFunctionWithNewParameters = (LocalFunctionStatementSyntax)info.Service.AddParameters(
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (2)
65Func<Document, LocalFunctionStatementSyntax, ImmutableArray<ISymbol>, Task> fixer, 77.Select(d => root.FindNode(d.Location.SourceSpan).AncestorsAndSelf().OfType<LocalFunctionStatementSyntax>().FirstOrDefault())
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (3)
79LocalFunctionStatementSyntax localFunction => FixLocalFunction(keepVoid, methodSymbol, localFunction, knownTypes, cancellationToken), 97private static LocalFunctionStatementSyntax FixLocalFunction( 100LocalFunctionStatementSyntax localFunction,
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (2)
37case LocalFunctionStatementSyntax localFunction: return FixLocalFunction(methodSymbol, localFunction, knownTypes); 50private static SyntaxNode FixLocalFunction(IMethodSymbol methodSymbol, LocalFunctionStatementSyntax localFunction, KnownTaskTypes knownTypes)
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
146LocalFunctionStatementSyntax localFunction =>
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\CSharpRemoveAsyncModifierCodeFixProvider.cs (2)
42LocalFunctionStatementSyntax localFunction => localFunction.WithBody(block).WithExpressionBody(null).WithSemicolonToken(default), 55LocalFunctionStatementSyntax localFunction => RemoveAsyncModifierHelpers.WithoutAsyncModifier(localFunction, localFunction.ReturnType),
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (1)
18internal static SyntaxNode WithoutAsyncModifier(LocalFunctionStatementSyntax localFunction, TypeSyntax returnType)
src\Analyzers\CSharp\CodeFixes\RemoveUnusedLocalFunction\CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs (1)
52.Select(t => t.GetAncestor<LocalFunctionStatementSyntax>());
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
197private static LocalFunctionStatementSyntax CreateLocalFunctionStatement(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (3)
490else if (destinationMember is LocalFunctionStatementSyntax localFunctionStatement) 589TDeclarationNode destinationMember, IEnumerable<SyntaxNode> statements, LocalFunctionStatementSyntax localFunctionStatement) where TDeclarationNode : SyntaxNode 601var finalMember = localFunctionStatement
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (8)
91public static LocalFunctionStatementSyntax GenerateLocalFunctionDeclaration( 97var reusableSyntax = GetReuseableSyntaxNodeForSymbol<LocalFunctionStatementSyntax>(method, info); 103var declaration = GenerateLocalFunctionDeclarationWorker( 139private static LocalFunctionStatementSyntax GenerateLocalFunctionDeclarationWorker( 143var localFunctionDeclaration = LocalFunctionStatement( 176private static LocalFunctionStatementSyntax UseExpressionBodyIfDesired( 177CSharpCodeGenerationContextInfo info, LocalFunctionStatementSyntax localFunctionDeclaration, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
507targetToken.GetAncestors<LocalFunctionStatementSyntax>().Any(f => f.GetModifiers().Any(SyntaxKind.UnsafeKeyword))) ||
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
1130MethodDeclarationSyntax or LocalFunctionStatementSyntax or ConstructorDeclarationSyntax or DelegateDeclarationSyntax or TypeDeclarationSyntax => true,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
172if (name.IsFoundUnder<LocalFunctionStatementSyntax>(d => d.ReturnType) ||
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (1)
35LocalFunctionStatementSyntax or
Microsoft.CodeAnalysis.CSharp.EditorFeatures (8)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (2)
328or LocalFunctionStatementSyntax 404or LocalFunctionStatementSyntax
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (6)
467LocalFunctionStatementSyntax localFunctionStatementNode => ShouldAddBraceForLocalFunctionStatement(localFunctionStatementNode, caretPosition), 522private static bool ShouldAddBraceForLocalFunctionStatement(LocalFunctionStatementSyntax localFunctionStatementNode, int caretPosition) 752if (node is LocalFunctionStatementSyntax { Body: { } localFunctionBody }) 877LocalFunctionStatementSyntax localFunctionStatementNode => AddBlockToLocalFunctionDeclaration(localFunctionStatementNode, formattingOptions), 913private static LocalFunctionStatementSyntax AddBlockToLocalFunctionDeclaration( 914LocalFunctionStatementSyntax localFunctionStatementNode,
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (31)
RefactoringHelpers\RefactoringHelpersTests.cs (31)
32await TestAsync<LocalFunctionStatementSyntax>(testText); 50await TestAsync<LocalFunctionStatementSyntax>(testText); 68await TestAsync<LocalFunctionStatementSyntax>(testText); 87await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 105await TestAsync<LocalFunctionStatementSyntax>(testText); 123await TestAsync<LocalFunctionStatementSyntax>(testText); 144await TestAsync<LocalFunctionStatementSyntax>(testText); 162await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 183await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 204await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 223await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 241await TestAsync<LocalFunctionStatementSyntax>(testText); 260await TestAsync<LocalFunctionStatementSyntax>(testText); 280await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 299await TestAsync<LocalFunctionStatementSyntax>(testText); 319await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 416await TestAsync<LocalFunctionStatementSyntax>(testText); 434await TestAsync<LocalFunctionStatementSyntax>(testText); 452await TestAsync<LocalFunctionStatementSyntax>(testText); 470await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 488await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 506await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 524await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 542await TestAsync<LocalFunctionStatementSyntax>(testText); 564await TestAsync<LocalFunctionStatementSyntax>(testText); 584await TestAsync<LocalFunctionStatementSyntax>(testText); 604await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 624await TestMissingAsync<LocalFunctionStatementSyntax>(testText); 1235await TestAsync<LocalFunctionStatementSyntax>(testText); 1260await TestAsync<LocalFunctionStatementSyntax>(testText); 1281await TestMissingAsync<LocalFunctionStatementSyntax>(testText);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (8)
CodeGen\CodeGenLocalFunctionTests.cs (8)
146var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 5749.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 5824.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 5897var localFunctions = syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList(); 5905void checkImplAttributes(LocalFunctionStatementSyntax localFunctionStatement, MethodImplAttributes expectedFlags) 6162var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (7)
Attributes\AttributeTests_WellKnownAttributes.cs (2)
5768var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
RefStructInterfacesTests.cs (2)
21244var localFunctions = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 21247foreach (var localFunction in localFunctions)
Semantics\OutVarTests.cs (3)
36368Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single())); 36450Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single())); 36523Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single()));
Microsoft.CodeAnalysis.CSharp.Features (90)
ChangeSignature\CSharpChangeSignatureService.cs (1)
330if (updatedNode is LocalFunctionStatementSyntax localFunction)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (3)
39var localFunction = await context.TryGetRelevantNodeAsync<LocalFunctionStatementSyntax>().ConfigureAwait(false); 69LocalFunctionStatementSyntax localFunction, 275MethodDeclarationSyntax method, LocalFunctionStatementSyntax localFunction)
Completion\CompletionProviders\AwaitCompletionProvider.cs (2)
43LocalFunctionStatementSyntax local => local.ReturnType.SpanStart, 65if (parent is NameSyntax { Parent: LocalFunctionStatementSyntax localFunction } name &&
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
334result = IsLastTokenOfType<LocalFunctionStatementSyntax>(token, semanticModel,
Completion\KeywordRecommenders\MethodKeywordRecommender.cs (1)
29or LocalFunctionStatementSyntax
Completion\KeywordRecommenders\WhereKeywordRecommender.cs (1)
81else if (tokenParent.Parent is LocalFunctionStatementSyntax { TypeParameterList.Parameters.Count: > 0 })
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
582var localFunctionDeclaration = LocalFunctionStatement(
EditAndContinue\BreakpointSpans.cs (2)
419var localFunction = (LocalFunctionStatementSyntax)node;
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (5)
483if (root is LocalFunctionStatementSyntax localFunc) 1475=> node is LocalFunctionStatementSyntax { TypeParameterList: not null }; 1478=> node is AnonymousFunctionExpressionSyntax or LocalFunctionStatementSyntax; 1841var lfd = (LocalFunctionStatementSyntax)node;
EditAndContinue\SyntaxComparer.cs (2)
1018var localFunction = (LocalFunctionStatementSyntax)nestedFunction;
EditAndContinue\SyntaxUtilities.cs (1)
224LocalFunctionStatementSyntax localFunction => localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword),
ExtractMethod\CSharpMethodExtractor.cs (1)
77if (currentNode is LocalFunctionStatementSyntax localFunction)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (6)
654LocalFunctionStatementSyntax localFunction => TweakNewLinesInMethod(localFunction), 667private static LocalFunctionStatementSyntax TweakNewLinesInMethod(LocalFunctionStatementSyntax method) 715var nodeIsMethodOrLocalFunction = syntaxNode is MethodDeclarationSyntax or LocalFunctionStatementSyntax; 723var returnType = syntaxNode is MethodDeclarationSyntax method ? method.ReturnType : ((LocalFunctionStatementSyntax)syntaxNode).ReturnType; 734LocalFunctionStatementSyntax _ => true,
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (3)
39var isMethodOrLocalFunction = method is MethodDeclarationSyntax or LocalFunctionStatementSyntax; 50var isMethodOrLocalFunction = method is MethodDeclarationSyntax or LocalFunctionStatementSyntax; 140LocalFunctionStatementSyntax localFunctionDeclaration => (localFunctionDeclaration.Body, localFunctionDeclaration.ExpressionBody, localFunctionDeclaration.SemicolonToken),
ExtractMethod\CSharpSelectionResult.cs (1)
98LocalFunctionStatementSyntax)
ExtractMethod\CSharpSelectionResult.StatementResult.cs (1)
53LocalFunctionStatementSyntax or
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (1)
73LocalFunctionStatementSyntax localFunction => TryAddAsyncModifier(localFunction.Modifiers, spans),
InitializeParameter\InitializeParameterHelpers.cs (3)
28or LocalFunctionStatementSyntax 35LocalFunctionStatementSyntax localFunction => (SyntaxNode?)localFunction.Body ?? localFunction.ExpressionBody!, 44LocalFunctionStatementSyntax localFunction => localFunction.SemicolonToken,
IntroduceVariable\CSharpIntroduceVariableService.cs (1)
145var localFunction = expression.GetAncestor<LocalFunctionStatementSyntax>();
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (3)
275case LocalFunctionStatementSyntax localFunction: 300var localFunction = block.GetAncestor<LocalFunctionStatementSyntax>(); 393var localFunctionIdentifiers = localFunctions.Select(node => ((LocalFunctionStatementSyntax)node).Identifier.ValueText);
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (2)
71case LocalFunctionStatementSyntax: 98LocalFunctionStatementSyntax or AccessorDeclarationSyntax or MemberDeclarationSyntax
MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeRefactoringProvider.cs (1)
33var localFunction = await context.TryGetRelevantNodeAsync<LocalFunctionStatementSyntax>().ConfigureAwait(false);
src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticDiagnosticAnalyzer.cs (2)
38var localFunction = (LocalFunctionStatementSyntax)context.Node;
src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticHelper.cs (5)
17private static bool TryGetDataFlowAnalysis(LocalFunctionStatementSyntax localFunction, SemanticModel semanticModel, [NotNullWhen(returnValue: true)] out DataFlowAnalysis? dataFlow) 23private static bool CanBeCalledFromStaticContext(LocalFunctionStatementSyntax localFunction, DataFlowAnalysis dataFlow) 30static bool IsChildOrSelf(LocalFunctionStatementSyntax containingLocalFunction, ISymbol calledLocationFunction) 38public static bool CanMakeLocalFunctionStaticBecauseNoCaptures(LocalFunctionStatementSyntax localFunction, SemanticModel semanticModel) 43public static bool CanMakeLocalFunctionStaticByRefactoringCaptures(LocalFunctionStatementSyntax localFunction, SemanticModel semanticModel, out ImmutableArray<ISymbol> captures)
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForLocalFunctionHelper.cs (11)
18UseExpressionBodyHelper<LocalFunctionStatementSyntax> 35protected override BlockSyntax GetBody(LocalFunctionStatementSyntax statement) 38protected override ArrowExpressionClauseSyntax GetExpressionBody(LocalFunctionStatementSyntax statement) 41protected override SyntaxToken GetSemicolonToken(LocalFunctionStatementSyntax statement) 44protected override LocalFunctionStatementSyntax WithSemicolonToken(LocalFunctionStatementSyntax statement, SyntaxToken token) 47protected override LocalFunctionStatementSyntax WithExpressionBody(LocalFunctionStatementSyntax statement, ArrowExpressionClauseSyntax expressionBody) 50protected override LocalFunctionStatementSyntax WithBody(LocalFunctionStatementSyntax statement, BlockSyntax body) 54SemanticModel semanticModel, LocalFunctionStatementSyntax statement)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
105LocalFunctionStatementSyntax localFunction => localFunction.ReturnType,
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
220while (index + 1 < statements.Count && statements[index + 1] is LocalFunctionStatementSyntax)
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAboveReturnCodeFixProvider.cs (1)
48if (exprOrStatement is LocalFunctionStatementSyntax { ExpressionBody: { } localFunctionExpressionBody })
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAtStartCodeFixProvider.cs (1)
33if (location is LocalFunctionStatementSyntax { ExpressionBody: { } })
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
148LocalFunctionStatementSyntax localFunction => (localFunction.ReturnType, localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword)),
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (4)
30LocalFunctionStatementSyntax localFunction, 42LocalFunctionStatementSyntax localFunction, 175var localFunctionWithNewParameters = (LocalFunctionStatementSyntax)info.Service.AddParameters(
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (2)
65Func<Document, LocalFunctionStatementSyntax, ImmutableArray<ISymbol>, Task> fixer, 77.Select(d => root.FindNode(d.Location.SourceSpan).AncestorsAndSelf().OfType<LocalFunctionStatementSyntax>().FirstOrDefault())
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (3)
79LocalFunctionStatementSyntax localFunction => FixLocalFunction(keepVoid, methodSymbol, localFunction, knownTypes, cancellationToken), 97private static LocalFunctionStatementSyntax FixLocalFunction( 100LocalFunctionStatementSyntax localFunction,
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (2)
37case LocalFunctionStatementSyntax localFunction: return FixLocalFunction(methodSymbol, localFunction, knownTypes); 50private static SyntaxNode FixLocalFunction(IMethodSymbol methodSymbol, LocalFunctionStatementSyntax localFunction, KnownTaskTypes knownTypes)
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
146LocalFunctionStatementSyntax localFunction =>
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\CSharpRemoveAsyncModifierCodeFixProvider.cs (2)
42LocalFunctionStatementSyntax localFunction => localFunction.WithBody(block).WithExpressionBody(null).WithSemicolonToken(default), 55LocalFunctionStatementSyntax localFunction => RemoveAsyncModifierHelpers.WithoutAsyncModifier(localFunction, localFunction.ReturnType),
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (1)
18internal static SyntaxNode WithoutAsyncModifier(LocalFunctionStatementSyntax localFunction, TypeSyntax returnType)
src\Analyzers\CSharp\CodeFixes\RemoveUnusedLocalFunction\CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs (1)
52.Select(t => t.GetAncestor<LocalFunctionStatementSyntax>());
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
197private static LocalFunctionStatementSyntax CreateLocalFunctionStatement(
src\Compilers\CSharp\Portable\Syntax\LambdaUtilities.cs (7)
116return GetLocalFunctionBody((LocalFunctionStatementSyntax)newLambda); 127LocalFunctionStatementSyntax localFunctionStatementSyntax => (CSharpSyntaxNode?)localFunctionStatementSyntax.Body ?? localFunctionStatementSyntax.ExpressionBody!.Expression, 156var localFunction = (LocalFunctionStatementSyntax)parent; 161return arrowExpressionClause.Expression == node && arrowExpressionClause.Parent is LocalFunctionStatementSyntax; 350lambdaBody1 = GetLocalFunctionBody((LocalFunctionStatementSyntax)node); 484private static SyntaxNode? GetLocalFunctionBody(LocalFunctionStatementSyntax localFunctionStatementSyntax)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (6)
EditAndContinue\SyntaxUtilitiesTests.cs (6)
189var f1 = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f1"); 190var f2 = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f2"); 255var f = m2.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f");
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (18)
IOperation\IOperationTests_ILocalFunctionStatement.cs (17)
49VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 77VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 105VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 140VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 181VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 217VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 266VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics, targetFramework: TargetFramework.Mscorlib46Extended); 295VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 331VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 365VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 404VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 436VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 468VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 503VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 547VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 640VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 703VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_IParameterReferenceExpression.cs (1)
1119VerifyOperationTreeAndDiagnosticsForTest<LocalFunctionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (54)
Semantics\InitOnlyMemberTests.cs (2)
4143var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
Semantics\LocalFunctionTests.cs (17)
493var localFunction = tree.GetRoot().DescendantNodes() 494.OfType<LocalFunctionStatementSyntax>() 541var localFunction = tree.GetRoot().DescendantNodes() 542.OfType<LocalFunctionStatementSyntax>() 805var localFunction = tree.GetRoot().DescendantNodes() 806.OfType<LocalFunctionStatementSyntax>() 852var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 968var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 2373LocalFunctionStatementSyntax declaration = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First(); 2587var exprs = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToImmutableArray(); 5105var localDecl = (LocalFunctionStatementSyntax)tree.FindNodeOrTokenByKind(SyntaxKind.LocalFunctionStatement).AsNode(); 10385var localFunction = root.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
Semantics\NullableReferenceTypesTests.cs (10)
65890var function1 = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Last(); 65894var function2 = tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 97757var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 99086var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 111770var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>(); 111775void verifyLocalFunction(LocalFunctionStatementSyntax localSyntax, string expectedName, string[] expectedConstraintTypes) 111824var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>(); 111828void verifyLocalFunction(LocalFunctionStatementSyntax localSyntax, string expectedName, string[] expectedConstraintTypes)
Semantics\RefFieldTests.cs (1)
11025var decls = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray();
Semantics\TopLevelStatementsTests.cs (18)
235var localDecl = unit1.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 358var localDecl = unit2.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 2084var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 2248var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4215var declarator = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4510var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()); 4516var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4574var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4578var symbol2 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Skip(1).First()); 4623var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 6086var localFunctions = syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList(); 6094void checkImplAttributes(LocalFunctionStatementSyntax localFunctionStatement, MethodImplAttributes expectedFlags) 6160.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single())
SourceGeneration\GeneratorDriverTests_Attributes_FullyQualifiedName.cs (6)
326var input = ctx.ForAttributeWithMetadataName<LocalFunctionStatementSyntax>("System.CLSCompliantAttribute"); 335step => Assert.True(step.Outputs.Single().Value is LocalFunctionStatementSyntax { Identifier.ValueText: "LocalFunc" })); 362var input = ctx.ForAttributeWithMetadataName<LocalFunctionStatementSyntax>("System.CLSCompliantAttribute"); 371step => Assert.True(step.Outputs.Single().Value is LocalFunctionStatementSyntax { Identifier.ValueText: "LocalFunc" })); 401var input = ctx.ForAttributeWithMetadataName<LocalFunctionStatementSyntax>("System.CLSCompliantAttribute"); 410step => Assert.True(step.Outputs.Single().Value is LocalFunctionStatementSyntax { Identifier.ValueText: "LocalFunc" }));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (23)
Symbols\LocalFunctionTests.cs (7)
35var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 56var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 77var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 100var localsSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray();
Symbols\Source\NullablePublicAPITests.cs (16)
570return syntaxTree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.LocalFunctionStatementSyntax>().Select(func => semanticModel.GetDeclaredSymbol(func)).Cast<IMethodSymbol>().ToArray(); 3664var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 3697var localFunctionBody = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 3876var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4062var localFunction = root.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4117var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4179var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().First(); 4181var nestedLocalFunction = (IMethodSymbol)model.GetDeclaredSymbol(lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().ElementAt(1)); 4933var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (18)
Generated\Syntax.Test.xml.Generated.cs (5)
10556private static LocalFunctionStatementSyntax GenerateLocalFunctionStatement() 12250var node = GenerateLocalFunctionStatement(); 12262var newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithReturnType(node.ReturnType).WithIdentifier(node.Identifier).WithTypeParameterList(node.TypeParameterList).WithParameterList(node.ParameterList).WithConstraintClauses(node.ConstraintClauses).WithBody(node.Body).WithExpressionBody(node.ExpressionBody).WithSemicolonToken(node.SemicolonToken); 16933var oldNode = GenerateLocalFunctionStatement(); 16949var oldNode = GenerateLocalFunctionStatement();
IncrementalParsing\IncrementalParsingTests.cs (2)
565var localFunc1 = tree.GetRoot().DescendantNodesAndSelf().Single(n => n is LocalFunctionStatementSyntax); 582var localFunc2 = tree.GetRoot().DescendantNodesAndSelf().Single(n => n is LocalFunctionStatementSyntax);
Parsing\LocalFunctionParsingTests.cs (6)
1297var s1 = Assert.IsType<LocalFunctionStatementSyntax>(m.Body.Statements[0]); 1301s1 = Assert.IsType<LocalFunctionStatementSyntax>(m.Body.Statements[0]); 1349var s1 = Assert.IsType<LocalFunctionStatementSyntax>(m.Body.Statements[0]); 1359s1 = Assert.IsType<LocalFunctionStatementSyntax>(m2.Body.Statements[0]);
Parsing\ParserErrorMessageTests.cs (3)
3773var localFunctionStatement = (LocalFunctionStatementSyntax)tree.GetRoot().DescendantNodes().Single(node => node is LocalFunctionStatementSyntax);
Syntax\SyntaxNodeTests.cs (2)
3270var method = (LocalFunctionStatementSyntax)((GlobalStatementSyntax)root.Members[0]).Statement;
Microsoft.CodeAnalysis.CSharp.Workspaces (39)
Classification\ClassificationHelpers.cs (1)
218else if (token.Parent is LocalFunctionStatementSyntax localFunctionStatement && localFunctionStatement.Identifier == token)
CodeGeneration\CSharpSyntaxGenerator.cs (8)
1657LocalFunctionStatementSyntax localFunc => localFunc.WithModifiers(modifiers), 2245return ((LocalFunctionStatementSyntax)declaration).WithParameterList((ParameterListSyntax)list); 2309var local = (LocalFunctionStatementSyntax)declaration; 2365var local = (LocalFunctionStatementSyntax)declaration; 2487SyntaxKind.LocalFunctionStatement => ((LocalFunctionStatementSyntax)declaration).Body?.Statements, 2519return ((LocalFunctionStatementSyntax)declaration).WithBody(somebody).WithSemicolonToken(semicolon).WithExpressionBody(null);
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (2)
184if (node.AsNode() is LocalFunctionStatementSyntax localFunction) 500private static string GetMethodSuffix(LocalFunctionStatementSyntax method)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (3)
18var localFunctionStatement = destinationBlock.FirstAncestorOrSelf<LocalFunctionStatementSyntax>(); 38case LocalFunctionStatementSyntax localFunctionStatement:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
468public static IMethodSymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, LocalFunctionStatementSyntax syntax, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (5)
151LocalFunctionStatementSyntax localFunction => localFunction.ParameterList, 280=> node is MethodDeclarationSyntax or AnonymousFunctionExpressionSyntax or LocalFunctionStatementSyntax; 343case LocalFunctionStatementSyntax localFunction when localFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 743LocalFunctionStatementSyntax localFunction => localFunction.Modifiers, 755LocalFunctionStatementSyntax localFunction => localFunction.WithModifiers(modifiers),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
470else if (currentToken.Parent is LocalFunctionStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
212if (node is AnonymousFunctionExpressionSyntax or LocalFunctionStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
314LocalFunctionStatementSyntax localFunc => localFunc.Modifiers,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpHeaderFacts.cs (1)
79var node = TryGetAncestorForLocation<LocalFunctionStatementSyntax>(root, position);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (3)
490else if (destinationMember is LocalFunctionStatementSyntax localFunctionStatement) 589TDeclarationNode destinationMember, IEnumerable<SyntaxNode> statements, LocalFunctionStatementSyntax localFunctionStatement) where TDeclarationNode : SyntaxNode 601var finalMember = localFunctionStatement
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (8)
91public static LocalFunctionStatementSyntax GenerateLocalFunctionDeclaration( 97var reusableSyntax = GetReuseableSyntaxNodeForSymbol<LocalFunctionStatementSyntax>(method, info); 103var declaration = GenerateLocalFunctionDeclarationWorker( 139private static LocalFunctionStatementSyntax GenerateLocalFunctionDeclarationWorker( 143var localFunctionDeclaration = LocalFunctionStatement( 176private static LocalFunctionStatementSyntax UseExpressionBodyIfDesired( 177CSharpCodeGenerationContextInfo info, LocalFunctionStatementSyntax localFunctionDeclaration, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
507targetToken.GetAncestors<LocalFunctionStatementSyntax>().Any(f => f.GetModifiers().Any(SyntaxKind.UnsafeKeyword))) ||
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
1130MethodDeclarationSyntax or LocalFunctionStatementSyntax or ConstructorDeclarationSyntax or DelegateDeclarationSyntax or TypeDeclarationSyntax => true,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
172if (name.IsFoundUnder<LocalFunctionStatementSyntax>(d => d.ReturnType) ||
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (1)
35LocalFunctionStatementSyntax or
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2)
CodeGeneration\SyntaxGeneratorTests.cs (2)
3305var local = LocalFunctionStatement(PredefinedType(VoidKeyword), "p"); 3341var local = LocalFunctionStatement(PredefinedType(VoidKeyword), "p");
Microsoft.CodeAnalysis.Features.UnitTests (1)
FindUsages\DefinitionItemFactoryTests.cs (1)
1452var f = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().Single(n => n is LocalFunctionStatementSyntax));
Microsoft.Interop.LibraryImportGenerator (3)
LibraryImportGenerator.cs (3)
364LocalFunctionStatementSyntax dllImport = CreateTargetDllImportAsLocalStatement( 432private static LocalFunctionStatementSyntax CreateTargetDllImportAsLocalStatement( 442LocalFunctionStatementSyntax localDllImport = LocalFunctionStatement(returnType, stubTargetName)
Microsoft.Interop.LibraryImportGenerator.Downlevel (3)
DownlevelLibraryImportGenerator.cs (3)
259LocalFunctionStatementSyntax dllImport = CreateTargetDllImportAsLocalStatement( 311private static LocalFunctionStatementSyntax CreateTargetDllImportAsLocalStatement( 318LocalFunctionStatementSyntax localDllImport = LocalFunctionStatement(returnType, stubTargetName)
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
574if (ancestorNode is LocalFunctionStatementSyntax)