-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Don't treat SyntaxProvider transform step inputs as cached. #58935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,7 +101,11 @@ public void VisitTree(Lazy<SyntaxNode> root, EntryState state, SemanticModel? mo | |
| var value = new GeneratorSyntaxContext(node, model); | ||
| var transformed = _owner._transformFunc(value, cancellationToken); | ||
|
|
||
| if (state == EntryState.Added || !_transformTable.TryModifyEntry(transformed, _owner._comparer, stopwatch.Elapsed, noInputStepsStepInfo, state)) | ||
| // The SemanticModel we provide to GeneratorSyntaxContext is never guaranteed to be the same between runs, | ||
| // so we never consider the input to the transform as cached. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the caller of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The passed-in The |
||
| var transformInputState = state == EntryState.Cached ? EntryState.Modified : state; | ||
|
|
||
| if (transformInputState == EntryState.Added || !_transformTable.TryModifyEntry(transformed, _owner._comparer, stopwatch.Elapsed, noInputStepsStepInfo, transformInputState)) | ||
| { | ||
| _transformTable.AddEntry(transformed, EntryState.Added, stopwatch.Elapsed, noInputStepsStepInfo, EntryState.Added); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to support this optimization with incremental tracking? (Is this the TODO in
DriverStateTable.Builder.GetSyntaxInputTable()?) If so, is there an issue logged to track that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to support this optimization with incremental tracking as incremental tracking is meant to be a test-only feature, but it would be a "nice to have" feature if the implementation of it becomes simpler in a future refactoring.
This is the TODO in
GetSyntaxInputTable(). There currently isn't an issue logged for it as it's not a required feature.