File tree Expand file tree Collapse file tree 5 files changed +5
-24
lines changed
analysis_server/lib/src/services/correction Expand file tree Collapse file tree 5 files changed +5
-24
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ class _MergeCombinators extends ResolvedCorrectionProducer {
100100 if (element is ! LibraryElementImpl ) {
101101 return ;
102102 }
103- originalNamespace = _originalNamespace ( element) ;
103+ originalNamespace = element.exportNamespace ;
104104 namespace = _currentNamespace (libraryExport).definedNames2;
105105 case ImportDirective (: var libraryImport? ):
106106 namespace = getImportNamespace (libraryImport);
@@ -118,7 +118,7 @@ class _MergeCombinators extends ResolvedCorrectionProducer {
118118 return ;
119119 }
120120
121- originalNamespace ?? = _originalNamespace ( element) ;
121+ originalNamespace ?? = element.exportNamespace ;
122122
123123 var explicitlyHiddenNames = directive.hideCombinators.hiddenNames;
124124
@@ -156,10 +156,6 @@ class _MergeCombinators extends ResolvedCorrectionProducer {
156156 Namespace _currentNamespace (LibraryExportImpl libraryExport) {
157157 return namespaceBuilder.createExportNamespaceForDirective2 (libraryExport);
158158 }
159-
160- Namespace _originalNamespace (LibraryElementImpl element) {
161- return namespaceBuilder.createExportNamespaceForLibrary (element);
162- }
163159}
164160
165161extension on Namespace {
Original file line number Diff line number Diff line change 44
55import 'package:analyzer/dart/ast/ast.dart' ;
66import 'package:analyzer/dart/element/element.dart' ;
7- import 'package:analyzer/src/dart/element/element.dart' ;
8- import 'package:analyzer/src/dart/resolver/scope.dart' ;
97
108/// Returns the [Element] exported from the given [LibraryElement] .
119Element ? getExportedElement (LibraryElement ? library, String name) {
1210 if (library == null ) {
1311 return null ;
1412 }
15- library as LibraryElementImpl ;
16- var namespace = NamespaceBuilder ().createExportNamespaceForLibrary (library);
17- return namespace.definedNames2[name];
13+ return library.exportNamespace.get2 (name);
1814}
1915
2016/// Return the [LibraryImport] that is referenced by [prefixNode] , or
Original file line number Diff line number Diff line change @@ -153,13 +153,6 @@ class NamespaceBuilder {
153153 return Namespace (exportedNames);
154154 }
155155
156- /// Create a namespace representing the export namespace of the given
157- /// [library] .
158- Namespace createExportNamespaceForLibrary (LibraryElementImpl library) {
159- var exportedNames = _getExportMapping (library);
160- return Namespace (exportedNames);
161- }
162-
163156 /// Create a namespace representing the import namespace of the given
164157 /// [importedLibrary] .
165158 Namespace createImportNamespaceForDirective ({
Original file line number Diff line number Diff line change @@ -138,9 +138,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<void> {
138138 /// Resolve the names in the given [combinator] in the scope of the given
139139 /// [library] .
140140 void _checkCombinator (LibraryElementImpl library, Combinator combinator) {
141- Namespace namespace = NamespaceBuilder ().createExportNamespaceForLibrary (
142- library,
143- );
141+ Namespace namespace = library.exportNamespace;
144142 NodeList <SimpleIdentifier > names;
145143 DiagnosticCode warningCode;
146144 if (combinator is HideCombinator ) {
Original file line number Diff line number Diff line change @@ -456,9 +456,7 @@ class ElementResolver {
456456 //
457457 return ;
458458 }
459- Namespace namespace = NamespaceBuilder ().createExportNamespaceForLibrary (
460- library,
461- );
459+ Namespace namespace = library.exportNamespace;
462460 for (Combinator combinator in combinators) {
463461 NodeList <SimpleIdentifier > names;
464462 if (combinator is HideCombinator ) {
You can’t perform that action at this time.
0 commit comments