119 references to EntryState
Microsoft.CodeAnalysis (119)
SourceGeneration\Nodes\BatchNode.cs (8)
48if (entry.State != EntryState.Removed) 76if (entry.State == EntryState.Removed) 100if (entry.State == EntryState.Removed) 135tableBuilder.AddEntry(sourceValues, EntryState.Added, stopwatch.Elapsed, sourceInputs, EntryState.Added); 139if (!tableBuilder.TryModifyEntry(sourceValues, _comparer, stopwatch.Elapsed, sourceInputs, EntryState.Modified)) 141tableBuilder.AddEntry(sourceValues, EntryState.Added, stopwatch.Elapsed, sourceInputs, EntryState.Added);
SourceGeneration\Nodes\CombineNode.cs (6)
67var state = (entry1.State, isInput2Cached) switch 69(EntryState.Cached, true) => EntryState.Cached, 70(EntryState.Cached, false) => EntryState.Modified, 75if (state != EntryState.Modified || _comparer is null || !tableBuilder.TryModifyEntry(entry, _comparer, stopwatch.Elapsed, stepInputs, state))
SourceGeneration\Nodes\HostOutputNode.cs (5)
50if (entry.State == EntryState.Removed) 54else if (entry.State != EntryState.Cached || !nodeTable.TryUseCachedEntries(TimeSpan.Zero, inputs)) 60nodeTable.AddEntry(output.ToImmutableAndFree(), EntryState.Added, stopwatch.Elapsed, inputs, EntryState.Added); 76if (state != EntryState.Removed)
SourceGeneration\Nodes\InputNode.cs (5)
86var modified = tableBuilder.TryModifyEntry(inputItems[itemIndex], _comparer, elapsedTime, noInputStepsStepInfo, EntryState.Modified); 102tableBuilder.AddEntry(newItem, EntryState.Added, elapsedTime, noInputStepsStepInfo, EntryState.Added); 133tableBuilder.AddEntry(input, EntryState.Added, TimeSpan.Zero, stepInputs: default, EntryState.Added);
SourceGeneration\Nodes\ISyntaxStrategy.cs (1)
20void VisitTree(Lazy<SyntaxNode> root, EntryState state, Lazy<SemanticModel>? model, CancellationToken cancellationToken);
SourceGeneration\Nodes\NodeStateTable.cs (68)
55internal readonly record struct NodeStateEntry<T>(T Item, EntryState State, int OutputIndex, IncrementalGeneratorRunStep? Step); 209EntryState.Added => 'A', 210EntryState.Removed => 'R', 211EntryState.Modified => 'M', 212EntryState.Cached => 'C', 280RecordStepInfoForLastEntry(elapsedTime, stepInputs, EntryState.Removed); 307RecordStepInfoForLastEntry(elapsedTime, stepInputs, EntryState.Cached); 323public bool TryModifyEntry(T value, IEqualityComparer<T> comparer, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState) 344public bool TryModifyEntries(ImmutableArray<T> outputs, IEqualityComparer<T> comparer, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState) 364RecordStepInfoForLastEntry(elapsedTime, stepInputs, EntryState.Cached); 384var previousState = previousEntry.GetState(i); 417builder!.Add(previousEntry.GetItem(i), EntryState.Removed); 425builder!.Add(outputs[i], EntryState.Added); 436public bool TryModifyEntries(ImmutableArray<T> outputs, IEqualityComparer<T> comparer, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState, out TableEntry entry) 448public void AddEntry(T value, EntryState state, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState) 451_insertedCount += state == EntryState.Added ? 1 : 0; 455public TableEntry AddEntries(ImmutableArray<T> values, EntryState state, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState) 459_insertedCount += state == EntryState.Added ? 1 : 0; 475private void RecordStepInfoForLastEntry(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState) 503private 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, 557private 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); 569private static readonly ImmutableArray<EntryState> s_allAddedEntries = ImmutableArray.Create(EntryState.Added); 570private static readonly ImmutableArray<EntryState> s_allCachedEntries = ImmutableArray.Create(EntryState.Cached); 571private static readonly ImmutableArray<EntryState> s_allModifiedEntries = ImmutableArray.Create(EntryState.Modified); 576private static readonly ImmutableArray<EntryState> s_allRemovedEntries = ImmutableArray.Create(EntryState.Removed); 581private static readonly ImmutableArray<EntryState> s_allRemovedDueToInputRemoval = ImmutableArray.Create(EntryState.Removed); 590private readonly ImmutableArray<EntryState> _states; 592public TableEntry(OneOrMany<T> items, EntryState state) 593: this(items, GetSingleArray(state), anyRemoved: state == EntryState.Removed) { } 595private TableEntry(OneOrMany<T> items, ImmutableArray<EntryState> states, bool anyRemoved) 622public bool IsCached => this._states == s_allCachedEntries || this._states.All(s => s == EntryState.Cached); 630public EntryState GetState(int index) => _states.Length == 1 ? _states[0] : _states[index]; 644if (this.GetState(i) != EntryState.Removed) 656private static ImmutableArray<EntryState> GetSingleArray(EntryState state) => state switch 658EntryState.Added => s_allAddedEntries, 659EntryState.Cached => s_allCachedEntries, 660EntryState.Modified => s_allModifiedEntries, 661EntryState.Removed => s_allRemovedEntries, 722private ArrayBuilder<EntryState>? _states; 723private EntryState? _currentState; 734public void Add(T item, EntryState state) 737_anyRemoved |= state == EntryState.Removed; 750_states = ArrayBuilder<EntryState>.GetInstance(_requestedCapacity);
SourceGeneration\Nodes\PredicateSyntaxStrategy.cs (11)
63EntryState state, 69if (state == EntryState.Removed) 83if (state != EntryState.Cached || !_filterTable.TryUseCachedEntries(TimeSpan.Zero, noInputStepsStepInfo, out NodeStateTable<SyntaxNode>.TableEntry entry)) 88if (state != EntryState.Modified || !_filterTable.TryModifyEntries(nodes, Roslyn.Utilities.ReferenceEqualityComparer.Instance, stopwatch.Elapsed, noInputStepsStepInfo, state, out entry)) 97if (entry.GetState(i) == EntryState.Removed) 109var transformInputState = state == EntryState.Cached ? EntryState.Modified : state; 111if (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)
58if (entry.State == EntryState.Removed) 62else if (entry.State != EntryState.Cached || !tableBuilder.TryUseCachedEntries(TimeSpan.Zero, inputs)) 74if (entry.State != EntryState.Modified || !tableBuilder.TryModifyEntry(sourcesAndDiagnostics, EqualityComparer<TOutput>.Default, stopwatch.Elapsed, inputs, entry.State)) 76tableBuilder.AddEntry(sourcesAndDiagnostics, EntryState.Added, stopwatch.Elapsed, inputs, EntryState.Added); 107if (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); 69EntryState state, 73if (_walker is not null && state != EntryState.Removed)
SourceGeneration\Nodes\TransformNode.cs (4)
72if (entry.State == EntryState.Removed) 76else if (entry.State != EntryState.Cached || !tableBuilder.TryUseCachedEntries(TimeSpan.Zero, inputs)) 90if (entry.State != EntryState.Modified || !tableBuilder.TryModifyEntries(newOutputs, _comparer, stopwatch.Elapsed, inputs, entry.State)) 92tableBuilder.AddEntries(newOutputs, EntryState.Added, stopwatch.Elapsed, inputs, entry.State);
SourceGeneration\SyntaxStore.cs (1)
90var model = state != EntryState.Removed ? new Lazy<SemanticModel>(() => _compilation.GetSemanticModel(tree)) : null;