119 references to EntryState
Microsoft.CodeAnalysis (119)
SourceGeneration\Nodes\BatchNode.cs (8)
48
if (entry.State !=
EntryState
.Removed)
76
if (entry.State ==
EntryState
.Removed)
100
if (entry.State ==
EntryState
.Removed)
135
tableBuilder.AddEntry(sourceValues,
EntryState
.Added, stopwatch.Elapsed, sourceInputs,
EntryState
.Added);
139
if (!tableBuilder.TryModifyEntry(sourceValues, stopwatch.Elapsed, sourceInputs,
EntryState
.Modified))
141
tableBuilder.AddEntry(sourceValues,
EntryState
.Added, stopwatch.Elapsed, sourceInputs,
EntryState
.Added);
SourceGeneration\Nodes\CombineNode.cs (6)
67
var
state = (entry1.State, isInput2Cached) switch
69
(
EntryState
.Cached, true) =>
EntryState
.Cached,
70
(
EntryState
.Cached, false) =>
EntryState
.Modified,
75
if (state !=
EntryState
.Modified || _comparer is null || !tableBuilder.TryModifyEntry(entry, stopwatch.Elapsed, stepInputs, state))
SourceGeneration\Nodes\HostOutputNode.cs (5)
50
if (entry.State ==
EntryState
.Removed)
54
else if (entry.State !=
EntryState
.Cached || !nodeTable.TryUseCachedEntries(TimeSpan.Zero, inputs))
60
nodeTable.AddEntry(output.ToImmutableAndFree(),
EntryState
.Added, stopwatch.Elapsed, inputs,
EntryState
.Added);
76
if (state !=
EntryState
.Removed)
SourceGeneration\Nodes\InputNode.cs (5)
86
var modified = tableBuilder.TryModifyEntry(inputItems[itemIndex], elapsedTime, noInputStepsStepInfo,
EntryState
.Modified);
102
tableBuilder.AddEntry(newItem,
EntryState
.Added, elapsedTime, noInputStepsStepInfo,
EntryState
.Added);
133
tableBuilder.AddEntry(input,
EntryState
.Added, TimeSpan.Zero, stepInputs: default,
EntryState
.Added);
SourceGeneration\Nodes\ISyntaxStrategy.cs (1)
20
void VisitTree(Lazy<SyntaxNode> root,
EntryState
state, Lazy<SemanticModel>? model, CancellationToken cancellationToken);
SourceGeneration\Nodes\NodeStateTable.cs (68)
56
internal readonly record struct NodeStateEntry<T>(T Item,
EntryState
State, int OutputIndex, IncrementalGeneratorRunStep? Step);
210
EntryState
.Added => 'A',
211
EntryState
.Removed => 'R',
212
EntryState
.Modified => 'M',
213
EntryState
.Cached => 'C',
281
RecordStepInfoForLastEntry(elapsedTime, stepInputs,
EntryState
.Removed);
308
RecordStepInfoForLastEntry(elapsedTime, stepInputs,
EntryState
.Cached);
324
public bool TryModifyEntry(T value, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState)
345
public bool TryModifyEntries(ImmutableArray<T> outputs, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState)
365
RecordStepInfoForLastEntry(elapsedTime, stepInputs,
EntryState
.Cached);
385
var
previousState = previousEntry.GetState(i);
418
builder!.Add(previousEntry.GetItem(i),
EntryState
.Removed);
426
builder!.Add(outputs[i],
EntryState
.Added);
437
public bool TryModifyEntries(ImmutableArray<T> outputs, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState, out TableEntry entry)
449
public void AddEntry(T value,
EntryState
state, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState)
452
_insertedCount += state ==
EntryState
.Added ? 1 : 0;
456
public TableEntry AddEntries(ImmutableArray<T> values,
EntryState
state, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState)
460
_insertedCount += state ==
EntryState
.Added ? 1 : 0;
476
private void RecordStepInfoForLastEntry(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState)
504
private static IncrementalStepRunReason AsStepState(
EntryState
inputState,
EntryState
outputState)
508
(
EntryState
.Added,
EntryState
.Added) => IncrementalStepRunReason.New,
509
(
EntryState
.Modified,
EntryState
.Modified) => IncrementalStepRunReason.Modified,
510
(
EntryState
.Modified,
EntryState
.Cached) => IncrementalStepRunReason.Unchanged,
511
(
EntryState
.Cached,
EntryState
.Cached) => IncrementalStepRunReason.Cached,
512
(
EntryState
.Removed,
EntryState
.Removed) => IncrementalStepRunReason.Removed,
513
(
EntryState
.Modified,
EntryState
.Removed) => IncrementalStepRunReason.Removed,
514
(
EntryState
.Modified,
EntryState
.Added) => IncrementalStepRunReason.New,
558
private (T chosen,
EntryState
state, bool chosePrevious) GetModifiedItemAndState(T previous, T replacement)
563
? (previous,
EntryState
.Cached, chosePrevious: true)
564
: (replacement,
EntryState
.Modified, chosePrevious: false);
570
private static readonly ImmutableArray<
EntryState
> s_allAddedEntries = ImmutableArray.Create(
EntryState
.Added);
571
private static readonly ImmutableArray<
EntryState
> s_allCachedEntries = ImmutableArray.Create(
EntryState
.Cached);
572
private static readonly ImmutableArray<
EntryState
> s_allModifiedEntries = ImmutableArray.Create(
EntryState
.Modified);
577
private static readonly ImmutableArray<
EntryState
> s_allRemovedEntries = ImmutableArray.Create(
EntryState
.Removed);
582
private static readonly ImmutableArray<
EntryState
> s_allRemovedDueToInputRemoval = ImmutableArray.Create(
EntryState
.Removed);
591
private readonly ImmutableArray<
EntryState
> _states;
593
public TableEntry(OneOrMany<T> items,
EntryState
state)
594
: this(items, GetSingleArray(state), anyRemoved: state ==
EntryState
.Removed) { }
596
private TableEntry(OneOrMany<T> items, ImmutableArray<
EntryState
> states, bool anyRemoved)
623
public bool IsCached => this._states == s_allCachedEntries || this._states.All(s => s ==
EntryState
.Cached);
631
public
EntryState
GetState(int index) => _states.Length == 1 ? _states[0] : _states[index];
645
if (this.GetState(i) !=
EntryState
.Removed)
657
private static ImmutableArray<
EntryState
> GetSingleArray(
EntryState
state) => state switch
659
EntryState
.Added => s_allAddedEntries,
660
EntryState
.Cached => s_allCachedEntries,
661
EntryState
.Modified => s_allModifiedEntries,
662
EntryState
.Removed => s_allRemovedEntries,
723
private ArrayBuilder<
EntryState
>? _states;
724
private
EntryState
? _currentState;
735
public void Add(T item,
EntryState
state)
738
_anyRemoved |= state ==
EntryState
.Removed;
751
_states = ArrayBuilder<
EntryState
>.GetInstance(_requestedCapacity);
SourceGeneration\Nodes\PredicateSyntaxStrategy.cs (11)
63
EntryState
state,
69
if (state ==
EntryState
.Removed)
83
if (state !=
EntryState
.Cached || !_filterTable.TryUseCachedEntries(TimeSpan.Zero, noInputStepsStepInfo, out NodeStateTable<SyntaxNode>.TableEntry entry))
88
if (state !=
EntryState
.Modified || !_filterTable.TryModifyEntries(nodes, stopwatch.Elapsed, noInputStepsStepInfo, state, out entry))
97
if (entry.GetState(i) ==
EntryState
.Removed)
109
var
transformInputState = state ==
EntryState
.Cached ?
EntryState
.Modified : state;
111
if (transformInputState ==
EntryState
.Added || !_transformTable.TryModifyEntry(transformed, stopwatch.Elapsed, noInputStepsStepInfo, transformInputState))
113
_transformTable.AddEntry(transformed,
EntryState
.Added, stopwatch.Elapsed, noInputStepsStepInfo,
EntryState
.Added);
SourceGeneration\Nodes\SourceOutputNode.cs (6)
58
if (entry.State ==
EntryState
.Removed)
62
else if (entry.State !=
EntryState
.Cached || !tableBuilder.TryUseCachedEntries(TimeSpan.Zero, inputs))
74
if (entry.State !=
EntryState
.Modified || !tableBuilder.TryModifyEntry(sourcesAndDiagnostics, stopwatch.Elapsed, inputs, entry.State))
76
tableBuilder.AddEntry(sourcesAndDiagnostics,
EntryState
.Added, stopwatch.Elapsed, inputs,
EntryState
.Added);
107
if (state !=
EntryState
.Removed)
SourceGeneration\Nodes\SyntaxReceiverStrategy.cs (4)
63
_nodeStateTable.AddEntry(_receiver,
EntryState
.Modified, lastElapsedTime, TrackIncrementalSteps ? System.Collections.Immutable.ImmutableArray<(IncrementalGeneratorRunStep, int)>.Empty : default,
EntryState
.Modified);
69
EntryState
state,
73
if (_walker is not null && state !=
EntryState
.Removed)
SourceGeneration\Nodes\TransformNode.cs (4)
72
if (entry.State ==
EntryState
.Removed)
76
else if (entry.State !=
EntryState
.Cached || !tableBuilder.TryUseCachedEntries(TimeSpan.Zero, inputs))
90
if (entry.State !=
EntryState
.Modified || !tableBuilder.TryModifyEntries(newOutputs, stopwatch.Elapsed, inputs, entry.State))
92
tableBuilder.AddEntries(newOutputs,
EntryState
.Added, stopwatch.Elapsed, inputs, entry.State);
SourceGeneration\SyntaxStore.cs (1)
90
var model = state !=
EntryState
.Removed ? new Lazy<SemanticModel>(() => _compilation.GetSemanticModel(tree)) : null;