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

Unified Diff: pkg/analysis_server/lib/src/services/index/store/codec.dart

Issue 894853004: Support for inspecting index. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
Index: pkg/analysis_server/lib/src/services/index/store/codec.dart
diff --git a/pkg/analysis_server/lib/src/services/index/store/codec.dart b/pkg/analysis_server/lib/src/services/index/store/codec.dart
index 1625edd88fcf35715c3632d6a24e6bd205957379..8f6a2ed0ae4d4850804c115b15314fb9dbcf6257 100644
--- a/pkg/analysis_server/lib/src/services/index/store/codec.dart
+++ b/pkg/analysis_server/lib/src/services/index/store/codec.dart
@@ -145,6 +145,34 @@ class ElementCodec {
return index;
}
+ /**
+ * Returns a list with the location components of the element with the
+ * given encoded ID.
+ */
+ List<String> inspect_decodePath(int id) {
+ List<int> path = _indexToPath[id];
+ return _getLocationComponents(path);
+ }
+
+ /**
+ * Returns a map of element IDs to their locations for elements with
+ * the [requiredName].
+ */
+ Map<int, List<String>> inspect_getElements(String requiredName) {
+ Map<int, List<String>> result = <int, List<String>>{};
+ for (int i = 0; i < _indexToPath.length; i++) {
+ List<int> path = _indexToPath[i];
+ int nameIndex = path[path.length - 1];
+ if (nameIndex >= 0) {
+ String name = _stringCodec.decode(nameIndex);
+ if (name == requiredName) {
+ result[i] = path.map(_stringCodec.decode).toList();
+ }
+ }
+ }
+ return result;
+ }
+
int _encodePath(List<int> path) {
int index = _pathToIndex[path];
if (index == null) {

Powered by Google App Engine
This is Rietveld 408576698