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

Unified Diff: pkg/analysis_server/lib/src/services/search/search_engine_internal.dart

Issue 1156493004: Move index closer to the plugin API (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/search/search_engine_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart b/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart
index d97cf4234d274403a0e8d7269743bdaa0d5f02b7..be37a9637d7bfaa2d15edf70de168dab8e994d71 100644
--- a/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart
+++ b/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart
@@ -6,8 +6,10 @@ library services.src.search.search_engine;
import 'dart:async';
+import 'package:analysis_server/analysis/index/index_core.dart';
import 'package:analysis_server/src/services/correction/source_range.dart';
import 'package:analysis_server/src/services/index/index.dart';
+import 'package:analysis_server/src/services/index/indexable_element.dart';
import 'package:analysis_server/src/services/search/search_engine.dart';
import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/source.dart';
@@ -198,13 +200,17 @@ class _Requestor {
_Requestor(this.index);
void add(Element element, RelationshipImpl relationship, MatchKind kind) {
- Future relationsFuture = index.getRelationships(element, relationship);
+ Future relationsFuture =
+ index.getRelationships(new IndexableElement(element), relationship);
Future matchesFuture = relationsFuture.then((List<LocationImpl> locations) {
List<SearchMatch> matches = <SearchMatch>[];
for (LocationImpl location in locations) {
- matches.add(new SearchMatch(kind, location.element,
- new SourceRange(location.offset, location.length),
- location.isResolved, location.isQualified));
+ IndexableObject indexable = location.indexable;
+ if (indexable is IndexableElement) {
+ matches.add(new SearchMatch(kind, indexable.element,
+ new SourceRange(location.offset, location.length),
+ location.isResolved, location.isQualified));
+ }
}
return matches;
});

Powered by Google App Engine
This is Rietveld 408576698