Remove use of NodeLocator2 #3538
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we first resolve a library, we have full access to both the LibraryElement and the CompilationUnit (AST nodes) objects. We should use those pronto, rather than painstakingly recalculate them with NodeLocator2.
This is a pretty big ball of wax. But this is one step in untangling it. Almost everything we need to know about source elements in Dartdoc is on the element model, with two exceptions:
documentationComment
fields only contain the documentation comment text; it's a String. To get knowledge about comment references, we have to go back to the syntax tree.To hang onto some of this syntax tree data, without hanging onto any AST nodes, we do some pre-processing into ModelNode objects. This pre-processing is led by Library.fromLibraryResult. It used to use an ElementVisitor named
_HashableChildLibraryElementVisitor
. This is simpler now, and called_ModelNodeGatherer
.Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.