142 references to LocalFunction
ILLink.RoslynAnalyzer (3)
DataFlow\LocalDataFlowAnalysis.cs (1)
82 methodSymbol.MethodKind is not (MethodKind.LambdaMethod or MethodKind.LocalFunction));
DataFlow\LocalDataFlowVisitor.cs (2)
574 Debug.Assert (localFunction.MethodKind == MethodKind.LocalFunction); 824 Debug.Assert (localFunction.MethodKind == MethodKind.LocalFunction);
Microsoft.CodeAnalysis (3)
Operations\ControlFlowGraph.cs (1)
57Debug.Assert(method.MethodKind == MethodKind.LocalFunction);
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (2)
98Debug.Assert(symbol.MethodKind == MethodKind.LocalFunction); 117Debug.Assert(others.All(((IMethodSymbol m, ILocalFunctionOperation _) tuple) => tuple.m.MethodKind == MethodKind.LocalFunction));
Microsoft.CodeAnalysis.CodeStyle (18)
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (1)
149return symbol == null || symbol.IsStatic || symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction };
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
292if (((IMethodSymbol)symbolInfo.Symbol).MethodKind == MethodKind.LocalFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (2)
214=> symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction }; 241=> symbol is IMethodSymbol { MethodKind: MethodKind.Ordinary or MethodKind.LocalFunction };
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
339case MethodKind.LocalFunction:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (2)
131private static readonly SymbolKindOrTypeKind _localFunction = new(MethodKind.LocalFunction); 368case MethodKind.LocalFunction:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (1)
49MethodKind.LocalFunction;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (2)
76new SymbolKindOrTypeKind(MethodKind.LocalFunction), 175case MethodKind.LocalFunction:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (2)
73/// cref="IRangeVariableSymbol"/> and <see cref="MethodKind.LocalFunction"/> <see cref="IMethodSymbol"/>s can also 319IMethodSymbol { MethodKind: MethodKind.LocalFunction } => true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
385case MethodKind.LocalFunction:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (4)
407if (methodSymbol.MethodKind == MethodKind.LocalFunction && newMethodSymbol.MethodKind == MethodKind.LocalFunction) 477if (symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } methodSymbol && 478newSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } newMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (1)
196MethodKind.LocalFunction)
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (2)
src\Features\DiagnosticsTestUtilities\NamingStyles\NamingStylesTestOptionSets.cs (2)
549ImmutableArray.Create(new SymbolSpecification.SymbolKindOrTypeKind(MethodKind.LocalFunction)), 767new SymbolSpecification.SymbolKindOrTypeKind(MethodKind.LocalFunction)),
Microsoft.CodeAnalysis.CSharp (51)
Binder\Binder_Expressions.cs (2)
1941return (containingMethod.MethodKind == MethodKind.AnonymousFunction || containingMethod.MethodKind == MethodKind.LocalFunction) && !IsInsideNameof; // false in EE evaluation method 2134this.ContainingMemberOrLambda is MethodSymbol { MethodKind: MethodKind.AnonymousFunction or MethodKind.LocalFunction } &&
Binder\Binder_Invocation.cs (2)
798if (result is null && finalApplicableCandidates[0].LeastOverriddenMember.MethodKind != MethodKind.LocalFunction) 889if (singleCandidate.MethodKind != MethodKind.LocalFunction)
Binder\InMethodBinder.cs (3)
87internal override bool IsNestedFunctionBinder => _methodSymbol.MethodKind == MethodKind.LocalFunction; 272if (((MethodSymbol)newSymbol).MethodKind == MethodKind.LocalFunction) 300if (((MethodSymbol)newSymbol).MethodKind == MethodKind.LocalFunction)
Binder\MethodGroupResolution.cs (1)
88MethodGroup.Methods[0].MethodKind == MethodKind.LocalFunction;
Binder\Semantics\AccessCheck.cs (1)
196case SymbolKind.Method when ((MethodSymbol)symbol).MethodKind == MethodKind.LocalFunction:
FlowAnalysis\AbstractFlowPass.cs (1)
1518Debug.Assert(method?.OriginalDefinition.MethodKind != MethodKind.LocalFunction);
FlowAnalysis\DefiniteAssignment.cs (2)
2372currentMethod.MethodKind == MethodKind.LocalFunction) && 2414if (method.MethodKind == MethodKind.LocalFunction)
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (1)
163((MethodSymbol)symbol).MethodKind == MethodKind.LocalFunction)
FlowAnalysis\DefiniteAssignment.VariableIdentifier.cs (1)
36SymbolKind.Method when symbol is MethodSymbol m && m.MethodKind == MethodKind.LocalFunction => true,
FlowAnalysis\NullableWalker.cs (2)
2132while (enclosingMemberMethod?.MethodKind is MethodKind.AnonymousFunction or MethodKind.LocalFunction) 8180if (((MethodSymbol)symbol).MethodKind == MethodKind.LocalFunction)
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (2)
460if (node.Method.MethodKind == MethodKind.LocalFunction) 471if (node.MethodOpt?.MethodKind == MethodKind.LocalFunction)
Lowering\ClosureConversion\ClosureConversion.cs (6)
203(localOrParameter as MethodSymbol)?.MethodKind == MethodKind.LocalFunction); 858var loweredSymbol = (node.Method.MethodKind is MethodKind.LambdaMethod or MethodKind.LocalFunction) ? 876Debug.Assert(localFunc.MethodKind == MethodKind.LocalFunction); 1071if (node.Method.MethodKind == MethodKind.LocalFunction) 1338if (node.MethodOpt?.MethodKind == MethodKind.LocalFunction) 1364if (node.TargetMethod.MethodKind == MethodKind.LocalFunction)
Lowering\DiagnosticsPass_ExpressionTrees.cs (4)
197var diagnostic = _staticLocalOrAnonymousFunction.MethodKind == MethodKind.LocalFunction 212var diagnostic = _staticLocalOrAnonymousFunction.MethodKind == MethodKind.LocalFunction 343else if (method.MethodKind == MethodKind.LocalFunction) 880if ((node.LookupSymbolOpt as MethodSymbol)?.MethodKind == MethodKind.LocalFunction)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
143Debug.Assert(method.MethodKind != MethodKind.LocalFunction && method.MethodKind != MethodKind.AnonymousFunction);
Lowering\LocalRewriter\DelegateCacheRewriter.cs (1)
129if (targetMethod.MethodKind == MethodKind.LocalFunction)
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (3)
155node.Method.MethodKind == MethodKind.LocalFunction || 216if (conversion.Method.MethodKind == MethodKind.LocalFunction) 240node.MethodOpt?.MethodKind == MethodKind.LocalFunction;
Lowering\SyntheticBoundNodeFactory.cs (2)
73value.MethodKind != MethodKind.LocalFunction) 142CurrentFunction.MethodKind == MethodKind.LocalFunction ||
SymbolDisplay\SymbolDisplayVisitor.cs (1)
381return ((IMethodSymbol)symbol).MethodKind == MethodKind.LocalFunction;
SymbolDisplay\SymbolDisplayVisitor.Members.cs (2)
378if (symbol.MethodKind == MethodKind.LocalFunction) 417case MethodKind.LocalFunction:
Symbols\MethodSymbol.cs (2)
615case MethodKind.LocalFunction: 1040if (!IsStatic || IsAbstract || IsVirtual || MethodKind is not (MethodKind.Ordinary or MethodKind.LocalFunction))
Symbols\PublicModel\MethodSymbol.cs (2)
69case MethodKind.LocalFunction: 70return MethodKind.LocalFunction;
Symbols\Source\LocalFunctionSymbol.cs (1)
326public override MethodKind MethodKind => MethodKind.LocalFunction;
Symbols\Source\ParameterHelpers.cs (1)
213methodOwner?.MethodKind == MethodKind.LocalFunction;
Symbols\Source\SourceMemberContainerSymbol.cs (1)
4069case MethodKind.LocalFunction:
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
744else if (this is { MethodKind: MethodKind.LocalFunction, IsStatic: false })
Symbols\Symbol.cs (2)
670case MethodKind.LocalFunction: 731case MethodKind.LocalFunction:
Symbols\Symbol_Attributes.cs (1)
673Debug.Assert(!binder.InAttributeArgument || this is MethodSymbol { MethodKind: MethodKind.LambdaMethod or MethodKind.LocalFunction }, "Possible cycle in attribute binding");
Symbols\SymbolExtensions.cs (2)
150if (method.MethodKind != MethodKind.AnonymousFunction && method.MethodKind != MethodKind.LocalFunction) break; 170if (method.MethodKind == MethodKind.AnonymousFunction || method.MethodKind == MethodKind.LocalFunction)
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
1166method.MethodKind is not (MethodKind.LocalFunction or MethodKind.LambdaMethod) &&
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
2017while (enclosingSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction or MethodKind.AnonymousFunction } method)
Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests (1)
src\Analyzers\CSharp\Tests\NamingStyles\NamingStylesTests.cs (1)
243[InlineData("void Outer() { void [|m|]() {} }", "void Outer() { void M() {} }", MethodKind.LocalFunction, Accessibility.NotApplicable)]
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (17)
Completion\CompletionProviders\DeclarationNameCompletionProviderTests.cs (1)
2958SpecificationStyle(new SymbolKindOrTypeKind(MethodKind.LocalFunction), "LocalFunction"),
Completion\CompletionProviders\DeclarationNameCompletionProviderTests_NameDeclarationInfoTests.cs (12)
127new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 166new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 589new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 609new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 631new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 651new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 671new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 693new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 713new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 733new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 753new SymbolKindOrTypeKind(MethodKind.LocalFunction)); 772new SymbolKindOrTypeKind(MethodKind.LocalFunction));
Diagnostics\NamingStyles\EditorConfigNamingStyleParserTests.cs (4)
120new SymbolKindOrTypeKind(MethodKind.LocalFunction) 310var expectedApplicableSymbolKindList = new[] { new SymbolKindOrTypeKind(MethodKind.LocalFunction) }; 344[InlineData("*", new object[] { SymbolKind.Namespace, TypeKind.Class, TypeKind.Struct, TypeKind.Interface, TypeKind.Enum, SymbolKind.Property, MethodKind.Ordinary, MethodKind.LocalFunction, SymbolKind.Field, SymbolKind.Event, TypeKind.Delegate, SymbolKind.Parameter, SymbolKind.TypeParameter, SymbolKind.Local })] 345[InlineData(null, new object[] { SymbolKind.Namespace, TypeKind.Class, TypeKind.Struct, TypeKind.Interface, TypeKind.Enum, SymbolKind.Property, MethodKind.Ordinary, MethodKind.LocalFunction, SymbolKind.Field, SymbolKind.Event, TypeKind.Delegate, SymbolKind.Parameter, SymbolKind.TypeParameter, SymbolKind.Local })]
Microsoft.CodeAnalysis.CSharp.Features (8)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (3)
175_ => [new SymbolKindOrTypeKind(SymbolKind.Local), new SymbolKindOrTypeKind(MethodKind.LocalFunction)], 540? [new SymbolKindOrTypeKind(MethodKind.LocalFunction)] : 541[new SymbolKindOrTypeKind(SymbolKind.Local), new SymbolKindOrTypeKind(MethodKind.LocalFunction)];
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (1)
1989MethodKind.LocalFunction => FeaturesResources.local_function,
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (3)
111methodKind: this.LocalFunction ? MethodKind.LocalFunction : MethodKind.Ordinary); 810var localFunctionPreferences = Options.NamingStyle.SymbolSpecifications.Where(symbol => symbol.AppliesTo(new SymbolSpecification.SymbolKindOrTypeKind(MethodKind.LocalFunction), CreateMethodModifiers(), null)); 813var localFunctionKind = new SymbolSpecification.SymbolKindOrTypeKind(MethodKind.LocalFunction);
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (1)
75methodGroup = methodGroup.Where(m => m.IsStatic || m is IMethodSymbol { MethodKind: MethodKind.LocalFunction });
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
src\Analyzers\CSharp\Tests\NamingStyles\NamingStylesTests.cs (1)
243[InlineData("void Outer() { void [|m|]() {} }", "void Outer() { void M() {} }", MethodKind.LocalFunction, Accessibility.NotApplicable)]
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\TopLevelStatementsTests.cs (1)
4221Assert.Equal(MethodKind.LocalFunction, ((IMethodSymbol)local).MethodKind);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (5)
SymbolDisplay\SymbolDisplayTests.cs (4)
6442Assert.Equal(MethodKind.LocalFunction, localSymbol.MethodKind); 6485Assert.Equal(MethodKind.LocalFunction, localSymbol.MethodKind); 6520Assert.Equal(MethodKind.LocalFunction, localSymbol.MethodKind); 6614Assert.Equal(MethodKind.LocalFunction, localSymbol.MethodKind);
Symbols\Source\NullablePublicAPITests.cs (1)
4134var localFunctionResult = lookupResults.OfType<IMethodSymbol>().First(m => m.MethodKind == MethodKind.LocalFunction);
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
1166method.MethodKind is not (MethodKind.LocalFunction or MethodKind.LambdaMethod) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
2017while (enclosingSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction or MethodKind.AnonymousFunction } method)
Microsoft.CodeAnalysis.Features (6)
Completion\Providers\AbstractContextVariableArgumentProvider.cs (1)
90while (enclosingSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction or MethodKind.AnonymousFunction })
InlineHints\AbstractInlineParameterNameHintsService.cs (1)
225if (parameter is not { ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.Ordinary or MethodKind.LocalFunction } method })
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (2)
85if (methodKind is not (MethodKind.Ordinary or MethodKind.LocalFunction or MethodKind.Constructor)) 171if (methodSymbol.MethodKind is not MethodKind.LocalFunction)
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (1)
149return symbol == null || symbol.IsStatic || symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction };
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
292if (((IMethodSymbol)symbolInfo.Symbol).MethodKind == MethodKind.LocalFunction)
Microsoft.CodeAnalysis.Test.Utilities (3)
Compilation\CompilationExtensions.cs (1)
383if ((parameterInitializerOperation.Parameter.ContainingSymbol as IMethodSymbol)?.MethodKind is not (MethodKind.LocalFunction or MethodKind.AnonymousFunction))
Compilation\ControlFlowGraphVerifier.cs (2)
1716if (method.MethodKind == MethodKind.LocalFunction) 1731if (method.MethodKind == MethodKind.LocalFunction)
Microsoft.CodeAnalysis.Workspaces (17)
FindSymbols\FindReferences\Finders\OrdinaryMethodReferenceFinder.cs (1)
20MethodKind.LocalFunction;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (2)
214=> symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction }; 241=> symbol is IMethodSymbol { MethodKind: MethodKind.Ordinary or MethodKind.LocalFunction };
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
339case MethodKind.LocalFunction:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (2)
131private static readonly SymbolKindOrTypeKind _localFunction = new(MethodKind.LocalFunction); 368case MethodKind.LocalFunction:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (1)
49MethodKind.LocalFunction;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (2)
76new SymbolKindOrTypeKind(MethodKind.LocalFunction), 175case MethodKind.LocalFunction:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (2)
73/// cref="IRangeVariableSymbol"/> and <see cref="MethodKind.LocalFunction"/> <see cref="IMethodSymbol"/>s can also 319IMethodSymbol { MethodKind: MethodKind.LocalFunction } => true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
385case MethodKind.LocalFunction:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (4)
407if (methodSymbol.MethodKind == MethodKind.LocalFunction && newMethodSymbol.MethodKind == MethodKind.LocalFunction) 477if (symbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } methodSymbol && 478newSymbol is IMethodSymbol { MethodKind: MethodKind.LocalFunction } newMethodSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (1)
196MethodKind.LocalFunction)
Microsoft.CodeAnalysis.Workspaces.UnitTests (2)
EditorConfigParsing\NamingStyleParserTests.cs (2)
163symbolKind => Assert.Equal(new SymbolKindOrTypeKind(MethodKind.LocalFunction), symbolKind), 240symbolKind => Assert.Equal(new SymbolKindOrTypeKind(MethodKind.LocalFunction), symbolKind));