2 writes to LocalSymbol
Microsoft.CodeAnalysis.CSharp (2)
Generated\BoundNodes.xml.Generated.cs (2)
4512this.LocalSymbol = localSymbol; 4525this.LocalSymbol = localSymbol;
235 references to LocalSymbol
Microsoft.CodeAnalysis.CSharp (235)
Binder\Binder.ValueChecks.cs (7)
1050LocalSymbol localSymbol = local.LocalSymbol; 1089LocalSymbol localSymbol = local.LocalSymbol; 2767BoundLocal { DeclarationKind: not BoundLocalDeclarationKind.None } l => l.LocalSymbol, 3395return GetLocalScopes(((BoundLocal)expr).LocalSymbol).RefEscapeScope; 4110return GetLocalScopes(((BoundLocal)expr).LocalSymbol).ValEscapeScope; 4802var localSymbol = ((BoundLocal)expr).LocalSymbol; 5767var local = ((BoundLocal)expression).LocalSymbol;
Binder\Binder_Deconstruct.cs (1)
642BoundLocal { DeclarationKind: BoundLocalDeclarationKind.WithExplicitType or BoundLocalDeclarationKind.WithInferredType, LocalSymbol: var symbol } => symbol,
Binder\Binder_Operators.cs (1)
2670LocalSymbol localSymbol = localAccess.LocalSymbol;
Binder\DecisionDagBuilder.cs (1)
1716var bindings = cd.Bindings.Select(bpb => $"{(bpb.VariableAccess is BoundLocal l ? l.LocalSymbol.Name : "<var>")}={tempName(bpb.TempContainingValue)}");
Binder\LockOrUsingBinder.cs (1)
62lockedOrDisposedVariables = lockedOrDisposedVariables.Add(((BoundLocal)expression).LocalSymbol);
Binder\RefSafetyAnalysis.cs (2)
429Debug.Assert(_localEscapeScopes?.ContainsKey(node.LocalSymbol) == true || 430_symbol != node.LocalSymbol.ContainingSymbol);
BoundTree\BoundExpression.cs (1)
300get { return this.LocalSymbol; }
BoundTree\BoundExpressionExtensions.cs (1)
25return ((BoundLocal)node).LocalSymbol.RefKind;
BoundTree\BoundNode.cs (1)
696CheckDeclared(node.LocalSymbol);
BoundTree\BoundNode_Source.cs (1)
192var symbol = local.LocalSymbol;
BoundTree\Constructors.cs (1)
75var localSymbol = ((BoundLocal)receiver).LocalSymbol;
CodeGen\EmitAddress.cs (2)
267var local = localAccess.LocalSymbol; 359var symbol = local.LocalSymbol;
CodeGen\EmitExpression.cs (16)
444(receiver.Kind == BoundKind.Local && IsStackLocal(((BoundLocal)receiver).LocalSymbol)) || 1292return ((BoundLocal)receiver).LocalSymbol.RefKind != RefKind.None; 1392bool isRefLocal = local.LocalSymbol.RefKind != RefKind.None; 1393if (IsStackLocal(local.LocalSymbol)) 1414EmitLoadIndirect(local.LocalSymbol.Type, local.Syntax); 1568return ((BoundLocal)receiver).LocalSymbol.SynthesizedKind == SynthesizedLocalKind.FrameCache; 2104BoundLocal { LocalSymbol.IsKnownToReferToTempIfReferenceType: true } or 2214return ((BoundLocal)receiver).LocalSymbol.RefKind != RefKind.None; 2762return ((BoundLocal)left).LocalSymbol.RefKind == RefKind.None; 2832if (left.LocalSymbol.RefKind != RefKind.None && !assignmentOperator.IsRef) 2834if (!IsStackLocal(left.LocalSymbol)) 3006if (lhs.Kind == BoundKind.Local && ((BoundLocal)lhs).LocalSymbol.SynthesizedKind.IsLongLived()) 3077if (local.LocalSymbol.RefKind != RefKind.None && !assignment.IsRef) 3079EmitIndirectStore(local.LocalSymbol.Type, local.Syntax); 3083if (IsStackLocal(local.LocalSymbol)) 3942if (this.IsStackLocal(local.LocalSymbol))
CodeGen\EmitStatement.cs (5)
536(receiver.Kind == BoundKind.Local && IsStackLocal(((BoundLocal)receiver).LocalSymbol)) || 1147Debug.Assert(exceptionSourceLocal.LocalSymbol.RefKind == RefKind.None); 1148if (!IsStackLocal(exceptionSourceLocal.LocalSymbol)) 1282var local = ((BoundLocal)expression).LocalSymbol; 1747var symbol = localExpression.LocalSymbol;
CodeGen\Optimizer.cs (21)
762if (value != null && value.Kind == BoundKind.Local && ((BoundLocal)value).LocalSymbol == local) 836if (node.LocalSymbol == _local) 858if (node.LocalSymbol.RefKind != RefKind.None) 860RecordVarRead(node.LocalSymbol); 864RecordVarRef(node.LocalSymbol); 878if (node.LocalSymbol.RefKind != RefKind.None) 882RecordVarRead(node.LocalSymbol); 888RecordVarRead(node.LocalSymbol); 981LocalSymbol localSymbol = assignmentLocal.LocalSymbol; 1049if (((BoundLocal)lhs).LocalSymbol.RefKind != RefKind.None) 1221if (unwrappedSequence is BoundLocal { LocalSymbol: { RefKind: not RefKind.None } localSymbol }) 1427var localSym = ((BoundLocal)boundExpression).LocalSymbol; 1640if (unwrappedSequence is BoundLocal { LocalSymbol: { } localSymbol }) 1699RecordVarWrite(((BoundLocal)exceptionSourceOpt).LocalSymbol); 1937((BoundLocal)top.Item1).LocalSymbol == local; 2126if (!_info.TryGetValue(node.LocalSymbol, out locInfo)) 2134return new BoundDup(node.Syntax, node.LocalSymbol.RefKind, node.Type); 2155if (left == null || !_info.TryGetValue(left.LocalSymbol, out locInfo)) 2162var isIndirectLocalStore = left.LocalSymbol.RefKind != RefKind.None && !node.IsRef; 2191left.LocalSymbol.RefKind == RefKind.Ref && 2301var sourceLocal = ((BoundLocal)exceptionSource).LocalSymbol;
Compilation\CSharpSemanticModel.cs (2)
2067type = local.LocalSymbol.Type; 2068nullability = local.LocalSymbol.TypeWithAnnotations.NullableAnnotation.ToNullabilityInfo(type);
Compiler\AnonymousTypeMethodBodySynthesizer.cs (1)
149F.CloseMethod(F.Block(ImmutableArray.Create<LocalSymbol>(boundLocal.LocalSymbol), assignment, retStatement));
FlowAnalysis\DataFlowsOutWalker.cs (1)
151return ((BoundLocal)node).LocalSymbol;
FlowAnalysis\DefiniteAssignment.cs (9)
829NoteRead(((BoundLocal)n).LocalSymbol); 980_usedVariables.Add(((BoundLocal)n).LocalSymbol); 1016NoteWrite(((BoundLocal)n).LocalSymbol, value, read: read, isRef: isRef); 1399unassignedSlot = GetOrCreateSlot(((BoundLocal)node).LocalSymbol); 1497var result = ((BoundLocal)expression).LocalSymbol; 1571if (local.LocalSymbol.RefKind != RefKind.None && !isRef) 2353LocalSymbol localSymbol = node.LocalSymbol; 2358int slot = GetOrCreateSlot(node.LocalSymbol); 2597CheckAssigned(((BoundLocal)expr).LocalSymbol, node);
FlowAnalysis\LocalDataFlowPass.cs (1)
219return GetOrCreateSlot(((BoundLocal)node).LocalSymbol);
FlowAnalysis\NullableWalker.cs (4)
3015var local = node.LocalSymbol; 7548_variables.SetType(local.LocalSymbol, varType); 10090case BoundLocal { LocalSymbol.RefKind: RefKind.None }: 10278_variables.SetType(local.LocalSymbol, operandType.ToAnnotatedTypeWithAnnotations(compilation));
FlowAnalysis\NullableWalker_Patterns.cs (1)
681if (variableAccess is BoundLocal { LocalSymbol: SourceLocalSymbol local } boundLocal)
FlowAnalysis\ReadWriteWalker.cs (1)
188readOrWritten.Add(((BoundLocal)receiver).LocalSymbol);
FlowAnalysis\VariablesDeclaredWalker.cs (1)
181_variablesDeclared.Add(node.LocalSymbol);
Generated\BoundNodes.xml.Generated.cs (4)
4542if (!Symbols.SymbolEqualityComparer.ConsiderEverything.Equals(localSymbol, this.LocalSymbol) || declarationKind != this.DeclarationKind || constantValueOpt != this.ConstantValueOpt || isNullableUnknown != this.IsNullableUnknown || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 11474return node.Update(node.LocalSymbol, node.DeclarationKind, node.ConstantValueOpt, node.IsNullableUnknown, type); 13546LocalSymbol localSymbol = GetUpdatedSymbol(node, node.LocalSymbol); 15988new TreeDumperNode("localSymbol", node.LocalSymbol, null),
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (1)
685if (catchFrame == null || !catchFrame.TryGetHoistedLocal(node.LocalSymbol, out hoistedLocal))
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (1)
489AddIfCaptured(node.LocalSymbol, node.Syntax);
Lowering\DiagnosticsPass_ExpressionTrees.cs (1)
183CheckReferenceToVariable(node, node.LocalSymbol);
Lowering\DiagnosticsPass_Warnings.cs (2)
206return local1.LocalSymbol == local2.LocalSymbol;
Lowering\Instrumentation\Instrumenter.cs (1)
222Debug.Assert(original.Left is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.UserDefined } or BoundParameter);
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (5)
358Debug.Assert(original.Left is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.UserDefined } or BoundParameter); 366if (original.Right is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.UserDefined } rightLocal) 369refAssignmentSourceIndex = _factory.LocalId(rightLocal.LocalSymbol); 411if (node is BoundLocal { LocalSymbol: var localSymbol }) 603return _factory.Sequence(ImmutableArray.Create(temp.LocalSymbol), builder.ToImmutableAndFree(), temp);
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (1)
545Debug.Assert(l.LocalSymbol.DeclarationKind == LocalDeclarationKind.PatternVariable);
Lowering\LocalRewriter\LocalRewriter_Await.cs (1)
52locals: ImmutableArray.Create<LocalSymbol>(tempAccess.LocalSymbol),
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (12)
107locals: ImmutableArray.Create(boundTemp.LocalSymbol), 705return _factory.Sequence(ImmutableArray.Create(temp.LocalSymbol), ImmutableArray.Create<BoundExpression>(tempAssignment), result); 1098locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol), 1287locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol), 1497locals.Add(tempAccess.LocalSymbol); 1734locals: ImmutableArray.Create<LocalSymbol>(boundTemp.LocalSymbol), 1795locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol), 1883locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol),
Lowering\LocalRewriter\LocalRewriter_Call.cs (10)
297temps.Add(receiverTemp.LocalSymbol); 719tempsOpt.Add(receiverTemp.LocalSymbol); 786if (receiverTemp.LocalSymbol.IsRef && 884tempsOpt.Add(local.LocalSymbol); 947temps.Add(cache.LocalSymbol); 953temps.Add(intermediateRef.LocalSymbol); 988((SynthesizedLocal)receiverTemp.LocalSymbol).SetIsKnownToReferToTempIfReferenceType(); 1471temporariesBuilder.Add(((BoundLocal)s.Left).LocalSymbol); 1629var localRefKind = ((BoundLocal)argument).LocalSymbol.RefKind; 1650temporariesBuilder.Add(boundTemp.LocalSymbol);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (4)
371ImmutableArray.Create(temp.LocalSymbol), 551_additionalLocals.Add(temp.LocalSymbol); 569_additionalLocals.Add(inlineArrayLocal.LocalSymbol); 955Debug.Assert((object)spreadOperandAsSpan != rewrittenSpreadOperand || spreadOperandAsSpan is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.LoweringTemp });
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (17)
66eventTemps.Add(isEvent.LocalSymbol); 71eventTemps.Add(((BoundLocal)lhsRead).LocalSymbol); 73eventTemps.Add(storeNonEvent.LocalSymbol); 80eventTemps.Add(((BoundLocal)loweredRight).LocalSymbol); 206temps.Add(receiverTemp.LocalSymbol); 209receiverTemp.LocalSymbol.IsRef && 239temps.Add(receiverTemp.LocalSymbol); 359temps.Add(boundTemp.LocalSymbol); 381temps.Add(((BoundLocal)tempAssignment.Left).LocalSymbol); 450temps.Add(variableTemp.LocalSymbol); 497temps.Add(receiverTemp.LocalSymbol); 510temps.Add(temp.LocalSymbol); 528temps.Add(temp.LocalSymbol); 756temps.Add(variableTemp.LocalSymbol); 785temps.Add(arrayTemp.LocalSymbol); 796temps.Add(temp.LocalSymbol); 858return localsMayBeAssignedOrCaptured || ((BoundLocal)expression).LocalSymbol.RefKind != RefKind.None;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (3)
975return _factory.MakeSequence(savedTuple.LocalSymbol, assignmentToTemp, result); 1197locals: ImmutableArray.Create(boundTemp.LocalSymbol), 1473locals: ImmutableArray.Create(boundTemp.LocalSymbol),
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (3)
168case BoundLocal { LocalSymbol: { RefKind: RefKind.None } localSymbol }: 351temps.Add(savedTuple.LocalSymbol); 428temps.Add(temp.LocalSymbol);
Lowering\LocalRewriter\LocalRewriter_Event.cs (1)
181: ImmutableArray.Create<LocalSymbol>(boundTemp.LocalSymbol);
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (1)
401locals: ImmutableArray.Create(nullableBoundTemp.LocalSymbol),
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (1)
757preambleLocal = boundLocal.LocalSymbol;
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (20)
274localsBuilder.Insert(0, ((BoundLocal)possiblyRefCapturedReceiver).LocalSymbol); 297result = _factory.Sequence(ImmutableArray.Create(((BoundLocal)rewrittenReceiver).LocalSymbol), 506locals.Add(receiverLocal.LocalSymbol); 508if (receiverLocal.LocalSymbol.IsRef && 542locals.Add(((BoundLocal)makeOffsetInput).LocalSymbol); 602locals.Add(integerTemp.LocalSymbol); 616locals.Add(integerTemp.LocalSymbol); 809localsBuilder.Add(receiverLocal.LocalSymbol); 811if (receiverLocal.LocalSymbol.IsRef && 927localsBuilder.Add(((BoundLocal)startMakeOffsetInput).LocalSymbol); 938localsBuilder.Add(((BoundLocal)endMakeOffsetInput).LocalSymbol); 953localsBuilder.Add(lengthLocal.LocalSymbol); 966localsBuilder.Add(startLocal.LocalSymbol); 971localsBuilder.Add(rangeSizeLocal.LocalSymbol); 1013startExpr is not BoundLocal { LocalSymbol.SynthesizedKind: not SynthesizedLocalKind.UserDefined }) 1016localsBuilder.Add(startLocal.LocalSymbol); 1032localsBuilder.Add(rangeLocal.LocalSymbol); 1038localsBuilder.Add(lengthLocal.LocalSymbol); 1050localsBuilder.Add(startLocal.LocalSymbol); 1063localsBuilder.Add(rangeSizeLocal.LocalSymbol);
Lowering\LocalRewriter\LocalRewriter_LockStatement.cs (4)
80locals: ImmutableArray.Create(boundTemp.LocalSymbol), 170ImmutableArray.Create(boundLockTemp.LocalSymbol, boundLockTakenTemp.LocalSymbol), 221ImmutableArray.Create(boundLockTemp.LocalSymbol),
Lowering\LocalRewriter\LocalRewriter_NullCoalescingAssignmentOperator.cs (2)
98temps.Add(lhsTemp.LocalSymbol); 107temps.Add(tmp.LocalSymbol);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (2)
146if (unwrappedRight is { ConstantValueOpt: not null } or BoundLocal { LocalSymbol.IsRef: false } or BoundParameter { ParameterSymbol.RefKind: RefKind.None } && 184locals: ImmutableArray.Create(boundTemp.LocalSymbol),
Lowering\LocalRewriter\LocalRewriter_ObjectCreationExpression.cs (4)
168temps.Add(oldValue.LocalSymbol); 214temps.Add(valueTemp.LocalSymbol); 291locals = ImmutableArray.Create(value.LocalSymbol); 295temps.Insert(0, value.LocalSymbol);
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (3)
425temps.Add(rangeTemp.LocalSymbol); 462temps.Add(temp.LocalSymbol); 648temps.Add(temp.LocalSymbol);
Lowering\LocalRewriter\LocalRewriter_StackAlloc.cs (1)
83locals.Add(tempAccess.LocalSymbol);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (3)
246locals.Remove(constructorLocal.LocalSymbol) && 542localsBuilder.Add(temp.LocalSymbol); 729ImmutableArray.Create(temp.LocalSymbol),
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (4)
133return new InterpolationHandlerResult(ImmutableArray.Create(_factory.ExpressionStatement(handlerConstructionAssignment), resultIf), builderTemp, appendShouldProceedLocal.LocalSymbol, this); 140return new InterpolationHandlerResult(resultExpressions.ToImmutableAndFree(), builderTemp, appendShouldProceedLocal?.LocalSymbol, this); 286? ImmutableArray.Create(HandlerTemp.LocalSymbol, _outTemp) 287: ImmutableArray.Create(HandlerTemp.LocalSymbol);
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (1)
420temps.Add(temp.LocalSymbol);
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (3)
236locals: ImmutableArray.Create<LocalSymbol>(boundTemp.LocalSymbol), 489return ((BoundLocal)expression).LocalSymbol.RefKind != RefKind.None; 712locals: ImmutableArray.Create<LocalSymbol>(boundTemp.LocalSymbol),
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (2)
195locals: node.Locals.Add(boundTemp.LocalSymbol), 258locals: ImmutableArray.Create<LocalSymbol>(boundTemp.LocalSymbol), //localSymbol will be declared by an enclosing block
Lowering\MethodToClassRewriter.cs (10)
406if (TryReplaceWithProxy(node.LocalSymbol, node.Syntax, out BoundNode? replacement)) 412Debug.Assert(!NeedsProxy(node.LocalSymbol)); 447if (this.localMap.TryGetValue(node.LocalSymbol, out LocalSymbol? replacementLocal)) 493if (leftLocal.LocalSymbol.RefKind != RefKind.None && 495NeedsProxy(leftLocal.LocalSymbol)) 497Debug.Assert(!proxies.ContainsKey(leftLocal.LocalSymbol)); 503if (NeedsProxy(leftLocal.LocalSymbol) && !proxies.ContainsKey(leftLocal.LocalSymbol)) 505Debug.Assert(leftLocal.LocalSymbol.DeclarationKind == LocalDeclarationKind.None); 536ImmutableArray.Create<LocalSymbol>(tempLocal.LocalSymbol),
Lowering\SpillSequenceSpiller.cs (15)
212if (!node.LocalSymbol.SynthesizedKind.IsLongLived()) 215if (_tempSubstitution.TryGetValue(node.LocalSymbol, out longLived)) 217Debug.Assert(!_receiverSubstitution.ContainsKey(node.LocalSymbol)); 222if (_receiverSubstitution.TryGetValue(node.LocalSymbol, out var receiver)) 397if (local.LocalSymbol.SynthesizedKind == SynthesizedLocalKind.Spill || refKind != RefKind.None) 513builder.AddLocal(replacement.LocalSymbol); 538Left: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } receiverRefLocal }, 541ValueTypeReceiver: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } } valueTypeReceiver, 550Left: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.None } referenceTypeClone }, 551Right: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } originalReceiverReference } 554Value: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.None } } referenceTypeReceiver 558&& (object)referenceTypeClone == referenceTypeReceiver.LocalSymbol 559&& (object)originalReceiverReference == valueTypeReceiver.LocalSymbol 560&& (object)receiverRefLocal != valueTypeReceiver.LocalSymbol 1057receiverBuilder.AddLocal(cache.LocalSymbol);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (3)
236case BoundLocal { LocalSymbol: var symbol }: 341if (node is { IsRef: true, Left: BoundLocal { LocalSymbol: LocalSymbol { IsCompilerGenerated: true } local } }) 412Capture(node.LocalSymbol, node.Syntax);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (1)
816var leftLocal = ((BoundLocal)node.Left).LocalSymbol;
Lowering\SyntheticBoundNodeFactory.cs (1)
438return (InstrumentationState?.IsSuppressed == false && left is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.UserDefined } or BoundParameter) ?
Operations\CSharpOperationFactory.cs (1)
554ILocalSymbol local = boundLocal.LocalSymbol.GetPublicSymbol();
Operations\CSharpOperationFactory_Methods.cs (1)
95return boundLocal == null ? null : new VariableDeclaratorOperation(boundLocal.LocalSymbol.GetPublicSymbol(), initializer: null, ignoredArguments: ImmutableArray<IOperation>.Empty, semanticModel: _semanticModel, syntax: boundLocal.Syntax, isImplicit: false);
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (2)
502ImmutableArray.Create<LocalSymbol>(scriptLocal.LocalSymbol), 619ImmutableArray.Create<LocalSymbol>(submissionLocal.LocalSymbol),