-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine the two implementations of "library canonicalization" (#3781)
I was shocked to find that we had two mechanisms for determining an element's "canonical library": `ModelElement.canonicalLibrary` and a `PackageGraph._findCanonicalLibraryFor`. They were not quite the same implementation, but the differences turn out to be uninteresting; the two implementations can be combined. This change removes `PackageGraph._findCanonicalLibraryFor`. This implementation was only used in the package graph to find the canonical element for a given element. That code can now just use `ModelElement.canonicalLibrary`. It requires a fair bit of refactoring all over: * `PackageGraph.findCanonicalModelElementFor` previously accepted an analyzer Element, instead of a ModelElement, but almost all of the call sites used `foo.element` or some other expression that could easily be replaced with an access to a ModelElement instead of the correlated Element. * Document `ModelElement.definingLibrary`, `ModelElement.canonicalLibrary`, `ModelElement._searchForCanonicalLibrary`. * Simplify `ContainerMember.computeCanonicalEnclosingContainer` to stop unnecessarily special-casing extensions and extension types. * Simplify lookup component of `ModelElement._searchForCanonicalLibrary`. * Simplity `ContainerMember.referenceGrandparentOverrides` to not use `sync*`. * Move the top-level `findCanonicalFor` function out of `model_utils.dart` and into `inheriting_container.dart`, the only code that uses it anymore.
- Loading branch information
Showing
8 changed files
with
93 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters