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 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/services/index/index.dart'; | 9 import 'package:analysis_server/src/services/index/index.dart'; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 /** | 69 /** |
70 * Returns a [Future] that completes with locations of the elements that have | 70 * Returns a [Future] that completes with locations of the elements that have |
71 * the given [relationship] with the given [element]. | 71 * the given [relationship] with the given [element]. |
72 * | 72 * |
73 * For example, if the [element] represents a function and the relationship is | 73 * For example, if the [element] represents a function and the relationship is |
74 * the `is-invoked-by` relationship, then the returned locations will be all | 74 * the `is-invoked-by` relationship, then the returned locations will be all |
75 * of the places where the function is invoked. | 75 * of the places where the function is invoked. |
76 * | 76 * |
77 * [element] - the the [Element] that has the relationship with the locations | 77 * [element] - the the [Element] that has the relationship with the locations |
78 * to be returned. | 78 * to be returned. |
79 * [relationship] - the [Relationship] between the given element and the | 79 * [relationship] - the [RelationshipImpl] between the given element and the |
80 * locations to be returned | 80 * locations to be returned |
81 */ | 81 */ |
82 Future<List<Location>> getRelationships( | 82 Future<List<LocationImpl>> getRelationships( |
83 Element element, Relationship relationship); | 83 Element element, RelationshipImpl relationship); |
84 | 84 |
85 /** | 85 /** |
86 * Returns top-level [Element]s whose names satisfy to [nameFilter]. | 86 * Returns top-level [Element]s whose names satisfy to [nameFilter]. |
87 */ | 87 */ |
88 List<Element> getTopLevelDeclarations(ElementNameFilter nameFilter); | 88 List<Element> getTopLevelDeclarations(ElementNameFilter nameFilter); |
89 | 89 |
90 /** | 90 /** |
91 * Records that the given [element] and [location] have the given | 91 * Records that the given [element] and [location] have the given |
92 * [relationship]. | 92 * [relationship]. |
93 * | 93 * |
94 * For example, if the [relationship] is the `is-invoked-by` relationship, | 94 * For example, if the [relationship] is the `is-invoked-by` relationship, |
95 * then [element] would be the function being invoked and [location] would be | 95 * then [element] would be the function being invoked and [location] would be |
96 * the point at which it is referenced. Each element can have the same | 96 * the point at which it is referenced. Each element can have the same |
97 * relationship with multiple locations. In other words, if the following code | 97 * relationship with multiple locations. In other words, if the following code |
98 * were executed | 98 * were executed |
99 * | 99 * |
100 * recordRelationship(element, isReferencedBy, location1); | 100 * recordRelationship(element, isReferencedBy, location1); |
101 * recordRelationship(element, isReferencedBy, location2); | 101 * recordRelationship(element, isReferencedBy, location2); |
102 * | 102 * |
103 * then both relationships would be maintained in the index and the result of
executing | 103 * then both relationships would be maintained in the index and the result of
executing |
104 * | 104 * |
105 * getRelationship(element, isReferencedBy); | 105 * getRelationship(element, isReferencedBy); |
106 * | 106 * |
107 * would be a list containing both `location1` and `location2`. | 107 * would be a list containing both `location1` and `location2`. |
108 * | 108 * |
109 * [element] - the [Element] that is related to the location. | 109 * [element] - the [Element] that is related to the location. |
110 * [relationship] - the [Relationship] between the element and the location. | 110 * [relationship] - the [RelationshipImpl] between the element and the locatio
n. |
111 * [location] the [Location] where relationship happens. | 111 * [location] the [LocationImpl] where relationship happens. |
112 */ | 112 */ |
113 void recordRelationship( | 113 void recordRelationship( |
114 Element element, Relationship relationship, Location location); | 114 Element element, RelationshipImpl relationship, LocationImpl location); |
115 | 115 |
116 /** | 116 /** |
117 * Records the declaration of the given top-level [element]. | 117 * Records the declaration of the given top-level [element]. |
118 */ | 118 */ |
119 void recordTopLevelDeclaration(Element element); | 119 void recordTopLevelDeclaration(Element element); |
120 | 120 |
121 /** | 121 /** |
122 * Removes from the index all of the information associated with [context]. | 122 * Removes from the index all of the information associated with [context]. |
123 * | 123 * |
124 * This method should be invoked when [context] is disposed. | 124 * This method should be invoked when [context] is disposed. |
(...skipping 23 matching lines...) Expand all Loading... |
148 * any other elements and a location within the given sources. | 148 * any other elements and a location within the given sources. |
149 * | 149 * |
150 * This method should be invoked when multiple sources are no longer part of | 150 * This method should be invoked when multiple sources are no longer part of |
151 * the code base. | 151 * the code base. |
152 * | 152 * |
153 * [context] - the [AnalysisContext] in which [Source]s being removed. | 153 * [context] - the [AnalysisContext] in which [Source]s being removed. |
154 * [container] - the [SourceContainer] holding the sources being removed. | 154 * [container] - the [SourceContainer] holding the sources being removed. |
155 */ | 155 */ |
156 void removeSources(AnalysisContext context, SourceContainer container); | 156 void removeSources(AnalysisContext context, SourceContainer container); |
157 } | 157 } |
OLD | NEW |