Looks up some Library that is reexporting this Element; not
necessarily the canonical Library.
Source
Library findLibraryFor(Element element) {
// Maybe we were given an element we already saw, or an element for the
// Library itself added by the constructor in [ModelElement.from].
if (_elementToLibrary.containsKey(element)) {
return _elementToLibrary[element];
}
Library foundLibrary;
if (libraryElementReexportedBy.containsKey(element.library)) {
Set<Library> exportedIn = libraryElementReexportedBy[element.library];
foundLibrary = exportedIn.firstWhere(
(l) =>
l.element.location.components[0] ==
element.library.location.components[0],
orElse: () => null);
}
if (foundLibrary != null) _elementToLibrary[element] = foundLibrary;
return foundLibrary;
}