getTopLevelDeclarations method

Future<Map<LibraryElement, Element>> getTopLevelDeclarations(
  1. String name
)

Returns the mapping from each library (that is available to this context) to a top-level declaration that is exported (not necessary declared) by this library, and has the requested base name.

For getters and setters the corresponding top-level variable is returned.

Implementation

Future<Map<LibraryElement, Element>> getTopLevelDeclarations(String name) {
  var cachedResult = _cachedTopLevelDeclarations[name];
  if (cachedResult != null) return cachedResult;
  var result = TopLevelDeclarations(unitResult).withName(name);
  _cachedTopLevelDeclarations[name] = result;
  return result;
}