Binder\LocalScopeBinder.cs (17)
21private ImmutableArray<LocalSymbol> _locals;
35internal sealed override ImmutableArray<LocalSymbol> Locals
41ImmutableInterlocked.InterlockedCompareExchange(ref _locals, BuildLocals(), default(ImmutableArray<LocalSymbol>));
48protected virtual ImmutableArray<LocalSymbol> BuildLocals()
50return ImmutableArray<LocalSymbol>.Empty;
89private SmallDictionary<string, LocalSymbol> _lazyLocalsMap;
90private SmallDictionary<string, LocalSymbol> LocalsMap
148protected ImmutableArray<LocalSymbol> BuildLocals(SyntaxList<StatementSyntax> statements, Binder enclosingBinder)
164ArrayBuilder<LocalSymbol> locals = ArrayBuilder<LocalSymbol>.GetInstance(DefaultLocalSymbolArrayCapacity);
173internal void BuildLocals(Binder enclosingBinder, StatementSyntax statement, ArrayBuilder<LocalSymbol> locals)
287static void findExpressionVariablesInRankSpecifier(ExpressionSyntax expression, (LocalScopeBinder localScopeBinder, ArrayBuilder<LocalSymbol> locals, Binder localDeclarationBinder) args)
383LocalSymbol result = null;
389foreach (var local in this.Locals)
444LocalSymbol localSymbol;
510declaredInThisScope |= newSymbolKind == SymbolKind.Local && this.Locals.Contains((LocalSymbol)newSymbol);
543LocalSymbol existingLocal = null;
Binder\RefSafetyAnalysis.cs (15)
63private Dictionary<LocalSymbol, (SafeContext RefEscapeScope, SafeContext ValEscapeScope)>? _localEscapeScopes;
92private readonly ImmutableArray<LocalSymbol> _locals;
94public LocalScope(RefSafetyAnalysis analysis, ImmutableArray<LocalSymbol> locals)
99foreach (var local in locals)
107foreach (var local in _locals)
176private (SafeContext RefEscapeScope, SafeContext ValEscapeScope) GetLocalScopes(LocalSymbol local)
185private void SetLocalScopes(LocalSymbol local, SafeContext refEscapeScope, SafeContext valEscapeScope)
435private void AddLocalScopes(LocalSymbol local, SafeContext refEscapeScope, SafeContext valEscapeScope)
462private void AddOrSetLocalScopes(LocalSymbol local, SafeContext refEscapeScope, SafeContext valEscapeScope)
464_localEscapeScopes ??= new Dictionary<LocalSymbol, (SafeContext RefEscapeScope, SafeContext ValEscapeScope)>();
469private void RemoveLocalScopes(LocalSymbol local)
644if (pattern.Variable is LocalSymbol local)
1099using var _ = new LocalScope(this, ImmutableArray<LocalSymbol>.Empty);
1101foreach (var local in node.IterationVariables)
1124foreach (var local in node.IterationVariables)
CodeGen\Optimizer.cs (31)
61out HashSet<LocalSymbol> stackLocals)
66var locals = PooledDictionary<LocalSymbol, LocalDefUseInfo>.GetInstance();
79stackLocals = new HashSet<LocalSymbol>(locals.Keys);
93private static void FilterValidStackLocals(Dictionary<LocalSymbol, LocalDefUseInfo> info)
98foreach (var local in info.Keys.ToArray())
126private static void RemoveIntersectingLocals(Dictionary<LocalSymbol, LocalDefUseInfo> info, ArrayBuilder<LocalDefUseInfo> dummies)
404private readonly Dictionary<LocalSymbol, LocalDefUseInfo> _locals;
418private StackOptimizerPass1(Dictionary<LocalSymbol, LocalDefUseInfo> locals,
433Dictionary<LocalSymbol, LocalDefUseInfo> locals,
697foreach (var local in locals)
757private bool IsNestedLocalOfCompoundOperator(LocalSymbol local, BoundSequence node)
807private readonly LocalSymbol _local;
810internal LocalUsedWalker(LocalSymbol local, int recursionDepth)
981LocalSymbol localSymbol = assignmentLocal.LocalSymbol;
1427var localSym = ((BoundLocal)boundExpression).LocalSymbol;
1863private void ShouldNotSchedule(LocalSymbol localSymbol)
1872private void RecordVarRef(LocalSymbol local)
1885private void RecordVarRead(LocalSymbol local)
1931private bool EvalStackHasLocal(LocalSymbol local)
1940private void RecordDummyWrite(LocalSymbol local)
1953private void RecordVarWrite(LocalSymbol local)
1983private bool CanScheduleToStack(LocalSymbol local)
1989private void DeclareLocals(ImmutableArray<LocalSymbol> locals, int stack)
1991foreach (var local in locals)
1997private void DeclareLocal(LocalSymbol local, int stack)
2032private readonly Dictionary<LocalSymbol, LocalDefUseInfo> _info;
2034private StackOptimizerPass2(Dictionary<LocalSymbol, LocalDefUseInfo> info)
2039public static BoundStatement Rewrite(BoundStatement src, Dictionary<LocalSymbol, LocalDefUseInfo> info)
2301var sourceLocal = ((BoundLocal)exceptionSource).LocalSymbol;
2359internal override LocalSymbol WithSynthesizedLocalKindAndSyntax(
2406internal override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol inProgress, BindingDiagnosticBag diagnostics)
Generated\BoundNodes.xml.Generated.cs (97)
292protected BoundEqualsValue(BoundKind kind, SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
303public ImmutableArray<LocalSymbol> Locals { get; }
309public BoundFieldEqualsValue(SyntaxNode syntax, FieldSymbol field, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
325public BoundFieldEqualsValue Update(FieldSymbol field, ImmutableArray<LocalSymbol> locals, BoundExpression value)
339public BoundPropertyEqualsValue(SyntaxNode syntax, PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
355public BoundPropertyEqualsValue Update(PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value)
369public BoundParameterEqualsValue(SyntaxNode syntax, ParameterSymbol parameter, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
385public BoundParameterEqualsValue Update(ParameterSymbol parameter, ImmutableArray<LocalSymbol> locals, BoundExpression value)
2262public BoundBlockInstrumentation(SyntaxNode syntax, OneOrMany<LocalSymbol> locals, BoundStatement? prologue, BoundStatement? epilogue, bool hasErrors = false)
2273public OneOrMany<LocalSymbol> Locals { get; }
2280public BoundBlockInstrumentation Update(OneOrMany<LocalSymbol> locals, BoundStatement? prologue, BoundStatement? epilogue)
2334public BoundLocalId(SyntaxNode syntax, LocalSymbol local, FieldSymbol? hoistedField, TypeSymbol type, bool hasErrors)
2345public BoundLocalId(SyntaxNode syntax, LocalSymbol local, FieldSymbol? hoistedField, TypeSymbol type)
2357public LocalSymbol Local { get; }
2363public BoundLocalId Update(LocalSymbol local, FieldSymbol? hoistedField, TypeSymbol type)
3305public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3319public ImmutableArray<LocalSymbol> Locals { get; }
3327public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements)
3341public BoundScope(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3351public ImmutableArray<LocalSymbol> Locals { get; }
3356public BoundScope Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
3401public BoundLocalDeclaration(SyntaxNode syntax, LocalSymbol localSymbol, BoundTypeExpression? declaredTypeOpt, BoundExpression? initializerOpt, ImmutableArray<BoundExpression> argumentsOpt, bool inferredType, bool hasErrors = false)
3414public LocalSymbol LocalSymbol { get; }
3423public BoundLocalDeclaration Update(LocalSymbol localSymbol, BoundTypeExpression? declaredTypeOpt, BoundExpression? initializerOpt, ImmutableArray<BoundExpression> argumentsOpt, bool inferredType)
3771public 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<LocalSymbol> InnerLocals { get; }
3802public BoundSwitchStatement Update(BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<LocalFunctionSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, GeneratedLabelSymbol breakLabel)
3913protected BoundConditionalLoopStatement(BoundKind kind, SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3928public ImmutableArray<LocalSymbol> Locals { get; }
3935public BoundDoStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3951public BoundDoStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
3965public BoundWhileStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3981public BoundWhileStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
3995public BoundForStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
4013public ImmutableArray<LocalSymbol> OuterLocals { get; }
4015public ImmutableArray<LocalSymbol> InnerLocals { get; }
4023public BoundForStatement Update(ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
4037public BoundForEachStatement(SyntaxNode syntax, ForEachEnumeratorInfo? enumeratorInfoOpt, BoundValuePlaceholder? elementPlaceholder, BoundExpression? elementConversion, BoundTypeExpression iterationVariableType, ImmutableArray<LocalSymbol> iterationVariables, BoundExpression? iterationErrorExpressionOpt, BoundExpression expression, BoundForEachDeconstructStep? deconstructionOpt, BoundAwaitableInfo? awaitOpt, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
4064public ImmutableArray<LocalSymbol> IterationVariables { get; }
4074public BoundForEachStatement Update(ForEachEnumeratorInfo? enumeratorInfoOpt, BoundValuePlaceholder? elementPlaceholder, BoundExpression? elementConversion, BoundTypeExpression iterationVariableType, ImmutableArray<LocalSymbol> iterationVariables, BoundExpression? iterationErrorExpressionOpt, BoundExpression expression, BoundForEachDeconstructStep? deconstructionOpt, BoundAwaitableInfo? awaitOpt, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
4119public BoundUsingStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations? declarationsOpt, BoundExpression? expressionOpt, BoundStatement body, BoundAwaitableInfo? awaitOpt, MethodArgumentInfo? patternDisposeInfoOpt, bool hasErrors = false)
4134public ImmutableArray<LocalSymbol> Locals { get; }
4144public BoundUsingStatement Update(ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations? declarationsOpt, BoundExpression? expressionOpt, BoundStatement body, BoundAwaitableInfo? awaitOpt, MethodArgumentInfo? patternDisposeInfoOpt)
4158public BoundFixedStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations declarations, BoundStatement body, bool hasErrors = false)
4171public ImmutableArray<LocalSymbol> Locals { get; }
4178public BoundFixedStatement Update(ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations declarations, BoundStatement body)
4260public BoundCatchBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression? exceptionSourceOpt, TypeSymbol? exceptionTypeOpt, BoundStatementList? exceptionFilterPrologueOpt, BoundExpression? exceptionFilterOpt, BoundBlock body, bool isSynthesizedAsyncCatchAll, bool hasErrors = false)
4276public ImmutableArray<LocalSymbol> Locals { get; }
4287public BoundCatchBlock Update(ImmutableArray<LocalSymbol> locals, BoundExpression? exceptionSourceOpt, TypeSymbol? exceptionTypeOpt, BoundStatementList? exceptionFilterPrologueOpt, BoundExpression? exceptionFilterOpt, BoundBlock body, bool isSynthesizedAsyncCatchAll)
4506public BoundLocal(SyntaxNode syntax, LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type, bool hasErrors)
4519public BoundLocal(SyntaxNode syntax, LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type)
4533public LocalSymbol LocalSymbol { get; }
4541public BoundLocal Update(LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type)
4555public BoundPseudoVariable(SyntaxNode syntax, LocalSymbol localSymbol, PseudoVariableExpressions emitExpressions, TypeSymbol type, bool hasErrors)
4567public BoundPseudoVariable(SyntaxNode syntax, LocalSymbol localSymbol, PseudoVariableExpressions emitExpressions, TypeSymbol type)
4580public LocalSymbol LocalSymbol { get; }
4586public BoundPseudoVariable Update(LocalSymbol localSymbol, PseudoVariableExpressions emitExpressions, TypeSymbol type)
4904public BoundSwitchExpressionArm(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundPattern pattern, BoundExpression? whenClause, BoundExpression value, LabelSymbol label, bool hasErrors = false)
4920public ImmutableArray<LocalSymbol> Locals { get; }
4929public BoundSwitchExpressionArm Update(ImmutableArray<LocalSymbol> locals, BoundPattern pattern, BoundExpression? whenClause, BoundExpression value, LabelSymbol label)
5659public BoundSwitchSection(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundSwitchLabel> switchLabels, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
5671public ImmutableArray<LocalSymbol> Locals { get; }
5677public BoundSwitchSection Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundSwitchLabel> switchLabels, ImmutableArray<BoundStatement> statements)
5766public BoundSequence(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundExpression> sideEffects, BoundExpression value, TypeSymbol type, bool hasErrors = false)
5781public ImmutableArray<LocalSymbol> Locals { get; }
5788public BoundSequence Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundExpression> sideEffects, BoundExpression value, TypeSymbol type)
5802public BoundSpillSequence(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression value, TypeSymbol type, bool hasErrors = false)
5817public ImmutableArray<LocalSymbol> Locals { get; }
5824public BoundSpillSequence Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression value, TypeSymbol type)
8767public BoundConstructorMethodBody(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false)
8777public ImmutableArray<LocalSymbol> Locals { get; }
8783public BoundConstructorMethodBody Update(ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody)
12268ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
12276ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
12284ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13052LocalSymbol local = GetUpdatedSymbol(node, node.Local);
13390ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13399ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13413LocalSymbol localSymbol = GetUpdatedSymbol(node, node.LocalSymbol);
13430ImmutableArray<LocalSymbol> innerLocals = GetUpdatedArray(node, node.InnerLocals);
13441ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13449ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13457ImmutableArray<LocalSymbol> outerLocals = GetUpdatedArray(node, node.OuterLocals);
13458ImmutableArray<LocalSymbol> innerLocals = GetUpdatedArray(node, node.InnerLocals);
13468ImmutableArray<LocalSymbol> iterationVariables = GetUpdatedArray(node, node.IterationVariables);
13482ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13492ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13500ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13583LocalSymbol localSymbol = GetUpdatedSymbol(node, node.LocalSymbol);
13600LocalSymbol localSymbol = GetUpdatedSymbol(node, node.LocalSymbol);
13664ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13762ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13787ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13806ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
14951ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (6)
200protected override void InitializeStateMachine(ArrayBuilder<BoundStatement> bodyBuilder, NamedTypeSymbol frameType, LocalSymbol stateMachineLocal)
262protected override BoundStatement GenerateStateMachineCreation(LocalSymbol stateMachineVariable, NamedTypeSymbol frameType, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies)
324out LocalSymbol instSymbol,
336var versionSymbol = F.SynthesizedLocal(F.SpecialType(SpecialType.System_Int16));
367private void GetPartsForStartingMachine(out BoundExpressionStatement callReset, out LocalSymbol instSymbol, out BoundStatement instAssignment,
434out LocalSymbol instSymbol,
Lowering\ClosureConversion\ClosureConversion.cs (29)
97private readonly HashSet<LocalSymbol> _assignLocals;
133private ArrayBuilder<LocalSymbol> _addedLocals;
168HashSet<LocalSymbol> assignLocals)
202Debug.Assert(localOrParameter is LocalSymbol || localOrParameter is ParameterSymbol ||
239HashSet<LocalSymbol> assignLocals)
631var localFrame = (LocalSymbol)framePointer;
659private BoundNode IntroduceFrame(BoundNode node, Analysis.ClosureEnvironment env, Func<ArrayBuilder<BoundExpression>, ArrayBuilder<LocalSymbol>, BoundNode> F)
666LocalSymbol framePointer = new SynthesizedLocal(_topLevelMethod, TypeWithAnnotations.Create(frameType), SynthesizedLocalKind.LambdaDisplayClass, frame.ScopeSyntaxOpt);
721var addedLocals = ArrayBuilder<LocalSymbol>.GetInstance();
744private void InitVariableProxy(SyntaxNode syntax, Symbol symbol, LocalSymbol framePointer, ArrayBuilder<BoundExpression> prologue)
764var local = (LocalSymbol)symbol;
770LocalSymbol localToUse;
1123locals: ImmutableArray<LocalSymbol>.Empty,
1134private BoundSequence RewriteSequence(BoundSequence node, ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals)
1155return IntroduceFrame(node, frame, (ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals) =>
1160return RewriteBlock(node, ArrayBuilder<BoundExpression>.GetInstance(), ArrayBuilder<LocalSymbol>.GetInstance());
1164private BoundBlock RewriteBlock(BoundBlock node, ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals)
1201var newLocals = ArrayBuilder<LocalSymbol>.GetInstance();
1219return IntroduceFrame(node, frame, (ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals) =>
1226return RewriteCatch(node, ArrayBuilder<BoundExpression>.GetInstance(), ArrayBuilder<LocalSymbol>.GetInstance());
1230private BoundNode RewriteCatch(BoundCatchBlock node, ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals)
1248ImmutableArray.Create<LocalSymbol>(),
1293return IntroduceFrame(node, frame, (ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals) =>
1300return RewriteSequence(node, ArrayBuilder<BoundExpression>.GetInstance(), ArrayBuilder<LocalSymbol>.GetInstance());
1310return IntroduceFrame(node, frame, (ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals) =>
1719var cacheLocal = F.SynthesizedLocal(type, kind: SynthesizedLocalKind.CachedAnonymousMethodDelegate);
1720if (_addedLocals == null) _addedLocals = ArrayBuilder<LocalSymbol>.GetInstance();
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (10)
852locals: ImmutableArray<LocalSymbol>.Empty,
1098locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol),
1287locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol),
1396locals: ImmutableArray<LocalSymbol>.Empty,
1440var locals = ArrayBuilder<LocalSymbol>.GetInstance();
1489ArrayBuilder<LocalSymbol> locals,
1734locals: ImmutableArray.Create<LocalSymbol>(boundTemp.LocalSymbol),
1795locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol),
1883locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol),
1964locals: ImmutableArray<LocalSymbol>.Empty,
Lowering\LocalRewriter\LocalRewriter_Call.cs (17)
140ref ArrayBuilder<LocalSymbol> temps,
398ArrayBuilder<LocalSymbol>? temps = null;
445ImmutableArray<LocalSymbol> temps)
661ref ArrayBuilder<LocalSymbol>? tempsOpt,
717tempsOpt ??= ArrayBuilder<LocalSymbol>.GetInstance();
807ImmutableArray<LocalSymbol>.Empty,
815void ensureTempTrackingSetup([NotNull] ref ArrayBuilder<LocalSymbol>? tempsOpt, ref BitVector positionsAssignedToTemp)
817tempsOpt ??= ArrayBuilder<LocalSymbol>.GetInstance();
830ref ArrayBuilder<LocalSymbol>? tempsOpt,
884visitedArgumentsBuilder[argIndex] = _factory.Sequence(ImmutableArray<LocalSymbol>.Empty, ImmutableArray.Create<BoundExpression>(store), local);
930private void ReferToTempIfReferenceTypeReceiver(BoundLocal receiverTemp, ref BoundAssignmentOperator assignmentToTemp, out BoundAssignmentOperator? extraRefInitialization, ArrayBuilder<LocalSymbol> temps)
1003[NotNull] ref ArrayBuilder<LocalSymbol>? temps,
1015temps ??= ArrayBuilder<LocalSymbol>.GetInstance();
1455ArrayBuilder<LocalSymbol> temporariesBuilder)
1579ImmutableArray<LocalSymbol>.Empty,
1603ArrayBuilder<LocalSymbol> temporariesBuilder)
1643locals: ImmutableArray<LocalSymbol>.Empty,
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (12)
27var temps = ArrayBuilder<LocalSymbol>.GetInstance();
58var eventTemps = ArrayBuilder<LocalSymbol>.GetInstance();
161private BoundExpression? TransformPropertyOrEventReceiver(Symbol propertyOrEvent, BoundExpression? receiverOpt, bool isRegularCompoundAssignment, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps)
227private BoundDynamicMemberAccess TransformDynamicMemberAccess(BoundDynamicMemberAccess memberAccess, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps)
244private BoundIndexerAccess TransformIndexerAccess(BoundIndexerAccess indexerAccess, bool isRegularCompoundAssignment, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps)
320ArrayBuilder<LocalSymbol> temps)
409ArrayBuilder<LocalSymbol> temps,
423private BoundExpression TransformIndexPatternIndexerAccess(BoundImplicitIndexerAccess implicitIndexerAccess, bool isRegularCompoundAssignment, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps, bool isDynamicAssignment)
459private bool TransformCompoundAssignmentFieldOrEventAccessReceiver(Symbol fieldOrEvent, ref BoundExpression? receiver, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps)
502private BoundDynamicIndexerAccess TransformDynamicIndexerAccess(BoundDynamicIndexerAccess indexerAccess, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps)
561private BoundExpression TransformCompoundAssignmentLHS(BoundExpression originalLHS, bool isRegularCompoundAssignment, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps, bool isDynamicAssignment)
780ArrayBuilder<LocalSymbol> temps)
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (27)
141ImmutableArray<LocalSymbol> iterationVariables,
157LocalSymbol enumeratorVar = _factory.SynthesizedLocal(enumeratorType, syntax: forEachSyntax, kind: SynthesizedLocalKind.ForEachEnumerator);
260tryBlock: new BoundBlock(forEachSyntax, locals: ImmutableArray<LocalSymbol>.Empty, statements: ImmutableArray.Create(whileLoop)),
411locals: ImmutableArray<LocalSymbol>.Empty,
424LocalSymbol disposableVar = _factory.SynthesizedLocal(idisposableTypeSymbol);
603ImmutableArray<LocalSymbol> iterationVariables,
618LocalSymbol? preambleLocal = null;
623LocalSymbol collectionTemp = _factory.SynthesizedLocal(collectionType, forEachSyntax, kind: SynthesizedLocalKind.ForEachArray, refKind: collectionTempRefKind);
639LocalSymbol positionVar = _factory.SynthesizedLocal(intType, syntax: forEachSyntax, kind: SynthesizedLocalKind.ForEachArrayIndex);
693outerLocals: preambleLocal is null ? ImmutableArray.Create<LocalSymbol>(collectionTemp, positionVar) : ImmutableArray.Create<LocalSymbol>(preambleLocal, collectionTemp, positionVar),
707private delegate BoundStatement? GetForEachStatementAsForPreamble(LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind);
746return static (LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind) =>
812ImmutableArray<LocalSymbol> iterationVariables,
838ImmutableArray<LocalSymbol> iterationVariables,
899ImmutableArray<LocalSymbol> iterationVariables,
917LocalSymbol arrayVar = _factory.SynthesizedLocal(arrayType, syntax: forEachSyntax, kind: SynthesizedLocalKind.ForEachArray);
928LocalSymbol positionVar = _factory.SynthesizedLocal(intType, syntax: forEachSyntax, kind: SynthesizedLocalKind.ForEachArrayIndex);
989outerLocals: ImmutableArray.Create<LocalSymbol>(arrayVar, positionVar),
1048ImmutableArray<LocalSymbol> iterationVariables,
1073LocalSymbol arrayVar = _factory.SynthesizedLocal(arrayType, syntax: forEachSyntax, kind: SynthesizedLocalKind.ForEachArray);
1087LocalSymbol[] upperVar = new LocalSymbol[rank];
1109LocalSymbol[] positionVar = new LocalSymbol[rank];
1232private static BoundLocal MakeBoundLocal(CSharpSyntaxNode syntax, LocalSymbol local, TypeSymbol type)
1240private BoundStatement MakeLocalDeclaration(CSharpSyntaxNode syntax, LocalSymbol local, BoundExpression rewrittenInitialValue)
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (8)
159ArrayBuilder<LocalSymbol>? temps = null;
251var localsBuilder = ArrayBuilder<LocalSymbol>.GetInstance();
456var locals = ArrayBuilder<LocalSymbol>.GetInstance(2);
477ArrayBuilder<LocalSymbol> locals)
758var localsBuilder = ArrayBuilder<LocalSymbol>.GetInstance();
769private BoundExpression VisitRangePatternIndexerAccess(BoundImplicitIndexerAccess node, ArrayBuilder<LocalSymbol> localsBuilder, ArrayBuilder<BoundExpression> sideEffectsBuilder, bool cacheAllArgumentsOnly)
996private BoundExpression MakeRangeSize(ref BoundExpression startExpr, BoundExpression endExpr, ArrayBuilder<LocalSymbol> localsBuilder, ArrayBuilder<BoundExpression> sideEffectsBuilder)
1027private void DeconstructRange(BoundExpression rewrittenRangeArg, BoundExpression lengthAccess, ArrayBuilder<LocalSymbol> localsBuilder, ArrayBuilder<BoundExpression> sideEffectsBuilder, out BoundExpression startExpr, out BoundExpression rangeSizeExpr)
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (14)
33ref ArrayBuilder<LocalSymbol>? temps,
175ArrayBuilder<LocalSymbol>? temps = null;
212private BoundExpression VisitObjectInitializerMember(BoundObjectInitializerMember node, ref BoundExpression rewrittenReceiver, ArrayBuilder<BoundExpression> sideEffects, ref ArrayBuilder<LocalSymbol>? temps)
220ArrayBuilder<LocalSymbol>? constructionTemps = null;
251ref ArrayBuilder<LocalSymbol>? temps,
271ref ArrayBuilder<LocalSymbol>? temps,
424temps ??= ArrayBuilder<LocalSymbol>.GetInstance();
460temps = ArrayBuilder<LocalSymbol>.GetInstance();
482temps ??= ArrayBuilder<LocalSymbol>.GetInstance();
591ref ArrayBuilder<LocalSymbol>? temps)
605(LocalRewriter rewriter, ArrayBuilder<BoundExpression> sideeffects, ArrayBuilder<LocalSymbol>? temps) elementArg = (rewriter: this, sideeffects, temps);
608static (BoundExpression element, ref (LocalRewriter rewriter, ArrayBuilder<BoundExpression> sideeffects, ArrayBuilder<LocalSymbol>? temps) elementArg) =>
637private BoundExpression EvaluateSideEffects(BoundExpression arg, RefKind refKind, ArrayBuilder<BoundExpression> sideeffects, ref ArrayBuilder<LocalSymbol>? temps)
646temps = ArrayBuilder<LocalSymbol>.GetInstance();
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (14)
32var temps = ArrayBuilder<LocalSymbol>.GetInstance();
101ArrayBuilder<LocalSymbol> temps)
142ArrayBuilder<LocalSymbol> temps)
183ArrayBuilder<LocalSymbol> temps,
247ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind)
267TypeSymbol boolType, ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind)
308BoundExpression innerSequence = _factory.Sequence(locals: ImmutableArray<LocalSymbol>.Empty, innerEffects.ToImmutableAndFree(), logicalExpression);
322return _factory.Sequence(ImmutableArray<LocalSymbol>.Empty, outerEffects.ToImmutableAndFree(),
330return _factory.Sequence(ImmutableArray<LocalSymbol>.Empty, outerEffects.ToImmutableAndFree(),
339_factory.Sequence(ImmutableArray<LocalSymbol>.Empty, outerEffects.ToImmutableAndFree(),
353private void MakeNullableParts(BoundExpression expr, ArrayBuilder<LocalSymbol> temps, ArrayBuilder<BoundExpression> innerEffects,
416private BoundLocal MakeTemp(BoundExpression loweredExpression, ArrayBuilder<LocalSymbol> temps, ArrayBuilder<BoundExpression> effects)
429ArrayBuilder<LocalSymbol> temps,
486ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind)
Lowering\SpillSequenceSpiller.cs (37)
22private readonly PooledDictionary<LocalSymbol, LocalSymbol> _tempSubstitution;
23private readonly PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver> _receiverSubstitution;
27PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution,
28PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver> receiverSubstitution,
41private ArrayBuilder<LocalSymbol> _locals;
67public ImmutableArray<LocalSymbol> GetLocals()
69return (_locals == null) ? ImmutableArray<LocalSymbol>.Empty : _locals.ToImmutable();
122public void AddLocal(LocalSymbol local)
126_locals = ArrayBuilder<LocalSymbol>.GetInstance();
132public void AddLocals(ImmutableArray<LocalSymbol> locals)
134foreach (var local in locals)
183private readonly PooledDictionary<LocalSymbol, LocalSymbol> _tempSubstitution;
184private readonly PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver> _receiverSubstitution;
187PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution,
188PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver> receiverSubstitution,
197PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution,
198PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver> receiverSubstitution,
214LocalSymbol longLived;
234var tempSubstitution = PooledDictionary<LocalSymbol, LocalSymbol>.GetInstance();
235var receiverSubstitution = PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver>.GetInstance();
357out LocalSymbol receiverRefLocal,
530out LocalSymbol outReceiverRefLocal,
996var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
1135var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
1150var tmp = _F.SynthesizedLocal(condition.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
1250var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
1306var clone = _F.SynthesizedLocal(receiver.Type, _F.Syntax, refKind: RefKind.None, kind: SynthesizedLocalKind.Spill);
1336var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
1487private void PromoteAndAddLocals(BoundSpillSequenceBuilder builder, ImmutableArray<LocalSymbol> locals)
1489foreach (var local in locals)
1497LocalSymbol longLived = local.WithSynthesizedLocalKindAndSyntax(SynthesizedLocalKind.Spill, _F.Syntax);
Lowering\SyntheticBoundNodeFactory.cs (27)
220public BoundExpression This(LocalSymbol thisTempOpt)
450return Block(ImmutableArray<LocalSymbol>.Empty, statements);
458public BoundBlock Block(ImmutableArray<LocalSymbol> locals, params BoundStatement[] statements)
463public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
468public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, params BoundStatement[] statements)
473public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
502public BoundBlockInstrumentation CombineInstrumentation(BoundBlockInstrumentation? innerInstrumentation = null, LocalSymbol? local = null, BoundStatement? prologue = null, BoundStatement? epilogue = null)
581public LocalSymbol SynthesizedLocal(
603public LocalSymbol InterpolatedStringHandlerLocal(
916return If(condition, ImmutableArray<LocalSymbol>.Empty, thenClause, elseClauseOpt);
924public BoundStatement If(BoundExpression condition, ImmutableArray<LocalSymbol> locals, BoundStatement thenClause, BoundStatement? elseClauseOpt = null)
980public BoundLocal Local(LocalSymbol local)
985public BoundExpression MakeSequence(LocalSymbol temp, params BoundExpression[] parts)
987return MakeSequence(ImmutableArray.Create<LocalSymbol>(temp), parts);
992return MakeSequence(ImmutableArray<LocalSymbol>.Empty, parts);
995public BoundExpression MakeSequence(ImmutableArray<LocalSymbol> locals, params BoundExpression[] parts)
1021return new BoundSequence(Syntax, ImmutableArray<LocalSymbol>.Empty, sideEffects.AsImmutableOrNull(), result, resultType) { WasCompilerGenerated = true };
1024public BoundExpression Sequence(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundExpression> sideEffects, BoundExpression result)
1033public BoundSpillSequence SpillSequence(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression result)
1322public BoundExpression LocalId(LocalSymbol symbol)
1591LocalSymbol local,
1602return new BoundCatchBlock(Syntax, ImmutableArray<LocalSymbol>.Empty, source, source.Type, exceptionFilterPrologueOpt: null, exceptionFilterOpt: null, body: block, isSynthesizedAsyncCatchAll: false);
1710internal BoundLocal MakeTempForDiscard(BoundDiscardExpression node, ArrayBuilder<LocalSymbol> temps)
1712LocalSymbol temp;
1718internal BoundLocal MakeTempForDiscard(BoundDiscardExpression node, out LocalSymbol temp)
1726internal ImmutableArray<BoundExpression> MakeTempsForDiscardArguments(ImmutableArray<BoundExpression> arguments, ArrayBuilder<LocalSymbol> builder)
1844locals: ImmutableArray<LocalSymbol>.Empty,