Create LibraryScope once per library analyzer.

R=brianwilkerson@google.com

Change-Id: I1f84b2df53834f98e98defbb61e89a2396b2ca3a
Reviewed-on: https://dart-review.googlesource.com/c/79182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2018-10-11 14:13:10 +00:00 committed by commit-bot@chromium.org
parent 7c7df7bfa4
commit 5e1bf1d135

View file

@ -51,6 +51,7 @@ class LibraryAnalyzer {
final TypeProvider _typeProvider;
LibraryElement _libraryElement;
LibraryScope _libraryScope;
final Map<FileState, LineInfo> _fileToLineInfo = {};
final Map<FileState, IgnoreInfo> _fileToIgnoreInfo = {};
@ -100,6 +101,7 @@ class LibraryAnalyzer {
try {
_libraryElement = _resynthesizer
.getElement(new ElementLocationImpl.con3([_library.uriStr]));
_libraryScope = new LibraryScope(_libraryElement);
_resolveDirectives(units);
@ -575,10 +577,9 @@ class LibraryAnalyzer {
new DeclarationResolver().resolve(unit, unitElement);
LibraryScope libraryScope = new LibraryScope(_libraryElement);
unit.accept(new AstRewriteVisitor(_context.typeSystem, _libraryElement,
source, _typeProvider, errorListener,
nameScope: libraryScope));
nameScope: _libraryScope));
// TODO(scheglov) remove EnumMemberBuilder class
@ -591,7 +592,7 @@ class LibraryAnalyzer {
unit.accept(new VariableResolverVisitor(
_libraryElement, source, _typeProvider, errorListener,
nameScope: libraryScope));
nameScope: _libraryScope));
unit.accept(new PartialResolverVisitor(_inheritance, _libraryElement,
source, _typeProvider, AnalysisErrorListener.NULL_LISTENER));