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

Side by Side Diff: pkg/analysis_services/lib/search/search_engine.dart

Issue 382993002: SearchEngine service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | pkg/analysis_services/lib/src/index/index_contributor.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.search_engine; 8 library engine.search_engine;
9 9
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 12 matching lines...) Expand all
23 String firstName = firstMatch.element.displayName; 23 String firstName = firstMatch.element.displayName;
24 String secondName = secondMatch.element.displayName; 24 String secondName = secondMatch.element.displayName;
25 return firstName.compareTo(secondName); 25 return firstName.compareTo(secondName);
26 }; 26 };
27 27
28 28
29 /** 29 /**
30 * Instances of the enum [MatchKind] represent the kind of reference that was 30 * Instances of the enum [MatchKind] represent the kind of reference that was
31 * found when a match represents a reference to an element. 31 * found when a match represents a reference to an element.
32 */ 32 */
33 class MatchKind extends Enum<MatchKind> { 33 class MatchKind {
34 /** 34 /**
35 * A reference to an Angular element. 35 * A reference to an Angular element.
36 */ 36 */
37 static const MatchKind ANGULAR_REFERENCE = const MatchKind( 37 static const MatchKind ANGULAR_REFERENCE = const MatchKind(
38 'ANGULAR_REFERENCE', 0); 38 'ANGULAR_REFERENCE');
39 39
40 /** 40 /**
41 * A reference to an Angular element. 41 * A reference to an Angular element.
42 */ 42 */
43 static const MatchKind ANGULAR_CLOSING_TAG_REFERENCE = const MatchKind( 43 static const MatchKind ANGULAR_CLOSING_TAG_REFERENCE = const MatchKind(
44 'ANGULAR_CLOSING_TAG_REFERENCE', 1); 44 'ANGULAR_CLOSING_TAG_REFERENCE');
45 45
46 /** 46 /**
47 * A declaration of a class. 47 * A declaration of a class.
48 */ 48 */
49 static const MatchKind CLASS_DECLARATION = const MatchKind( 49 static const MatchKind CLASS_DECLARATION = const MatchKind(
50 'CLASS_DECLARATION', 2); 50 'CLASS_DECLARATION');
51 51
52 /** 52 /**
53 * A declaration of a class alias. 53 * A declaration of a class alias.
54 */ 54 */
55 static const MatchKind CLASS_ALIAS_DECLARATION = const MatchKind( 55 static const MatchKind CLASS_ALIAS_DECLARATION = const MatchKind(
56 'CLASS_ALIAS_DECLARATION', 3); 56 'CLASS_ALIAS_DECLARATION');
57 57
58 /** 58 /**
59 * A declaration of a constructor. 59 * A declaration of a constructor.
60 */ 60 */
61 static const MatchKind CONSTRUCTOR_DECLARATION = const MatchKind( 61 static const MatchKind CONSTRUCTOR_DECLARATION = const MatchKind(
62 'CONSTRUCTOR_DECLARATION', 4); 62 'CONSTRUCTOR_DECLARATION');
63 63
64 /** 64 /**
65 * A reference to a constructor in which the constructor is being referenced. 65 * A reference to a constructor in which the constructor is being referenced.
66 */ 66 */
67 static const MatchKind CONSTRUCTOR_REFERENCE = const MatchKind( 67 static const MatchKind CONSTRUCTOR_REFERENCE = const MatchKind(
68 'CONSTRUCTOR_REFERENCE', 5); 68 'CONSTRUCTOR_REFERENCE');
69 69
70 /** 70 /**
71 * A reference to a type in which the type was extended. 71 * A reference to a type in which the type was extended.
72 */ 72 */
73 static const MatchKind EXTENDS_REFERENCE = const MatchKind( 73 static const MatchKind EXTENDS_REFERENCE = const MatchKind(
74 'EXTENDS_REFERENCE', 6); 74 'EXTENDS_REFERENCE');
75 75
76 /** 76 /**
77 * A reference to a field in which the field's value is being invoked. 77 * A reference to a field in which the field's value is being invoked.
78 */ 78 */
79 static const MatchKind FIELD_INVOCATION = const MatchKind('FIELD_INVOCATION', 79 static const MatchKind FIELD_INVOCATION = const MatchKind('FIELD_INVOCATION');
80 7);
81 80
82 /** 81 /**
83 * A reference to a field (from field formal parameter). 82 * A reference to a field (from field formal parameter).
84 */ 83 */
85 static const MatchKind FIELD_REFERENCE = const MatchKind('FIELD_REFERENCE', 84 static const MatchKind FIELD_REFERENCE = const MatchKind('FIELD_REFERENCE');
86 8);
87 85
88 /** 86 /**
89 * A reference to a field in which the field's value is being read. 87 * A reference to a field in which the field's value is being read.
90 */ 88 */
91 static const MatchKind FIELD_READ = const MatchKind('FIELD_READ', 9); 89 static const MatchKind FIELD_READ = const MatchKind('FIELD_READ');
92 90
93 /** 91 /**
94 * A reference to a field in which the field's value is being written. 92 * A reference to a field in which the field's value is being written.
95 */ 93 */
96 static const MatchKind FIELD_WRITE = const MatchKind('FIELD_WRITE', 10); 94 static const MatchKind FIELD_WRITE = const MatchKind('FIELD_WRITE');
97 95
98 /** 96 /**
99 * A declaration of a function. 97 * A declaration of a function.
100 */ 98 */
101 static const MatchKind FUNCTION_DECLARATION = const MatchKind( 99 static const MatchKind FUNCTION_DECLARATION = const MatchKind(
102 'FUNCTION_DECLARATION', 11); 100 'FUNCTION_DECLARATION');
103 101
104 /** 102 /**
105 * A reference to a function in which the function is being executed. 103 * A reference to a function in which the function is being executed.
106 */ 104 */
107 static const MatchKind FUNCTION_EXECUTION = const MatchKind( 105 static const MatchKind FUNCTION_EXECUTION = const MatchKind(
108 'FUNCTION_EXECUTION', 12); 106 'FUNCTION_EXECUTION');
109 107
110 /** 108 /**
111 * A reference to a function in which the function is being referenced. 109 * A reference to a function in which the function is being referenced.
112 */ 110 */
113 static const MatchKind FUNCTION_REFERENCE = const MatchKind( 111 static const MatchKind FUNCTION_REFERENCE = const MatchKind(
114 'FUNCTION_REFERENCE', 13); 112 'FUNCTION_REFERENCE');
115 113
116 /** 114 /**
117 * A declaration of a function type. 115 * A declaration of a function type.
118 */ 116 */
119 static const MatchKind FUNCTION_TYPE_DECLARATION = const MatchKind( 117 static const MatchKind FUNCTION_TYPE_DECLARATION = const MatchKind(
120 'FUNCTION_TYPE_DECLARATION', 14); 118 'FUNCTION_TYPE_DECLARATION');
121 119
122 /** 120 /**
123 * A reference to a function type. 121 * A reference to a function type.
124 */ 122 */
125 static const MatchKind FUNCTION_TYPE_REFERENCE = const MatchKind( 123 static const MatchKind FUNCTION_TYPE_REFERENCE = const MatchKind(
126 'FUNCTION_TYPE_REFERENCE', 15); 124 'FUNCTION_TYPE_REFERENCE');
127 125
128 /** 126 /**
129 * A reference to a type in which the type was implemented. 127 * A reference to a type in which the type was implemented.
130 */ 128 */
131 static const MatchKind IMPLEMENTS_REFERENCE = const MatchKind( 129 static const MatchKind IMPLEMENTS_REFERENCE = const MatchKind(
132 'IMPLEMENTS_REFERENCE', 16); 130 'IMPLEMENTS_REFERENCE');
133 131
134 /** 132 /**
135 * A reference to a [ImportElement]. 133 * A reference to a [ImportElement].
136 */ 134 */
137 static const MatchKind IMPORT_REFERENCE = const MatchKind('IMPORT_REFERENCE', 135 static const MatchKind IMPORT_REFERENCE = const MatchKind('IMPORT_REFERENCE');
138 17);
139 136
140 /** 137 /**
141 * A reference to a class that is implementing a specified type. 138 * A reference to a class that is implementing a specified type.
142 */ 139 */
143 static const MatchKind INTERFACE_IMPLEMENTED = const MatchKind( 140 static const MatchKind INTERFACE_IMPLEMENTED = const MatchKind(
144 'INTERFACE_IMPLEMENTED', 18); 141 'INTERFACE_IMPLEMENTED');
145 142
146 /** 143 /**
147 * A reference to a [LibraryElement]. 144 * A reference to a [LibraryElement].
148 */ 145 */
149 static const MatchKind LIBRARY_REFERENCE = const MatchKind( 146 static const MatchKind LIBRARY_REFERENCE = const MatchKind(
150 'LIBRARY_REFERENCE', 19); 147 'LIBRARY_REFERENCE');
151 148
152 /** 149 /**
153 * A reference to a method in which the method is being invoked. 150 * A reference to a method in which the method is being invoked.
154 */ 151 */
155 static const MatchKind METHOD_INVOCATION = const MatchKind( 152 static const MatchKind METHOD_INVOCATION = const MatchKind(
156 'METHOD_INVOCATION', 20); 153 'METHOD_INVOCATION');
157 154
158 /** 155 /**
159 * A reference to a method in which the method is being referenced. 156 * A reference to a method in which the method is being referenced.
160 */ 157 */
161 static const MatchKind METHOD_REFERENCE = const MatchKind('METHOD_REFERENCE', 158 static const MatchKind METHOD_REFERENCE = const MatchKind('METHOD_REFERENCE');
162 21);
163 159
164 /** 160 /**
165 * A declaration of a name. 161 * A declaration of a name.
166 */ 162 */
167 static const MatchKind NAME_DECLARATION = const MatchKind('NAME_DECLARATION', 163 static const MatchKind NAME_DECLARATION = const MatchKind('NAME_DECLARATION');
168 22);
169 164
170 /** 165 /**
171 * A reference to a name, resolved. 166 * A reference to a name, resolved.
172 */ 167 */
173 static const MatchKind NAME_REFERENCE_RESOLVED = const MatchKind( 168 static const MatchKind NAME_REFERENCE_RESOLVED = const MatchKind(
174 'NAME_REFERENCE_RESOLVED', 23); 169 'NAME_REFERENCE_RESOLVED');
175 170
176 /** 171 /**
177 * An invocation of a name, resolved. 172 * An invocation of a name, resolved.
178 */ 173 */
179 static const MatchKind NAME_INVOCATION_RESOLVED = const MatchKind( 174 static const MatchKind NAME_INVOCATION_RESOLVED = const MatchKind(
180 'NAME_INVOCATION_RESOLVED', 24); 175 'NAME_INVOCATION_RESOLVED');
181 176
182 /** 177 /**
183 * A reference to a name in which the name's value is being read. 178 * A reference to a name in which the name's value is being read.
184 */ 179 */
185 static const MatchKind NAME_READ_RESOLVED = const MatchKind( 180 static const MatchKind NAME_READ_RESOLVED = const MatchKind(
186 'NAME_READ_RESOLVED', 25); 181 'NAME_READ_RESOLVED');
187 182
188 /** 183 /**
189 * A reference to a name in which the name's value is being read and written. 184 * A reference to a name in which the name's value is being read and written.
190 */ 185 */
191 static const MatchKind NAME_READ_WRITE_RESOLVED = const MatchKind( 186 static const MatchKind NAME_READ_WRITE_RESOLVED = const MatchKind(
192 'NAME_READ_WRITE_RESOLVED', 26); 187 'NAME_READ_WRITE_RESOLVED');
193 188
194 /** 189 /**
195 * A reference to a name in which the name's value is being written. 190 * A reference to a name in which the name's value is being written.
196 */ 191 */
197 static const MatchKind NAME_WRITE_RESOLVED = const MatchKind( 192 static const MatchKind NAME_WRITE_RESOLVED = const MatchKind(
198 'NAME_WRITE_RESOLVED', 27); 193 'NAME_WRITE_RESOLVED');
199 194
200 /** 195 /**
201 * An invocation of a name, unresolved. 196 * An invocation of a name, unresolved.
202 */ 197 */
203 static const MatchKind NAME_INVOCATION_UNRESOLVED = const MatchKind( 198 static const MatchKind NAME_INVOCATION_UNRESOLVED = const MatchKind(
204 'NAME_INVOCATION_UNRESOLVED', 28); 199 'NAME_INVOCATION_UNRESOLVED');
205 200
206 /** 201 /**
207 * A reference to a name in which the name's value is being read. 202 * A reference to a name in which the name's value is being read.
208 */ 203 */
209 static const MatchKind NAME_READ_UNRESOLVED = const MatchKind( 204 static const MatchKind NAME_READ_UNRESOLVED = const MatchKind(
210 'NAME_READ_UNRESOLVED', 29); 205 'NAME_READ_UNRESOLVED');
211 206
212 /** 207 /**
213 * A reference to a name in which the name's value is being read and written. 208 * A reference to a name in which the name's value is being read and written.
214 */ 209 */
215 static const MatchKind NAME_READ_WRITE_UNRESOLVED = const MatchKind( 210 static const MatchKind NAME_READ_WRITE_UNRESOLVED = const MatchKind(
216 'NAME_READ_WRITE_UNRESOLVED', 30); 211 'NAME_READ_WRITE_UNRESOLVED');
217 212
218 /** 213 /**
219 * A reference to a name in which the name's value is being written. 214 * A reference to a name in which the name's value is being written.
220 */ 215 */
221 static const MatchKind NAME_WRITE_UNRESOLVED = const MatchKind( 216 static const MatchKind NAME_WRITE_UNRESOLVED = const MatchKind(
222 'NAME_WRITE_UNRESOLVED', 31); 217 'NAME_WRITE_UNRESOLVED');
223 218
224 /** 219 /**
225 * A reference to a name, unresolved. 220 * A reference to a name, unresolved.
226 */ 221 */
227 static const MatchKind NAME_REFERENCE_UNRESOLVED = const MatchKind( 222 static const MatchKind NAME_REFERENCE_UNRESOLVED = const MatchKind(
228 'NAME_REFERENCE_UNRESOLVED', 32); 223 'NAME_REFERENCE_UNRESOLVED');
229 224
230 /** 225 /**
231 * A reference to a named parameter in invocation. 226 * A reference to a named parameter in invocation.
232 */ 227 */
233 static const MatchKind NAMED_PARAMETER_REFERENCE = const MatchKind( 228 static const MatchKind NAMED_PARAMETER_REFERENCE = const MatchKind(
234 'NAMED_PARAMETER_REFERENCE', 33); 229 'NAMED_PARAMETER_REFERENCE');
235 230
236 /** 231 /**
237 * A reference to a property accessor. 232 * A reference to a property accessor.
238 */ 233 */
239 static const MatchKind PROPERTY_ACCESSOR_REFERENCE = const MatchKind( 234 static const MatchKind PROPERTY_ACCESSOR_REFERENCE = const MatchKind(
240 'PROPERTY_ACCESSOR_REFERENCE', 34); 235 'PROPERTY_ACCESSOR_REFERENCE');
241 236
242 /** 237 /**
243 * A reference to a type. 238 * A reference to a type.
244 */ 239 */
245 static const MatchKind TYPE_REFERENCE = const MatchKind('TYPE_REFERENCE', 35); 240 static const MatchKind TYPE_REFERENCE = const MatchKind('TYPE_REFERENCE');
246 241
247 /** 242 /**
248 * A reference to a type parameter. 243 * A reference to a type parameter.
249 */ 244 */
250 static const MatchKind TYPE_PARAMETER_REFERENCE = const MatchKind( 245 static const MatchKind TYPE_PARAMETER_REFERENCE = const MatchKind(
251 'TYPE_PARAMETER_REFERENCE', 36); 246 'TYPE_PARAMETER_REFERENCE');
252 247
253 /** 248 /**
254 * A reference to a [CompilationUnitElement]. 249 * A reference to a [CompilationUnitElement].
255 */ 250 */
256 static const MatchKind UNIT_REFERENCE = const MatchKind('UNIT_REFERENCE', 37); 251 static const MatchKind UNIT_REFERENCE = const MatchKind('UNIT_REFERENCE');
257 252
258 /** 253 /**
259 * A declaration of a variable. 254 * A declaration of a variable.
260 */ 255 */
261 static const MatchKind VARIABLE_DECLARATION = const MatchKind( 256 static const MatchKind VARIABLE_DECLARATION = const MatchKind(
262 'VARIABLE_DECLARATION', 38); 257 'VARIABLE_DECLARATION');
263 258
264 /** 259 /**
265 * A reference to a variable in which the variable's value is being read. 260 * A reference to a variable in which the variable's value is being read.
266 */ 261 */
267 static const MatchKind VARIABLE_READ = const MatchKind('VARIABLE_READ', 39); 262 static const MatchKind VARIABLE_READ = const MatchKind('VARIABLE_READ');
268 263
269 /** 264 /**
270 * A reference to a variable in which the variable's value is being both read 265 * A reference to a variable in which the variable's value is being both read
271 * and write. 266 * and write.
272 */ 267 */
273 static const MatchKind VARIABLE_READ_WRITE = const MatchKind( 268 static const MatchKind VARIABLE_READ_WRITE = const MatchKind(
274 'VARIABLE_READ_WRITE', 40); 269 'VARIABLE_READ_WRITE');
275 270
276 /** 271 /**
277 * A reference to a variable in which the variables's value is being written. 272 * A reference to a variable in which the variables's value is being written.
278 */ 273 */
279 static const MatchKind VARIABLE_WRITE = const MatchKind('VARIABLE_WRITE', 41); 274 static const MatchKind VARIABLE_WRITE = const MatchKind('VARIABLE_WRITE');
280 275
281 /** 276 /**
282 * A reference to a type in which the type was mixed in. 277 * A reference to a type in which the type was mixed in.
283 */ 278 */
284 static const MatchKind WITH_REFERENCE = const MatchKind('WITH_REFERENCE', 42); 279 static const MatchKind WITH_REFERENCE = const MatchKind('WITH_REFERENCE');
285 280
286 static const List<MatchKind> values = const [ANGULAR_REFERENCE, 281 final String name;
287 ANGULAR_CLOSING_TAG_REFERENCE, CLASS_DECLARATION, CLASS_ALIAS_DECLARATION, 282
288 CONSTRUCTOR_DECLARATION, CONSTRUCTOR_REFERENCE, EXTENDS_REFERENCE, 283 const MatchKind(this.name);
289 FIELD_INVOCATION, FIELD_REFERENCE, FIELD_READ, FIELD_WRITE, 284
290 FUNCTION_DECLARATION, FUNCTION_EXECUTION, FUNCTION_REFERENCE, 285 @override
291 FUNCTION_TYPE_DECLARATION, FUNCTION_TYPE_REFERENCE, IMPLEMENTS_REFERENCE, 286 String toString() => name;
292 IMPORT_REFERENCE, INTERFACE_IMPLEMENTED, LIBRARY_REFERENCE, METHOD_INVOCAT ION,
293 METHOD_REFERENCE, NAME_DECLARATION, NAME_REFERENCE_RESOLVED,
294 NAME_INVOCATION_RESOLVED, NAME_READ_RESOLVED, NAME_READ_WRITE_RESOLVED,
295 NAME_WRITE_RESOLVED, NAME_INVOCATION_UNRESOLVED, NAME_READ_UNRESOLVED,
296 NAME_READ_WRITE_UNRESOLVED, NAME_WRITE_UNRESOLVED, NAME_REFERENCE_UNRESOLV ED,
297 NAMED_PARAMETER_REFERENCE, PROPERTY_ACCESSOR_REFERENCE, TYPE_REFERENCE,
298 TYPE_PARAMETER_REFERENCE, UNIT_REFERENCE, VARIABLE_DECLARATION, VARIABLE_R EAD,
299 VARIABLE_READ_WRITE, VARIABLE_WRITE, WITH_REFERENCE];
300
301 const MatchKind(String name, int ordinal) : super(name, ordinal);
302 } 287 }
303 288
304 289
305 /** 290 /**
306 * The interface [SearchEngine] defines the behavior of objects that can be used 291 * The interface [SearchEngine] defines the behavior of objects that can be used
307 * to search for various pieces of information. 292 * to search for various pieces of information.
308 */ 293 */
309 abstract class SearchEngine { 294 abstract class SearchEngine {
310 // /** 295 // /**
311 // * Returns types assigned to the given field or top-level variable. 296 // * Returns types assigned to the given field or top-level variable.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 final SourceRange sourceRange; 358 final SourceRange sourceRange;
374 359
375 /** 360 /**
376 * Is `true` if the match is a resolved reference to some [Element]. 361 * Is `true` if the match is a resolved reference to some [Element].
377 */ 362 */
378 final bool isResolved; 363 final bool isResolved;
379 364
380 /** 365 /**
381 * Is `true` if field or method access is done using qualifier. 366 * Is `true` if field or method access is done using qualifier.
382 */ 367 */
383 bool qualified = false; 368 final bool isQualified;
384 369
385 SearchMatch(this.kind, this.element, this.sourceRange, this.isResolved); 370 SearchMatch(this.kind, this.element, this.sourceRange, this.isResolved, this.i sQualified);
386 371
387 @override 372 @override
388 int get hashCode => JavaArrays.makeHashCode([element, sourceRange, kind]); 373 int get hashCode => JavaArrays.makeHashCode([element, sourceRange, kind]);
389 374
390 @override 375 @override
391 bool operator ==(Object object) { 376 bool operator ==(Object object) {
392 if (identical(object, this)) { 377 if (identical(object, this)) {
393 return true; 378 return true;
394 } 379 }
395 if (object is SearchMatch) { 380 if (object is SearchMatch) {
396 return kind == object.kind && isResolved == object.isResolved && qualified 381 return kind == object.kind && isResolved == object.isResolved && isQualifi ed
397 == object.qualified && sourceRange == object.sourceRange && element == 382 == object.isQualified && sourceRange == object.sourceRange && element ==
398 object.element; 383 object.element;
399 } 384 }
400 return false; 385 return false;
401 } 386 }
402 387
403 @override 388 @override
404 String toString() { 389 String toString() {
405 StringBuffer buffer = new StringBuffer(); 390 StringBuffer buffer = new StringBuffer();
406 buffer.write("SearchMatch(kind="); 391 buffer.write("SearchMatch(kind=");
407 buffer.write(kind); 392 buffer.write(kind);
408 buffer.write(", isResolved=");
409 buffer.write(isResolved);
410 buffer.write(", element="); 393 buffer.write(", element=");
411 buffer.write(element.displayName); 394 buffer.write(element.displayName);
412 buffer.write(", range="); 395 buffer.write(", range=");
413 buffer.write(sourceRange); 396 buffer.write(sourceRange);
414 buffer.write(", qualified="); 397 buffer.write(", isResolved=");
415 buffer.write(qualified); 398 buffer.write(isResolved);
399 buffer.write(", isQualified=");
400 buffer.write(isQualified);
416 buffer.write(")"); 401 buffer.write(")");
417 return buffer.toString(); 402 return buffer.toString();
418 } 403 }
419 } 404 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_services/lib/src/index/index_contributor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698