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

Side by Side Diff: pkg/analysis_server/lib/src/services/index/index_store.dart

Issue 971833003: Optimize top-level element declarations search. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
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.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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 * 77 *
78 * [element] - the the [Element] that has the relationship with the locations 78 * [element] - the the [Element] that has the relationship with the locations
79 * to be returned. 79 * to be returned.
80 * [relationship] - the [Relationship] between the given element and the 80 * [relationship] - the [Relationship] between the given element and the
81 * locations to be returned 81 * locations to be returned
82 */ 82 */
83 Future<List<Location>> getRelationships(Element element, 83 Future<List<Location>> getRelationships(Element element,
84 Relationship relationship); 84 Relationship relationship);
85 85
86 /** 86 /**
87 * Returns top-level [Element]s whose names satisfy to [nameFilter].
88 */
89 List<Element> getTopDeclarations(ElementNameFilter nameFilter);
Brian Wilkerson 2015/03/02 19:20:07 "Top" --> "TopLevel"? I know it's longer, but I th
scheglov 2015/03/02 19:55:46 Done.
90
91 /**
87 * Records that the given [element] and [location] have the given 92 * Records that the given [element] and [location] have the given
88 * [relationship]. 93 * [relationship].
89 * 94 *
90 * For example, if the [relationship] is the `is-invoked-by` relationship, 95 * For example, if the [relationship] is the `is-invoked-by` relationship,
91 * then [element] would be the function being invoked and [location] would be 96 * then [element] would be the function being invoked and [location] would be
92 * the point at which it is referenced. Each element can have the same 97 * the point at which it is referenced. Each element can have the same
93 * relationship with multiple locations. In other words, if the following code 98 * relationship with multiple locations. In other words, if the following code
94 * were executed 99 * were executed
95 * 100 *
96 * recordRelationship(element, isReferencedBy, location1); 101 * recordRelationship(element, isReferencedBy, location1);
97 * recordRelationship(element, isReferencedBy, location2); 102 * recordRelationship(element, isReferencedBy, location2);
98 * 103 *
99 * then both relationships would be maintained in the index and the result of executing 104 * then both relationships would be maintained in the index and the result of executing
100 * 105 *
101 * getRelationship(element, isReferencedBy); 106 * getRelationship(element, isReferencedBy);
102 * 107 *
103 * would be a list containing both `location1` and `location2`. 108 * would be a list containing both `location1` and `location2`.
104 * 109 *
105 * [element] - the [Element] that is related to the location. 110 * [element] - the [Element] that is related to the location.
106 * [relationship] - the [Relationship] between the element and the location. 111 * [relationship] - the [Relationship] between the element and the location.
107 * [location] the [Location] where relationship happens. 112 * [location] the [Location] where relationship happens.
108 */ 113 */
109 void recordRelationship(Element element, Relationship relationship, 114 void recordRelationship(Element element, Relationship relationship,
110 Location location); 115 Location location);
111 116
112 /** 117 /**
118 * Records the declaration of the given top-level [element].
119 */
120 void recordTopDeclaration(Element element);
121
122 /**
113 * Removes from the index all of the information associated with [context]. 123 * Removes from the index all of the information associated with [context].
114 * 124 *
115 * This method should be invoked when [context] is disposed. 125 * This method should be invoked when [context] is disposed.
116 * 126 *
117 * [context] - the [AnalysisContext] being removed. 127 * [context] - the [AnalysisContext] being removed.
118 */ 128 */
119 void removeContext(AnalysisContext context); 129 void removeContext(AnalysisContext context);
120 130
121 /** 131 /**
122 * Removes from the index all of the information associated with elements or 132 * Removes from the index all of the information associated with elements or
(...skipping 16 matching lines...) Expand all
139 * any other elements and a location within the given sources. 149 * any other elements and a location within the given sources.
140 * 150 *
141 * This method should be invoked when multiple sources are no longer part of 151 * This method should be invoked when multiple sources are no longer part of
142 * the code base. 152 * the code base.
143 * 153 *
144 * [context] - the [AnalysisContext] in which [Source]s being removed. 154 * [context] - the [AnalysisContext] in which [Source]s being removed.
145 * [container] - the [SourceContainer] holding the sources being removed. 155 * [container] - the [SourceContainer] holding the sources being removed.
146 */ 156 */
147 void removeSources(AnalysisContext context, SourceContainer container); 157 void removeSources(AnalysisContext context, SourceContainer container);
148 } 158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698