OLD | NEW |
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.index; | 5 library services.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/analysis/index_core.dart'; |
10 import 'package:analysis_server/src/services/index/indexable_element.dart'; | 10 import 'package:analysis_server/src/services/index/indexable_element.dart'; |
11 import 'package:analyzer/src/generated/ast.dart'; | |
12 import 'package:analyzer/src/generated/element.dart'; | 11 import 'package:analyzer/src/generated/element.dart'; |
13 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/engine.dart'; |
14 import 'package:analyzer/src/generated/html.dart'; | |
15 import 'package:analyzer/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
16 | 14 |
17 /** | 15 /** |
18 * A filter for [Element] names. | 16 * A filter for [Element] names. |
19 */ | 17 */ |
20 typedef bool ElementNameFilter(String name); | 18 typedef bool ElementNameFilter(String name); |
21 | 19 |
22 /** | 20 /** |
23 * The interface [Index] defines the behavior of objects that maintain an index | 21 * The interface [Index] defines the behavior of objects that maintain an index |
24 * storing relations between indexable objects. | 22 * storing relations between indexable objects. |
(...skipping 13 matching lines...) Expand all Loading... |
38 * Answers index statistics. | 36 * Answers index statistics. |
39 */ | 37 */ |
40 String get statistics; | 38 String get statistics; |
41 | 39 |
42 /** | 40 /** |
43 * Returns top-level [Element]s whose names satisfy to [nameFilter]. | 41 * Returns top-level [Element]s whose names satisfy to [nameFilter]. |
44 */ | 42 */ |
45 List<Element> getTopLevelDeclarations(ElementNameFilter nameFilter); | 43 List<Element> getTopLevelDeclarations(ElementNameFilter nameFilter); |
46 | 44 |
47 /** | 45 /** |
48 * Processes the given [HtmlUnit] in order to record the relationships. | 46 * Processes the given [object] in order to record the relationships. |
49 * | 47 * |
50 * [context] - the [AnalysisContext] in which [HtmlUnit] was resolved. | 48 * [context] - the [AnalysisContext] in which the [object] being indexed. |
51 * [unit] - the [HtmlUnit] being indexed. | 49 * [object] - the object being indexed. |
52 */ | 50 */ |
53 void indexHtmlUnit(AnalysisContext context, HtmlUnit unit); | 51 void index(AnalysisContext context, Object object); |
54 | |
55 /** | |
56 * Processes the given [CompilationUnit] in order to record the relationships. | |
57 * | |
58 * [context] - the [AnalysisContext] in which [CompilationUnit] was resolved. | |
59 * [unit] - the [CompilationUnit] being indexed. | |
60 */ | |
61 void indexUnit(AnalysisContext context, CompilationUnit unit); | |
62 | 52 |
63 /** | 53 /** |
64 * Starts the index. | 54 * Starts the index. |
65 * Should be called before any other method. | 55 * Should be called before any other method. |
66 */ | 56 */ |
67 void run(); | 57 void run(); |
68 | 58 |
69 /** | 59 /** |
70 * Stops the index. | 60 * Stops the index. |
71 * After calling this method operations may not be executed. | 61 * After calling this method operations may not be executed. |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 */ | 352 */ |
363 static RelationshipImpl getRelationship(String identifier) { | 353 static RelationshipImpl getRelationship(String identifier) { |
364 RelationshipImpl relationship = _RELATIONSHIP_MAP[identifier]; | 354 RelationshipImpl relationship = _RELATIONSHIP_MAP[identifier]; |
365 if (relationship == null) { | 355 if (relationship == null) { |
366 relationship = new RelationshipImpl(identifier); | 356 relationship = new RelationshipImpl(identifier); |
367 _RELATIONSHIP_MAP[identifier] = relationship; | 357 _RELATIONSHIP_MAP[identifier] = relationship; |
368 } | 358 } |
369 return relationship; | 359 return relationship; |
370 } | 360 } |
371 } | 361 } |
OLD | NEW |