| 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_store; | 5 library services.index_store; |
| 6 | 6 |
| 7 import 'package:analysis_server/analysis/index/index_core.dart'; | 7 import 'package:analysis_server/analysis/index/index_core.dart'; |
| 8 import 'package:analysis_server/src/services/index/index.dart'; | 8 import 'package:analysis_server/src/services/index/index.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * A container with information computed by an index - relations between | 13 * A container with information computed by an index - relations between |
| 14 * elements. | 14 * elements. |
| 15 */ | 15 */ |
| 16 abstract class InternalIndexStore extends IndexStore { | 16 abstract class InternalIndexStore extends IndexStore { |
| 17 /** | 17 /** |
| 18 * Answers index statistics. | 18 * Answers index statistics. |
| 19 */ | 19 */ |
| 20 String get statistics; | 20 String get statistics; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Notifies the index store that we are going to index an unit with the given | 23 * Notifies the index store that we are going to index the given [object]. |
| 24 * [unitElement]. | |
| 25 * | |
| 26 * If the unit is a part of a library, then all its locations are removed. | |
| 27 * | |
| 28 * If it is a defining compilation unit of a library, then index store also | |
| 29 * checks if some previously indexed parts of the library are not parts of the | |
| 30 * library anymore, and clears their information. | |
| 31 * | 24 * |
| 32 * [context] - the [AnalysisContext] in which unit being indexed. | 25 * [context] - the [AnalysisContext] in which unit being indexed. |
| 33 * [unitElement] - the element of the unit being indexed. | 26 * [object] - the object being indexed. |
| 34 * | 27 * |
| 35 * Returns `true` if the given [unitElement] may be indexed, or `false` if | 28 * Returns `true` if the given [object] may be indexed, or `false` if |
| 36 * belongs to a disposed [AnalysisContext], is not resolved completely, etc. | 29 * belongs to a disposed [AnalysisContext], is not resolved completely, etc. |
| 37 */ | 30 */ |
| 38 bool aboutToIndexDart( | 31 bool aboutToIndex(AnalysisContext context, Object object); |
| 39 AnalysisContext context, CompilationUnitElement unitElement); | |
| 40 | 32 |
| 41 /** | 33 /** |
| 42 * Notifies the index store that we are going to index an unit with the given | 34 * Notifies the index store that there was an error during the current |
| 43 * [htmlElement]. | 35 * indexing, and all the information recorded after the last |
| 44 * | 36 * [aboutToIndex] invocation must be discarded. |
| 45 * [context] - the [AnalysisContext] in which unit being indexed. | |
| 46 * [htmlElement] - the [HtmlElement] being indexed. | |
| 47 * | |
| 48 * Returns `true` if the given [htmlElement] may be indexed, or `false` if | |
| 49 * belongs to a disposed [AnalysisContext], is not resolved completely, etc. | |
| 50 */ | 37 */ |
| 51 bool aboutToIndexHtml(AnalysisContext context, HtmlElement htmlElement); | 38 void cancelIndex(); |
| 52 | 39 |
| 53 /** | 40 /** |
| 54 * Notifies the index store that there was an error during the current Dart | 41 * Notifies the index store that the current object indexing is done. |
| 55 * indexing, and all the information recorded after the last | |
| 56 * [aboutToIndexDart] invocation must be discarded. | |
| 57 */ | |
| 58 void cancelIndexDart(); | |
| 59 | |
| 60 /** | |
| 61 * Notifies the index store that the current Dart or HTML unit indexing is | |
| 62 * done. | |
| 63 * | 42 * |
| 64 * If this method is not invoked after corresponding "aboutToIndex*" | 43 * If this method is not invoked after corresponding [aboutToIndex] |
| 65 * invocation, all recorded information may be lost. | 44 * invocation, all recorded information may be lost. |
| 66 */ | 45 */ |
| 67 void doneIndex(); | 46 void doneIndex(); |
| 68 | 47 |
| 69 /** | 48 /** |
| 70 * Returns top-level [Element]s whose names satisfy to [nameFilter]. | 49 * Returns top-level [Element]s whose names satisfy to [nameFilter]. |
| 71 */ | 50 */ |
| 72 List<Element> getTopLevelDeclarations(ElementNameFilter nameFilter); | 51 List<Element> getTopLevelDeclarations(ElementNameFilter nameFilter); |
| 73 | 52 |
| 74 /** | 53 /** |
| 75 * Records the declaration of the given top-level [element]. | 54 * Records the declaration of the given top-level [element]. |
| 76 */ | 55 */ |
| 77 void recordTopLevelDeclaration(Element element); | 56 void recordTopLevelDeclaration(Element element); |
| 78 } | 57 } |
| OLD | NEW |