Skip to content

Commit

Permalink
PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
chsienki committed Feb 1, 2022
1 parent 6d6bb05 commit 2e2dee4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ class F
}

[Fact]
public void IncrementalGenerator_With_Syntax_Filter_Doesnt_Run_When_Compiation_Is_Unchanged()
public void IncrementalGenerator_With_Syntax_Filter_Doesnt_Run_When_Compilation_Is_Unchanged()
{
var source1 = @"
#pragma warning disable CS0414
Expand Down Expand Up @@ -1407,7 +1407,10 @@ class E
});
});

GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { new IncrementalGeneratorWrapper(testGenerator) }, parseOptions: parseOptions, driverOptions: new GeneratorDriverOptions(IncrementalGeneratorOutputKind.None, trackIncrementalGeneratorSteps: true));
GeneratorDriver driver = CSharpGeneratorDriver.Create(
new[] { new IncrementalGeneratorWrapper(testGenerator) },
parseOptions: parseOptions,
driverOptions: new GeneratorDriverOptions(IncrementalGeneratorOutputKind.None, trackIncrementalGeneratorSteps: true));
driver = driver.RunGenerators(compilation);

var results = driver.GetRunResult();
Expand Down Expand Up @@ -1525,7 +1528,10 @@ class C
});
});

GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { new IncrementalGeneratorWrapper(testGenerator) }, parseOptions: parseOptions, driverOptions: new GeneratorDriverOptions(IncrementalGeneratorOutputKind.None, trackIncrementalGeneratorSteps: true));
GeneratorDriver driver = CSharpGeneratorDriver.Create(
new[] { new IncrementalGeneratorWrapper(testGenerator) },
parseOptions: parseOptions,
driverOptions: new GeneratorDriverOptions(IncrementalGeneratorOutputKind.None, trackIncrementalGeneratorSteps: true));
driver = driver.RunGenerators(compilation);
var results = driver.GetRunResult();
Assert.Collection(results.Results[0].TrackedSteps["Fields"],
Expand Down
6 changes: 3 additions & 3 deletions src/Compilers/Core/Portable/SourceGeneration/SyntaxStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public IStateTable GetSyntaxInputTable(SyntaxInputNode syntaxInputNode, NodeStat
var syntaxInputBuilders = ArrayBuilder<(SyntaxInputNode node, ISyntaxInputBuilder builder)>.GetInstance(_syntaxInputNodes.Length);
foreach (var node in _syntaxInputNodes)
{
// TODO: We don't cache the tracked incremental steps in a manner that we can easily rehydrate between runs,
// so we'll disable the cached compilation perf optimization when incremental step tracking is enabled.
// We don't cache the tracked incremental steps in a manner that we can easily rehydrate between runs,
// so we disable the cached compilation perf optimization when incremental step tracking is enabled.
if (compilationIsCached && !_enableTracking && _previous._tables.TryGetValue(node, out var previousStateTable))
{
_tableBuilder.SetTable(node, previousStateTable);
Expand All @@ -80,7 +80,7 @@ public IStateTable GetSyntaxInputTable(SyntaxInputNode syntaxInputNode, NodeStat
NodeStateTable<SyntaxTree> syntaxTreeState = syntaxTreeTable;

// update each tree for the builders, sharing the semantic model
foreach ((var tree, var state, var syntaxTreeIndex, var stepInfo) in syntaxTreeState)
foreach (var (tree, state, syntaxTreeIndex, stepInfo) in syntaxTreeState)
{
var root = new Lazy<SyntaxNode>(() => tree.GetRoot(_cancellationToken));
var model = state != EntryState.Removed ? _compilation.GetSemanticModel(tree) : null;
Expand Down

0 comments on commit 2e2dee4

Please sign in to comment.