Index: pkg/analysis_server/lib/src/services/index/index_contributor.dart |
diff --git a/pkg/analysis_server/lib/src/services/index/index_contributor.dart b/pkg/analysis_server/lib/src/services/index/index_contributor.dart |
index 26397fbd3d9c32e000ff0fa042ac738801e3931e..6170802e631590b376ce4527b70ffe3a37429ce4 100644 |
--- a/pkg/analysis_server/lib/src/services/index/index_contributor.dart |
+++ b/pkg/analysis_server/lib/src/services/index/index_contributor.dart |
@@ -6,8 +6,7 @@ library services.src.index.index_contributor; |
import 'dart:collection' show Queue; |
-import 'package:analysis_server/analysis/index/index_core.dart'; |
-import 'package:analysis_server/analysis/index/index_dart.dart'; |
+import 'package:analysis_server/analysis/index_core.dart'; |
import 'package:analysis_server/src/services/correction/namespace.dart'; |
import 'package:analysis_server/src/services/index/index.dart'; |
import 'package:analysis_server/src/services/index/index_store.dart'; |
@@ -15,74 +14,20 @@ import 'package:analysis_server/src/services/index/indexable_element.dart'; |
import 'package:analyzer/src/generated/ast.dart'; |
import 'package:analyzer/src/generated/element.dart'; |
import 'package:analyzer/src/generated/engine.dart'; |
-import 'package:analyzer/src/generated/html.dart' as ht; |
import 'package:analyzer/src/generated/java_engine.dart'; |
import 'package:analyzer/src/generated/scanner.dart'; |
import 'package:analyzer/src/generated/source.dart'; |
/** |
- * Adds data to [store] based on the resolved Dart [unit]. |
+ * An [IndexContributor] that contributes relationships for Dart files. |
*/ |
-void indexDartUnit( |
- InternalIndexStore store, AnalysisContext context, CompilationUnit unit) { |
- // check unit |
- if (unit == null) { |
- return; |
- } |
- // prepare unit element |
- CompilationUnitElement unitElement = unit.element; |
- if (unitElement == null) { |
- return; |
- } |
- // about to index |
- bool mayIndex = store.aboutToIndex(context, unitElement); |
- if (!mayIndex) { |
- return; |
- } |
- // do index |
- try { |
- unit.accept(new _IndexContributor(store)); |
- store.doneIndex(); |
- } catch (e) { |
- store.cancelIndex(); |
- rethrow; |
- } |
-} |
- |
-/** |
- * Adds data to [store] based on the resolved HTML [unit]. |
- */ |
-void indexHtmlUnit( |
- InternalIndexStore store, AnalysisContext context, ht.HtmlUnit unit) { |
- // TODO(scheglov) remove or implement |
-// // check unit |
-// if (unit == null) { |
-// return; |
-// } |
-// // prepare unit element |
-// HtmlElement unitElement = unit.element; |
-// if (unitElement == null) { |
-// return; |
-// } |
-// // about to index |
-// bool mayIndex = store.aboutToIndexHtml(context, unitElement); |
-// if (!mayIndex) { |
-// return; |
-// } |
-// // do index |
-// store.doneIndex(); |
-} |
- |
-/** |
- * An [IndexContributor] that can be used to contribute relationships for Dart |
- * files. |
- */ |
-class DefaultDartIndexContributor extends DartIndexContributor { |
+class DartIndexContributor extends IndexContributor { |
@override |
- void internalContributeTo(IndexStore store, CompilationUnit unit) { |
- _IndexContributor contributor = |
- new _IndexContributor(store as InternalIndexStore); |
- unit.accept(contributor); |
+ void contributeTo(IndexStore store, AnalysisContext context, Object object) { |
+ if (store is InternalIndexStore && object is CompilationUnit) { |
+ _IndexContributor contributor = new _IndexContributor(store); |
+ object.accept(contributor); |
+ } |
} |
} |