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, _comparer, 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, _comparer, 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], _comparer, 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)
55
internal readonly record struct NodeStateEntry<T>(T Item,
EntryState
State, int OutputIndex, IncrementalGeneratorRunStep? Step);
209
EntryState
.Added => 'A',
210
EntryState
.Removed => 'R',
211
EntryState
.Modified => 'M',
212
EntryState
.Cached => 'C',
280
RecordStepInfoForLastEntry(elapsedTime, stepInputs,
EntryState
.Removed);
307
RecordStepInfoForLastEntry(elapsedTime, stepInputs,
EntryState
.Cached);
323
public bool TryModifyEntry(T value, IEqualityComparer<T> comparer, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState)
344
public bool TryModifyEntries(ImmutableArray<T> outputs, IEqualityComparer<T> comparer, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState)
364
RecordStepInfoForLastEntry(elapsedTime, stepInputs,
EntryState
.Cached);
384
var
previousState = previousEntry.GetState(i);
417
builder!.Add(previousEntry.GetItem(i),
EntryState
.Removed);
425
builder!.Add(outputs[i],
EntryState
.Added);
436
public bool TryModifyEntries(ImmutableArray<T> outputs, IEqualityComparer<T> comparer, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState, out TableEntry entry)
448
public void AddEntry(T value,
EntryState
state, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState)
451
_insertedCount += state ==
EntryState
.Added ? 1 : 0;
455
public TableEntry AddEntries(ImmutableArray<T> values,
EntryState
state, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState)
459
_insertedCount += state ==
EntryState
.Added ? 1 : 0;
475
private void RecordStepInfoForLastEntry(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs,
EntryState
overallInputState)
503
private static IncrementalStepRunReason AsStepState(
EntryState
inputState,
EntryState
outputState)
507
(
EntryState
.Added,
EntryState
.Added) => IncrementalStepRunReason.New,
508
(
EntryState
.Modified,
EntryState
.Modified) => IncrementalStepRunReason.Modified,
509
(
EntryState
.Modified,
EntryState
.Cached) => IncrementalStepRunReason.Unchanged,
510
(
EntryState
.Cached,
EntryState
.Cached) => IncrementalStepRunReason.Cached,
511
(
EntryState
.Removed,
EntryState
.Removed) => IncrementalStepRunReason.Removed,
512
(
EntryState
.Modified,
EntryState
.Removed) => IncrementalStepRunReason.Removed,
513
(
EntryState
.Modified,
EntryState
.Added) => IncrementalStepRunReason.New,
557
private static (T chosen,
EntryState
state, bool chosePrevious) GetModifiedItemAndState(T previous, T replacement, IEqualityComparer<T> comparer)
562
? (previous,
EntryState
.Cached, chosePrevious: true)
563
: (replacement,
EntryState
.Modified, chosePrevious: false);
569
private static readonly ImmutableArray<
EntryState
> s_allAddedEntries = ImmutableArray.Create(
EntryState
.Added);
570
private static readonly ImmutableArray<
EntryState
> s_allCachedEntries = ImmutableArray.Create(
EntryState
.Cached);
571
private static readonly ImmutableArray<
EntryState
> s_allModifiedEntries = ImmutableArray.Create(
EntryState
.Modified);
576
private static readonly ImmutableArray<
EntryState
> s_allRemovedEntries = ImmutableArray.Create(
EntryState
.Removed);
581
private static readonly ImmutableArray<
EntryState
> s_allRemovedDueToInputRemoval = ImmutableArray.Create(
EntryState
.Removed);
590
private readonly ImmutableArray<
EntryState
> _states;
592
public TableEntry(OneOrMany<T> items,
EntryState
state)
593
: this(items, GetSingleArray(state), anyRemoved: state ==
EntryState
.Removed) { }
595
private TableEntry(OneOrMany<T> items, ImmutableArray<
EntryState
> states, bool anyRemoved)
622
public bool IsCached => this._states == s_allCachedEntries || this._states.All(s => s ==
EntryState
.Cached);
630
public
EntryState
GetState(int index) => _states.Length == 1 ? _states[0] : _states[index];
644
if (this.GetState(i) !=
EntryState
.Removed)
656
private static ImmutableArray<
EntryState
> GetSingleArray(
EntryState
state) => state switch
658
EntryState
.Added => s_allAddedEntries,
659
EntryState
.Cached => s_allCachedEntries,
660
EntryState
.Modified => s_allModifiedEntries,
661
EntryState
.Removed => s_allRemovedEntries,
722
private ArrayBuilder<
EntryState
>? _states;
723
private
EntryState
? _currentState;
734
public void Add(T item,
EntryState
state)
737
_anyRemoved |= state ==
EntryState
.Removed;
750
_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, Roslyn.Utilities.ReferenceEqualityComparer.Instance, 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, _comparer, 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, EqualityComparer<TOutput>.Default, 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, _comparer, 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;