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

Side by Side Diff: pkg/analysis_server/lib/src/services/index/local_index.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.src.index.local_index; 5 library services.src.index.local_index;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/analysis/index/index_core.dart';
9 import 'package:analysis_server/src/services/index/index.dart'; 10 import 'package:analysis_server/src/services/index/index.dart';
10 import 'package:analysis_server/src/services/index/index_contributor.dart' 11 import 'package:analysis_server/src/services/index/index_contributor.dart'
11 as contributors; 12 as oldContributors;
12 import 'package:analysis_server/src/services/index/store/split_store.dart'; 13 import 'package:analysis_server/src/services/index/store/split_store.dart';
13 import 'package:analyzer/src/generated/ast.dart'; 14 import 'package:analyzer/src/generated/ast.dart';
14 import 'package:analyzer/src/generated/element.dart'; 15 import 'package:analyzer/src/generated/element.dart';
15 import 'package:analyzer/src/generated/engine.dart'; 16 import 'package:analyzer/src/generated/engine.dart';
16 import 'package:analyzer/src/generated/html.dart'; 17 import 'package:analyzer/src/generated/html.dart';
17 import 'package:analyzer/src/generated/source.dart'; 18 import 'package:analyzer/src/generated/source.dart';
18 19
19 /** 20 /**
20 * A local implementation of [Index]. 21 * A local implementation of [Index].
21 */ 22 */
22 class LocalIndex extends Index { 23 class LocalIndex extends Index {
24 /**
25 * The index contributors used by this index.
26 */
27 List<IndexContributor> contributors;
28
23 SplitIndexStore _store; 29 SplitIndexStore _store;
24 30
25 LocalIndex(NodeManager nodeManager) { 31 LocalIndex(NodeManager nodeManager) {
26 _store = new SplitIndexStore(nodeManager); 32 _store = new SplitIndexStore(nodeManager);
27 } 33 }
28 34
29 @override 35 @override
30 String get statistics => _store.statistics; 36 String get statistics => _store.statistics;
31 37
32 @override 38 @override
(...skipping 12 matching lines...) Expand all
45 /** 51 /**
46 * Returns a `Future<List<Location>>` that completes with the list of 52 * Returns a `Future<List<Location>>` that completes with the list of
47 * [LocationImpl]s of the given [relationship] with the given [element]. 53 * [LocationImpl]s of the given [relationship] with the given [element].
48 * 54 *
49 * For example, if the [element] represents a function and the [relationship] 55 * For example, if the [element] represents a function and the [relationship]
50 * is the `is-invoked-by` relationship, then the locations will be all of the 56 * is the `is-invoked-by` relationship, then the locations will be all of the
51 * places where the function is invoked. 57 * places where the function is invoked.
52 */ 58 */
53 @override 59 @override
54 Future<List<LocationImpl>> getRelationships( 60 Future<List<LocationImpl>> getRelationships(
55 Element element, RelationshipImpl relationship) { 61 IndexableObject indexable, RelationshipImpl relationship) {
56 return _store.getRelationships(element, relationship); 62 return _store.getRelationships(indexable, relationship);
57 } 63 }
58 64
59 @override 65 @override
60 List<Element> getTopLevelDeclarations(ElementNameFilter nameFilter) { 66 List<Element> getTopLevelDeclarations(ElementNameFilter nameFilter) {
61 return _store.getTopLevelDeclarations(nameFilter); 67 return _store.getTopLevelDeclarations(nameFilter);
62 } 68 }
63 69
64 @override 70 @override
65 void indexHtmlUnit(AnalysisContext context, HtmlUnit unit) { 71 void indexHtmlUnit(AnalysisContext context, HtmlUnit unit) {
66 contributors.indexHtmlUnit(_store, context, unit); 72 oldContributors.indexHtmlUnit(_store, context, unit);
67 } 73 }
68 74
69 @override 75 @override
70 void indexUnit(AnalysisContext context, CompilationUnit unit) { 76 void indexUnit(AnalysisContext context, CompilationUnit unit) {
71 contributors.indexDartUnit(_store, context, unit); 77 oldContributors.indexDartUnit(_store, context, unit);
72 } 78 }
73 79
74 @override 80 @override
81 void recordRelationship(
82 IndexableObject indexable, Relationship relationship, Location location) {
83 _store.recordRelationship(indexable, relationship, location);
84 }
85
86 @override
75 void removeContext(AnalysisContext context) { 87 void removeContext(AnalysisContext context) {
76 _store.removeContext(context); 88 _store.removeContext(context);
77 } 89 }
78 90
79 @override 91 @override
80 void removeSource(AnalysisContext context, Source source) { 92 void removeSource(AnalysisContext context, Source source) {
81 _store.removeSource(context, source); 93 _store.removeSource(context, source);
82 } 94 }
83 95
84 @override 96 @override
85 void removeSources(AnalysisContext context, SourceContainer container) { 97 void removeSources(AnalysisContext context, SourceContainer container) {
86 _store.removeSources(context, container); 98 _store.removeSources(context, container);
87 } 99 }
88 100
89 @override 101 @override
90 void run() { 102 void run() {
91 // NO-OP for the local index 103 // NO-OP for the local index
92 } 104 }
93 105
94 @override 106 @override
95 void stop() { 107 void stop() {
96 // NO-OP for the local index 108 // NO-OP for the local index
97 } 109 }
98 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698