From 5e1bf1d135b7069fae7772f564cd620dd39b73b9 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Thu, 11 Oct 2018 14:13:10 +0000 Subject: [PATCH] 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 Commit-Queue: Konstantin Shcheglov --- pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart index bdd8592762a..4b67c8c0fc3 100644 --- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart +++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart @@ -51,6 +51,7 @@ class LibraryAnalyzer { final TypeProvider _typeProvider; LibraryElement _libraryElement; + LibraryScope _libraryScope; final Map _fileToLineInfo = {}; final Map _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));