Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Unified Diff: pkg/analysis_server/lib/src/services/index2/index2.dart

Issue 1768353002: Implement SearchEngine.searchMemberReferences(). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/search/search_engine_internal2.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ }
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/search/search_engine_internal2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698