@@ -8,7 +8,7 @@ import 'package:analysis_server/src/services/completion/dart/completion_state.da
88import 'package:analysis_server/src/services/completion/dart/declaration_helper.dart' ;
99import 'package:analysis_server/src/services/completion/dart/suggestion_collector.dart' ;
1010import 'package:analyzer/dart/analysis/results.dart' ;
11- import 'package:analyzer/dart/element/element .dart' ;
11+ import 'package:analyzer/dart/element/element2 .dart' ;
1212import 'package:analyzer/dart/element/type.dart' ;
1313import 'package:analyzer/src/dart/analysis/file_state.dart' ;
1414import 'package:analyzer/src/dart/analysis/file_state_filter.dart' ;
@@ -26,7 +26,7 @@ class ConstructorsOperation extends NotImportedOperation {
2626 : _declarationHelper = declarationHelper;
2727
2828 /// Compute any candidate suggestions for elements in the [library] .
29- void computeSuggestionsIn (LibraryElement library) {
29+ void computeSuggestionsIn (LibraryElement2 library) {
3030 _declarationHelper.addNotImportedConstructors (library);
3131 }
3232}
@@ -62,7 +62,7 @@ class InstanceExtensionMembersOperation extends NotImportedOperation {
6262 _includeSetters = includeSetters;
6363
6464 /// Compute any candidate suggestions for elements in the [library] .
65- void computeSuggestionsIn (LibraryElement library) {
65+ void computeSuggestionsIn (LibraryElement2 library) {
6666 _declarationHelper.addNotImportedExtensionMethods (
6767 library: library,
6868 type: _type,
@@ -137,8 +137,8 @@ class NotImportedCompletionPass {
137137 continue ;
138138 }
139139
140- var library = request.libraryElement ;
141- var element = elementResult.element ;
140+ var library = request.libraryElement2 ;
141+ var element = elementResult.element2 ;
142142 if (element == library) {
143143 // Don't suggest elements from the library in which completion is being
144144 // requested. They've already been suggested.
@@ -166,7 +166,7 @@ class NotImportedCompletionPass {
166166 }
167167
168168 var exportNamespace = element.exportNamespace;
169- var exportElements = exportNamespace.definedNames .values.toList ();
169+ var exportElements = exportNamespace.definedNames2 .values.toList ();
170170
171171 performance.run ('staticMembers' , (_) {
172172 operation.computeSuggestionsIn (
@@ -198,9 +198,9 @@ class StaticMembersOperation extends NotImportedOperation {
198198
199199 /// Compute any candidate suggestions for elements in the [library] .
200200 void computeSuggestionsIn (
201- LibraryElement library,
202- List <Element > exportElements,
203- Set <Element > importedElements,
201+ LibraryElement2 library,
202+ List <Element2 > exportElements,
203+ Set <Element2 > importedElements,
204204 ) {
205205 // TODO(brianwilkerson): Determine whether we need the element parameters.
206206 _declarationHelper.addNotImportedTopLevelDeclarations (library);
@@ -211,19 +211,21 @@ class StaticMembersOperation extends NotImportedOperation {
211211class _ImportSummary {
212212 /// The elements that are imported from libraries that are only partially
213213 /// imported.
214- Set <Element > importedElements = Set <Element >.identity ();
214+ Set <Element2 > importedElements = Set <Element2 >.identity ();
215215
216216 /// The libraries that are imported in their entirety.
217- Set <LibraryElement > importedLibraries = Set <LibraryElement >.identity ();
218-
219- _ImportSummary (LibraryElement library) {
220- for (var import in library.definingCompilationUnit.libraryImports) {
221- var importedLibrary = import.importedLibrary;
222- if (importedLibrary != null ) {
223- if (import.combinators.isEmpty) {
224- importedLibraries.add (importedLibrary);
225- } else {
226- importedElements.addAll (import.namespace.definedNames.values);
217+ Set <LibraryElement2 > importedLibraries = Set <LibraryElement2 >.identity ();
218+
219+ _ImportSummary (LibraryElement2 library) {
220+ for (var fragment in library.fragments) {
221+ for (var import in fragment.libraryImports2) {
222+ var importedLibrary = import.importedLibrary2;
223+ if (importedLibrary != null ) {
224+ if (import.combinators.isEmpty) {
225+ importedLibraries.add (importedLibrary);
226+ } else {
227+ importedElements.addAll (import.namespace.definedNames2.values);
228+ }
227229 }
228230 }
229231 }
0 commit comments