1 instantiation of LocalFunctionSymbol
Microsoft.CodeAnalysis.CSharp (1)
Binder\LocalScopeBinder.cs (1)
347return new LocalFunctionSymbol(
138 references to LocalFunctionSymbol
Microsoft.CodeAnalysis.CSharp (138)
Binder\Binder.cs (1)
194internal virtual ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\Binder_Constraints.cs (1)
464LocalFunctionSymbol => null,
Binder\Binder_Statements.cs (4)
559var localSymbol = this.LookupLocalFunction(node.Identifier); 1853protected virtual LocalFunctionSymbol LookupLocalFunction(SyntaxToken nameToken) 4043internal virtual ImmutableArray<LocalFunctionSymbol> LocalFunctions 4047return ImmutableArray<LocalFunctionSymbol>.Empty;
Binder\BlockBinder.cs (2)
38protected override ImmutableArray<LocalFunctionSymbol> BuildLocalFunctions() 84internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\BuckStopsHereBinder.cs (2)
58protected override LocalFunctionSymbol? LookupLocalFunction(SyntaxToken nameToken) 181internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\CatchClauseBinder.cs (1)
55internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\EmbeddedStatementBinder.cs (4)
38protected override ImmutableArray<LocalFunctionSymbol> BuildLocalFunctions() 40ArrayBuilder<LocalFunctionSymbol> locals = null; 42return locals?.ToImmutableAndFree() ?? ImmutableArray<LocalFunctionSymbol>.Empty; 87internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\ExecutableCodeBinder.cs (1)
129if (((iterator as SourceMemberMethodSymbol)?.IsUnsafe == true || (iterator as LocalFunctionSymbol)?.IsUnsafe == true)
Binder\ExpressionListVariableBinder.cs (1)
51internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\ExpressionVariableBinder.cs (1)
44internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\FixedStatementBinder.cs (1)
70internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\ForEachLoopBinder.cs (1)
57internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\ForLoopBinder.cs (1)
150internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\InContainerBinder.cs (1)
141protected override LocalFunctionSymbol LookupLocalFunction(SyntaxToken nameToken)
Binder\InMethodBinder.cs (1)
64protected override LocalFunctionSymbol LookupLocalFunction(SyntaxToken nameToken)
Binder\LocalBinderFactory.cs (4)
409LocalFunctionSymbol match = FindLocalFunction(node, _enclosing); 440private static LocalFunctionSymbol FindLocalFunction(LocalFunctionStatementSyntax node, Binder enclosing) 442LocalFunctionSymbol match = null; 454foreach (var candidate in possibleScopeBinder.LocalFunctions)
Binder\LocalScopeBinder.cs (20)
22private ImmutableArray<LocalFunctionSymbol> _localFunctions; 53internal sealed override ImmutableArray<LocalFunctionSymbol> LocalFunctions 59ImmutableInterlocked.InterlockedCompareExchange(ref _localFunctions, BuildLocalFunctions(), default(ImmutableArray<LocalFunctionSymbol>)); 66protected virtual ImmutableArray<LocalFunctionSymbol> BuildLocalFunctions() 68return ImmutableArray<LocalFunctionSymbol>.Empty; 103private SmallDictionary<string, LocalFunctionSymbol> _lazyLocalFunctionsMap; 104private SmallDictionary<string, LocalFunctionSymbol> LocalFunctionsMap 296protected ImmutableArray<LocalFunctionSymbol> BuildLocalFunctions(SyntaxList<StatementSyntax> statements) 298ArrayBuilder<LocalFunctionSymbol> locals = null; 304return locals?.ToImmutableAndFree() ?? ImmutableArray<LocalFunctionSymbol>.Empty; 307internal void BuildLocalFunctions(StatementSyntax statement, ref ArrayBuilder<LocalFunctionSymbol> locals) 323locals = ArrayBuilder<LocalFunctionSymbol>.GetInstance(); 326var localSymbol = MakeLocalFunction(decl); 345protected LocalFunctionSymbol MakeLocalFunction(LocalFunctionStatementSyntax declaration) 401protected override LocalFunctionSymbol LookupLocalFunction(SyntaxToken nameToken) 403LocalFunctionSymbol result = null; 409foreach (var local in this.LocalFunctions) 454LocalFunctionSymbol localSymbol; 511declaredInThisScope |= newSymbolKind == SymbolKind.Method && this.LocalFunctions.Contains((LocalFunctionSymbol)newSymbol); 544LocalFunctionSymbol existingLocalFunction = null;
Binder\RefSafetyAnalysis.cs (1)
311var localFunction = node.Symbol;
Binder\ScriptLocalScopeBinder.cs (1)
47internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\SimpleLocalScopeBinder.cs (1)
35internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\SimpleProgramBinder.cs (4)
41protected override ImmutableArray<LocalFunctionSymbol> BuildLocalFunctions() 43ArrayBuilder<LocalFunctionSymbol>? locals = null; 53return locals?.ToImmutableAndFree() ?? ImmutableArray<LocalFunctionSymbol>.Empty; 105internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\SimpleProgramUnitBinder.cs (2)
31protected override ImmutableArray<LocalFunctionSymbol> BuildLocalFunctions() 70internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\SwitchBinder.cs (3)
146protected override ImmutableArray<LocalFunctionSymbol> BuildLocalFunctions() 148var builder = ArrayBuilder<LocalFunctionSymbol>.GetInstance(); 338internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\SwitchBinder_Patterns.cs (1)
44ImmutableArray<LocalFunctionSymbol> functions = GetDeclaredLocalFunctionsForScope(node);
Binder\UsingStatementBinder.cs (1)
316internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\WhileBinder.cs (1)
79internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\WithExternAliasesBinder.cs (1)
67protected sealed override LocalFunctionSymbol? LookupLocalFunction(SyntaxToken nameToken)
Binder\WithLambdaParametersBinder.cs (1)
175internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
Binder\WithUsingNamespacesAndTypesBinder.cs (1)
223protected override LocalFunctionSymbol? LookupLocalFunction(SyntaxToken nameToken)
BoundTree\Constructors.cs (1)
656: this(syntax, locals, ImmutableArray<LocalFunctionSymbol>.Empty, hasUnsafeModifier: false, instrumentation: null, statements, hasErrors)
Compilation\MemberSemanticModel.cs (5)
370LocalFunctionSymbol function = GetDeclaredLocalFunction(binder, ownerOfTypeParametersInScope.Identifier); 714internal LocalFunctionSymbol GetDeclaredLocalFunction(LocalFunctionStatementSyntax declarationSyntax) 716var originalSymbol = GetDeclaredLocalFunction(this.GetEnclosingBinder(GetAdjustedNodePosition(declarationSyntax)), declarationSyntax.Identifier); 735private static LocalFunctionSymbol GetDeclaredLocalFunction(Binder enclosingBinder, SyntaxToken declaredIdentifier) 739foreach (var localFunction in binder.LocalFunctions)
FlowAnalysis\AbstractFlowPass.cs (5)
1385if (node.Method?.OriginalDefinition is LocalFunctionSymbol localFunc) 1395protected void VisitLocalFunctionUse(LocalFunctionSymbol symbol, SyntaxNode syntax, bool isCall) 1402LocalFunctionSymbol symbol, 1617if (node.MethodOpt?.OriginalDefinition is LocalFunctionSymbol localFunc) 1746else if (node.SymbolOpt?.OriginalDefinition is LocalFunctionSymbol localFunc)
FlowAnalysis\AbstractFlowPass_LocalFunctions.cs (6)
43protected abstract TLocalFunctionState CreateLocalFunctionState(LocalFunctionSymbol symbol); 45private SmallDictionary<LocalFunctionSymbol, TLocalFunctionState>? _localFuncVarUsages = null; 47protected TLocalFunctionState GetOrCreateLocalFuncUsages(LocalFunctionSymbol localFunc) 49_localFuncVarUsages ??= new SmallDictionary<LocalFunctionSymbol, TLocalFunctionState>(); 59protected bool HasLocalFuncUsagesCreated(LocalFunctionSymbol localFunc) 73var localFuncSymbol = localFunc.Symbol;
FlowAnalysis\ControlFlowPass.cs (1)
77protected override LocalFunctionState CreateLocalFunctionState(LocalFunctionSymbol symbol) => new LocalFunctionState(UnreachableState());
FlowAnalysis\DefiniteAssignment.cs (9)
76private readonly PooledHashSet<LocalFunctionSymbol> _usedLocalFunctions = PooledHashSet<LocalFunctionSymbol>.GetInstance(); 764var localFunction = variable as LocalFunctionSymbol; 1890if (parameter is SourceComplexParameterSymbolBase { ContainingSymbol: LocalFunctionSymbol or LambdaSymbol } sourceComplexParam) 2332private void ReportUnusedVariables(ImmutableArray<LocalFunctionSymbol> locals) 2334foreach (var symbol in locals) 2340private void ReportIfUnused(LocalFunctionSymbol symbol) 2416_usedLocalFunctions.Add((LocalFunctionSymbol)method);
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (6)
26protected override LocalFunctionState CreateLocalFunctionState(LocalFunctionSymbol symbol) 36LocalFunctionSymbol localFunc, 95var localFunc = GetNearestLocalFunctionOpt(CurrentSymbol); 152var nearestLocalFunc = GetNearestLocalFunctionOpt(CurrentSymbol); 158private static LocalFunctionSymbol GetNearestLocalFunctionOpt(Symbol symbol) 165return (LocalFunctionSymbol)symbol;
FlowAnalysis\FlowAnalysisPass.cs (1)
176return body.Update(body.Locals, ImmutableArray<LocalFunctionSymbol>.Empty, body.HasUnsafeModifier, body.Instrumentation, builder.ToImmutableAndFree());
FlowAnalysis\NullableWalker.cs (11)
3151var localFunc = node.Symbol; 3268bool isLocalFunction = lambdaOrFunctionSymbol is LocalFunctionSymbol; 3289enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.State); 3339var method = (LocalFunctionSymbol)_symbol; 3348LocalFunctionSymbol symbol, 3357private void VisitLocalFunctionUse(LocalFunctionSymbol symbol) 6917if (node is BoundCall { Method: { OriginalDefinition: LocalFunctionSymbol localFunction } }) 8849if (method?.OriginalDefinition is LocalFunctionSymbol localFunc) 9597if (node.MethodOpt?.OriginalDefinition is LocalFunctionSymbol localFunc) 12647protected override LocalFunctionState CreateLocalFunctionState(LocalFunctionSymbol symbol)
Generated\BoundNodes.xml.Generated.cs (12)
3304public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false) 3319public ImmutableArray<LocalFunctionSymbol> LocalFunctions { get; } 3326public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements) 3506public BoundLocalFunctionStatement(SyntaxNode syntax, LocalFunctionSymbol symbol, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false) 3517public LocalFunctionSymbol Symbol { get; } 3524public BoundLocalFunctionStatement Update(LocalFunctionSymbol symbol, BoundBlock? blockBody, BoundBlock? expressionBody) 3770public BoundSwitchStatement(SyntaxNode syntax, BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<LocalFunctionSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, GeneratedLabelSymbol breakLabel, bool hasErrors = false) 3792public ImmutableArray<LocalFunctionSymbol> InnerLocalFunctions { get; } 3801public BoundSwitchStatement Update(BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<LocalFunctionSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, GeneratedLabelSymbol breakLabel) 13354ImmutableArray<LocalFunctionSymbol> localFunctions = GetUpdatedArray(node, node.LocalFunctions); 13385LocalFunctionSymbol symbol = GetUpdatedSymbol(node, node.Symbol); 13394ImmutableArray<LocalFunctionSymbol> innerLocalFunctions = GetUpdatedArray(node, node.InnerLocalFunctions);
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (2)
39originalMethod is LocalFunctionSymbol 110Debug.Assert(!(originalMethod is LocalFunctionSymbol) || !originalMethod.IsStatic || IsStatic);
Lowering\DiagnosticsPass_ExpressionTrees.cs (2)
208Debug.Assert(symbol.Kind == SymbolKind.Local || symbol.Kind == SymbolKind.Parameter || symbol is LocalFunctionSymbol); 223if (method?.OriginalDefinition is LocalFunctionSymbol localFunction)
Lowering\LocalRewriter\LocalRewriter.cs (2)
384var localFunction = node.Symbol; 415static bool hasReturnTypeOrParameter(LocalFunctionSymbol localFunction, Func<TypeWithAnnotations, bool> predicate) =>
Lowering\LocalRewriter\LocalRewriter_ReturnStatement.cs (1)
49(method as LocalFunctionSymbol)?.IsExpressionBodied ?? false;
Lowering\SyntheticBoundNodeFactory.cs (2)
468public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, params BoundStatement[] statements) 473public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
Symbols\MethodSymbol.cs (1)
89/// Returns true if this symbol requires an instance reference as the implicit receiver. This is false if the symbol is static, or a <see cref="LocalFunctionSymbol"/>
Symbols\Source\LocalFunctionSymbol.cs (2)
528var localFunction = symbol as LocalFunctionSymbol;
Symbols\Source\SourceParameterSymbol.cs (1)
146Debug.Assert(!(ContainingSymbol is LocalFunctionSymbol));
Symbols\Source\SourceTypeParameterSymbol.cs (2)
189binderOpt: (ContainingSymbol as LocalFunctionSymbol)?.WithTypeParametersBinder); 293case LocalFunctionSymbol _:
Symbols\Symbol.cs (1)
1726if (variable is LocalFunctionSymbol localFunction)