Index: pkg/analysis_server/lib/src/services/index2/index2.dart |
diff --git a/pkg/analysis_server/lib/src/services/index2/index2.dart b/pkg/analysis_server/lib/src/services/index2/index2.dart |
index d8e40c2cb2c3d24b55d3bcb818a65a1ca5a7b24c..975939f390337109b2c1e0764ae2c0699410b131 100644 |
--- a/pkg/analysis_server/lib/src/services/index2/index2.dart |
+++ b/pkg/analysis_server/lib/src/services/index2/index2.dart |
@@ -80,6 +80,23 @@ class Index2 { |
} |
/** |
+ * Complete with a list of locations where a class members with the given |
+ * [name] is referenced with a qualifier, but is not resolved. |
+ */ |
+ Future<List<Location>> getUnresolvedMemberReferences(String name) async { |
+ List<Location> locations = <Location>[]; |
+ Iterable<PackageIndexId> ids = await _store.getIds(); |
+ for (PackageIndexId id in ids) { |
+ PackageIndex index = await _store.getIndex(id); |
+ _PackageIndexRequester requester = new _PackageIndexRequester(index); |
+ List<Location> packageLocations = |
+ requester.getUnresolvedMemberReferences(name); |
+ locations.addAll(packageLocations); |
+ } |
+ return locations; |
+ } |
+ |
+ /** |
* Index the given fully resolved [unit]. |
*/ |
void indexUnit(CompilationUnit unit) { |
@@ -314,6 +331,21 @@ class _PackageIndexRequester { |
} |
/** |
+ * Complete with a list of locations where a class members with the given |
+ * [name] is referenced with a qualifier, but is not resolved. |
+ */ |
+ List<Location> getUnresolvedMemberReferences(String name) { |
+ List<Location> locations = <Location>[]; |
+ for (UnitIndex unitIndex in index.units) { |
+ _UnitIndexRequester requester = new _UnitIndexRequester(this, unitIndex); |
+ List<Location> unitLocations = |
+ requester.getUnresolvedMemberReferences(name); |
+ locations.addAll(unitLocations); |
+ } |
+ return locations; |
+ } |
+ |
+ /** |
* Return the identifier of the [uri] in the [index] or `-1` if the [uri] is |
* not used in the [index]. |
*/ |
@@ -386,4 +418,24 @@ class _UnitIndexRequester { |
} |
return locations; |
} |
+ |
+ /** |
+ * Complete with a list of locations where a class members with the given |
+ * [name] is referenced with a qualifier, but is not resolved. |
+ */ |
+ List<Location> getUnresolvedMemberReferences(String name) { |
+ List<Location> locations = <Location>[]; |
+ String unitLibraryUri = null; |
+ String unitUnitUri = null; |
+ for (int i = 0; i < unitIndex.usedNames.length; i++) { |
+ int nameIndex = unitIndex.usedNames[i]; |
+ if (packageRequester.index.strings[nameIndex] == name) { |
+ unitLibraryUri ??= packageRequester.getUnitLibraryUri(unitIndex.unit); |
+ unitUnitUri ??= packageRequester.getUnitUnitUri(unitIndex.unit); |
+ locations.add(new Location(unitLibraryUri, unitUnitUri, |
+ unitIndex.usedNameOffsets[i], name.length, true)); |
+ } |
+ } |
+ return locations; |
+ } |
} |