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

Side by Side Diff: pkg/analyzer/lib/src/search/search_engine.dart

Issue 375693002: Move index/search to services. (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 | « pkg/analyzer/lib/src/index/store/split_store.dart ('k') | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
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.
7
8 library engine.src.search_engine;
9
10 ///**
11 // * Instances of the class <code>AndSearchPattern</code> implement a search pat tern that matches
12 // * elements that match all of several other search patterns.
13 // */
14 //class AndSearchPattern implements SearchPattern {
15 // /**
16 // * The patterns used to determine whether this pattern matches an element.
17 // */
18 // final List<SearchPattern> _patterns;
19 //
20 // /**
21 // * Initialize a newly created search pattern to match elements that match al l of several other
22 // * search patterns.
23 // *
24 // * @param patterns the patterns used to determine whether this pattern match es an element
25 // */
26 // AndSearchPattern(this._patterns);
27 //
28 // @override
29 // MatchQuality matches(Element element) {
30 // MatchQuality highestQuality = null;
31 // for (SearchPattern pattern in _patterns) {
32 // MatchQuality quality = pattern.matches(element);
33 // if (quality == null) {
34 // return null;
35 // }
36 // if (highestQuality == null) {
37 // highestQuality = quality;
38 // } else {
39 // highestQuality = highestQuality.max(quality);
40 // }
41 // }
42 // return highestQuality;
43 // }
44 //}
45 //
46 ///**
47 // * Instances of the class <code>CamelCaseSearchPattern</code> implement a sear ch pattern that
48 // * matches elements whose name matches a partial identifier where camel case c onventions are used to
49 // * perform what is essentially multiple prefix matches.
50 // */
51 //class CamelCaseSearchPattern implements SearchPattern {
52 // /**
53 // * The pattern that matching elements must match.
54 // */
55 // List<int> _pattern;
56 //
57 // /**
58 // * A flag indicating whether the pattern and the name being matched must hav e exactly the same
59 // * number of parts (i.e. the same number of uppercase characters).
60 // */
61 // final bool _samePartCount;
62 //
63 // /**
64 // * Initialize a newly created search pattern to match elements whose names m atch the given
65 // * camel-case pattern.
66 // *
67 // * @param pattern the pattern that matching elements must match
68 // * @param samePartCount `true` if the pattern and the name being matched mus t have
69 // * exactly the same number of parts (i.e. the same number of upperc ase characters)
70 // */
71 // CamelCaseSearchPattern(String pattern, this._samePartCount) {
72 // this._pattern = pattern.toCharArray();
73 // }
74 //
75 // @override
76 // MatchQuality matches(Element element) {
77 // String name = element.displayName;
78 // if (name == null) {
79 // return null;
80 // }
81 // if (CharOperation.camelCaseMatch(_pattern, name.toCharArray(), _samePartCo unt)) {
82 // return MatchQuality.EXACT;
83 // }
84 // return null;
85 // }
86 //}
87 //
88 ///**
89 // * Instances of the class `CountingSearchListener` listen for search results, passing those
90 // * results on to a wrapped listener, but ensure that the wrapped search listen er receives only one
91 // * notification that the search is complete.
92 // */
93 //class CountingSearchListener implements SearchListener {
94 // /**
95 // * The number of times that this listener expects to be told that the search is complete before
96 // * passing the information along to the wrapped listener.
97 // */
98 // int _completionCount = 0;
99 //
100 // /**
101 // * The listener that will be notified as results are received and when the g iven number of search
102 // * complete notifications have been received.
103 // */
104 // final SearchListener _wrappedListener;
105 //
106 // /**
107 // * Initialize a newly created search listener to pass search results on to t he given listener and
108 // * to notify the given listener that the search is complete after getting th e given number of
109 // * notifications.
110 // *
111 // * @param completionCount the number of times that this listener expects to be told that the
112 // * search is complete
113 // * @param wrappedListener the listener that will be notified as results are received
114 // */
115 // CountingSearchListener(int completionCount, this._wrappedListener) {
116 // this._completionCount = completionCount;
117 // if (completionCount == 0) {
118 // _wrappedListener.searchComplete();
119 // }
120 // }
121 //
122 // @override
123 // void matchFound(SearchMatch match) {
124 // _wrappedListener.matchFound(match);
125 // }
126 //
127 // @override
128 // void searchComplete() {
129 // _completionCount--;
130 // if (_completionCount <= 0) {
131 // _wrappedListener.searchComplete();
132 // }
133 // }
134 //}
135 //
136 ///**
137 // * Instances of the class <code>ExactSearchPattern</code> implement a search p attern that matches
138 // * elements whose name matches a specified identifier exactly.
139 // */
140 //class ExactSearchPattern implements SearchPattern {
141 // /**
142 // * The identifier that matching elements must be equal to.
143 // */
144 // final String _identifier;
145 //
146 // /**
147 // * A flag indicating whether a case sensitive match is to be performed.
148 // */
149 // final bool _caseSensitive;
150 //
151 // /**
152 // * Initialize a newly created search pattern to match elements whose names b egin with the given
153 // * prefix.
154 // *
155 // * @param identifier the identifier that matching elements must be equal to
156 // * @param caseSensitive `true` if a case sensitive match is to be performed
157 // */
158 // ExactSearchPattern(this._identifier, this._caseSensitive);
159 //
160 // @override
161 // MatchQuality matches(Element element) {
162 // String name = element.displayName;
163 // if (name == null) {
164 // return null;
165 // }
166 // if (_caseSensitive && name == _identifier) {
167 // return MatchQuality.EXACT;
168 // }
169 // if (!_caseSensitive && javaStringEqualsIgnoreCase(name, _identifier)) {
170 // return MatchQuality.EXACT;
171 // }
172 // return null;
173 // }
174 //}
175 //
176 ///**
177 // * Instances of the class <code>FilteredSearchListener</code> implement a sear ch listener that
178 // * delegates to another search listener after removing matches that do not pas s a given filter.
179 // */
180 //class FilteredSearchListener extends WrappedSearchListener {
181 // /**
182 // * The filter used to filter the matches.
183 // */
184 // final SearchFilter _filter;
185 //
186 // /**
187 // * Initialize a newly created search listener to pass on any matches that pa ss the given filter to
188 // * the given listener.
189 // *
190 // * @param filter the filter used to filter the matches
191 // * @param listener the search listener being wrapped
192 // */
193 // FilteredSearchListener(this._filter, SearchListener listener) : super(listen er);
194 //
195 // @override
196 // void matchFound(SearchMatch match) {
197 // if (_filter.passes(match)) {
198 // propagateMatch(match);
199 // }
200 // }
201 //}
202 //
203 ///**
204 // * [SearchListener] used by [SearchEngineImpl] internally to gather asynchrono us results
205 // * and return them synchronously.
206 // */
207 //class GatheringSearchListener implements SearchListener {
208 // /**
209 // * A list containing the matches that have been found so far.
210 // */
211 // List<SearchMatch> _matches = [];
212 //
213 // /**
214 // * A flag indicating whether the search is complete.
215 // */
216 // bool _isComplete = false;
217 //
218 // /**
219 // * @return the the matches that have been found.
220 // */
221 // List<SearchMatch> get matches {
222 // _matches.sort(SearchMatch.SORT_BY_ELEMENT_NAME);
223 // return _matches;
224 // }
225 //
226 // /**
227 // * Return `true` if the search is complete.
228 // *
229 // * @return `true` if the search is complete
230 // */
231 // bool get isComplete => _isComplete;
232 //
233 // @override
234 // void matchFound(SearchMatch match) {
235 // _matches.add(match);
236 // }
237 //
238 // @override
239 // void searchComplete() {
240 // _isComplete = true;
241 // }
242 //}
243 //
244 ///**
245 // * Instances of the class <code>LibrarySearchScope</code> implement a search s cope that encompasses
246 // * everything in a given collection of libraries.
247 // */
248 //class LibrarySearchScope implements SearchScope {
249 // /**
250 // * The libraries defining which elements are included in the scope.
251 // */
252 // final List<LibraryElement> libraries;
253 //
254 // /**
255 // * Create a search scope that encompasses everything in the given libraries.
256 // *
257 // * @param libraries the libraries defining which elements are included in th e scope
258 // */
259 // LibrarySearchScope.con1(Iterable<LibraryElement> libraries) : this.con2(new List.from(libraries));
260 //
261 // /**
262 // * Create a search scope that encompasses everything in the given libraries.
263 // *
264 // * @param libraries the libraries defining which elements are included in th e scope
265 // */
266 // LibrarySearchScope.con2(this.libraries);
267 //
268 // @override
269 // bool encloses(Element element) {
270 // LibraryElement elementLibrary = element.getAncestor((element) => element i s LibraryElement);
271 // return ArrayUtils.contains(libraries, elementLibrary);
272 // }
273 //}
274 //
275 ///**
276 // * Instances of the class <code>NameMatchingSearchListener</code> implement a search listener that
277 // * delegates to another search listener after removing matches that do not mat ch a given pattern.
278 // */
279 //class NameMatchingSearchListener extends WrappedSearchListener {
280 // /**
281 // * The pattern used to filter the matches.
282 // */
283 // final SearchPattern _pattern;
284 //
285 // /**
286 // * Initialize a newly created search listener to pass on any matches that ma tch the given pattern
287 // * to the given listener.
288 // *
289 // * @param pattern the pattern used to filter the matches
290 // * @param listener the search listener being wrapped
291 // */
292 // NameMatchingSearchListener(this._pattern, SearchListener listener) : super(l istener);
293 //
294 // @override
295 // void matchFound(SearchMatch match) {
296 // if (_pattern.matches(match.element) != null) {
297 // propagateMatch(match);
298 // }
299 // }
300 //}
301 //
302 ///**
303 // * Instances of the class <code>OrSearchPattern</code> implement a search patt ern that matches
304 // * elements that match any one of several other search patterns.
305 // */
306 //class OrSearchPattern implements SearchPattern {
307 // /**
308 // * The patterns used to determine whether this pattern matches an element.
309 // */
310 // final List<SearchPattern> _patterns;
311 //
312 // /**
313 // * Initialize a newly created search pattern to match elements that match an y one of several other
314 // * search patterns.
315 // *
316 // * @param patterns the patterns used to determine whether this pattern match es an element
317 // */
318 // OrSearchPattern(this._patterns);
319 //
320 // @override
321 // MatchQuality matches(Element element) {
322 // // Do we want to return the highest quality of match rather than stopping
323 // // after the first match? Doing so would be more accurate, but slower.
324 // for (SearchPattern pattern in _patterns) {
325 // MatchQuality quality = pattern.matches(element);
326 // if (quality != null) {
327 // return quality;
328 // }
329 // }
330 // return null;
331 // }
332 //}
333 //
334 ///**
335 // * Instances of the class <code>PrefixSearchPattern</code> implement a search pattern that matches
336 // * elements whose name has a given prefix.
337 // */
338 //class PrefixSearchPattern implements SearchPattern {
339 // /**
340 // * The prefix that matching elements must start with.
341 // */
342 // final String _prefix;
343 //
344 // /**
345 // * A flag indicating whether a case sensitive match is to be performed.
346 // */
347 // final bool _caseSensitive;
348 //
349 // /**
350 // * Initialize a newly created search pattern to match elements whose names b egin with the given
351 // * prefix.
352 // *
353 // * @param prefix the prefix that matching elements must start with
354 // * @param caseSensitive `true` if a case sensitive match is to be performed
355 // */
356 // PrefixSearchPattern(this._prefix, this._caseSensitive);
357 //
358 // @override
359 // MatchQuality matches(Element element) {
360 // if (element == null) {
361 // return null;
362 // }
363 // String name = element.displayName;
364 // if (name == null) {
365 // return null;
366 // }
367 // if (_caseSensitive && startsWith(name, _prefix)) {
368 // return MatchQuality.EXACT;
369 // }
370 // if (!_caseSensitive && startsWithIgnoreCase(name, _prefix)) {
371 // return MatchQuality.EXACT;
372 // }
373 // return null;
374 // }
375 //}
376 //
377 ///**
378 // * Instances of the class <code>RegularExpressionSearchPattern</code> implemen t a search pattern
379 // * that matches elements whose name matches a given regular expression.
380 // */
381 //class RegularExpressionSearchPattern implements SearchPattern {
382 // /**
383 // * The regular expression pattern that matching elements must match.
384 // */
385 // RegExp _pattern;
386 //
387 // /**
388 // * Initialize a newly created search pattern to match elements whose names b egin with the given
389 // * prefix.
390 // *
391 // * @param regularExpression the regular expression that matching elements mu st match
392 // * @param caseSensitive `true` if a case sensitive match is to be performed
393 // */
394 // RegularExpressionSearchPattern(String regularExpression, bool caseSensitive) {
395 // _pattern = new RegExp(regularExpression);
396 // }
397 //
398 // @override
399 // MatchQuality matches(Element element) {
400 // if (element == null) {
401 // return null;
402 // }
403 // String name = element.displayName;
404 // if (name == null) {
405 // return null;
406 // }
407 // if (new JavaPatternMatcher(_pattern, name).matches()) {
408 // return MatchQuality.EXACT;
409 // }
410 // return null;
411 // }
412 //}
413 //
414 ///**
415 // * Factory for [SearchEngine].
416 // */
417 //class SearchEngineFactory {
418 // /**
419 // * @return the new [SearchEngine] instance based on the given [Index].
420 // */
421 // static SearchEngine createSearchEngine(Index index) => new SearchEngineImpl( index);
422 //}
423
424 ///**
425 // * Implementation of [SearchEngine].
426 // */
427 //class SearchEngineImpl implements SearchEngine {
428 // /**
429 // * Apply the given filter to the given listener.
430 // *
431 // * @param filter the filter to be used before passing matches on to the list ener, or `null`
432 // * if all matches should be passed on
433 // * @param listener the listener that will only be given matches that pass th e filter
434 // * @return a search listener that will pass to the given listener any matche s that pass the given
435 // * filter
436 // */
437 // static SearchListener _applyFilter(SearchFilter filter, SearchListener liste ner) {
438 // if (filter == null) {
439 // return listener;
440 // }
441 // return new FilteredSearchListener(filter, listener);
442 // }
443 //
444 // /**
445 // * Apply the given pattern to the given listener.
446 // *
447 // * @param pattern the pattern to be used before passing matches on to the li stener, or
448 // * `null` if all matches should be passed on
449 // * @param listener the listener that will only be given matches that match t he pattern
450 // * @return a search listener that will pass to the given listener any matche s that match the given
451 // * pattern
452 // */
453 // static SearchListener _applyPattern(SearchPattern pattern, SearchListener li stener) {
454 // if (pattern == null) {
455 // return listener;
456 // }
457 // return new NameMatchingSearchListener(pattern, listener);
458 // }
459 //
460 // static List<Element> _createElements(SearchScope scope) {
461 // if (scope is LibrarySearchScope) {
462 // return scope.libraries;
463 // }
464 // return <Element> [IndexConstants.UNIVERSE];
465 // }
466 //
467 // static RelationshipCallback _newCallback(MatchKind matchKind, SearchScope sc ope, SearchListener listener) => new SearchEngineImpl_RelationshipCallbackImpl(s cope, matchKind, listener);
468 //
469 // /**
470 // * The index used to respond to the search requests.
471 // */
472 // final Index _index;
473 //
474 // /**
475 // * Initialize a newly created search engine to use the given index.
476 // *
477 // * @param index the index used to respond to the search requests
478 // */
479 // SearchEngineImpl(this._index);
480 //
481 // @override
482 // Set<DartType> searchAssignedTypes(PropertyInducingElement variable, SearchSc ope scope) {
483 // PropertyAccessorElement setter = variable.setter;
484 // int numRequests = (setter != null ? 2 : 0) + 2;
485 // // find locations
486 // List<Location> locations = [];
487 // CountDownLatch latch = new CountDownLatch(numRequests);
488 // if (setter != null) {
489 // _index.getRelationships(setter, IndexConstants.IS_REFERENCED_BY_QUALIFIE D, new Callback());
490 // _index.getRelationships(setter, IndexConstants.IS_REFERENCED_BY_UNQUALIF IED, new Callback());
491 // }
492 // _index.getRelationships(variable, IndexConstants.IS_REFERENCED_BY, new Cal lback());
493 // _index.getRelationships(variable, IndexConstants.IS_DEFINED_BY, new Callba ck());
494 // Uninterruptibles.awaitUninterruptibly(latch);
495 // // get types from locations
496 // Set<DartType> types = new Set();
497 // for (Location location in locations) {
498 // // check scope
499 // if (scope != null) {
500 // Element targetElement = location.element;
501 // if (!scope.encloses(targetElement)) {
502 // continue;
503 // }
504 // }
505 // // we need data
506 // if (location is! LocationWithData) {
507 // continue;
508 // }
509 // LocationWithData locationWithData = location as LocationWithData;
510 // // add type
511 // Object data = locationWithData.data;
512 // if (data is DartType) {
513 // DartType type = data as DartType;
514 // types.add(type);
515 // }
516 // }
517 // // done
518 // return types;
519 // }
520 //
521 // @override
522 // List<SearchMatch> searchDeclarations(String name, SearchScope scope, SearchF ilter filter) => _gatherResults(new SearchRunner_SearchEngineImpl_searchDeclarat ions(this, name, scope, filter));
523 //
524 // @override
525 // void searchDeclarations2(String name, SearchScope scope, SearchFilter filter , SearchListener listener) {
526 // assert(listener != null);
527 // listener = _applyFilter(filter, listener);
528 // _index.getRelationships(new NameElementImpl(name), IndexConstants.IS_DEFIN ED_BY, _newCallback(MatchKind.NAME_DECLARATION, scope, listener));
529 // }
530 //
531 // @override
532 // List<SearchMatch> searchFunctionDeclarations(SearchScope scope, SearchPatter n pattern, SearchFilter filter) => _gatherResults(new SearchRunner_SearchEngineI mpl_searchFunctionDeclarations(this, scope, pattern, filter));
533 //
534 // @override
535 // void searchFunctionDeclarations2(SearchScope scope, SearchPattern pattern, S earchFilter filter, SearchListener listener) {
536 // assert(listener != null);
537 // List<Element> elements = _createElements(scope);
538 // listener = _applyPattern(pattern, listener);
539 // listener = _applyFilter(filter, listener);
540 // listener = new CountingSearchListener(elements.length, listener);
541 // for (Element element in elements) {
542 // _index.getRelationships(element, IndexConstants.DEFINES_FUNCTION, _newCa llback(MatchKind.FUNCTION_DECLARATION, scope, listener));
543 // }
544 // }
545 //
546 // @override
547 // List<SearchMatch> searchQualifiedMemberReferences(String name, SearchScope s cope, SearchFilter filter) => _gatherResults(new SearchRunner_SearchEngineImpl_s earchQualifiedMemberReferences(this, name, scope, filter));
548 //
549 // @override
550 // void searchQualifiedMemberReferences2(String name, SearchScope scope, Search Filter filter, SearchListener listener) {
551 // assert(listener != null);
552 // listener = _applyFilter(filter, listener);
553 // listener = new CountingSearchListener(10, listener);
554 // _index.getRelationships(new NameElementImpl(name), IndexConstants.IS_REFER ENCED_BY_QUALIFIED_RESOLVED, _newCallback(MatchKind.NAME_REFERENCE_RESOLVED, sco pe, listener));
555 // _index.getRelationships(new NameElementImpl(name), IndexConstants.IS_REFER ENCED_BY_QUALIFIED_UNRESOLVED, _newCallback(MatchKind.NAME_REFERENCE_UNRESOLVED, scope, listener));
556 // // granular resolved operations
557 // _index.getRelationships(new NameElementImpl(name), IndexConstants.NAME_IS_ INVOKED_BY_RESOLVED, _newCallback(MatchKind.NAME_INVOCATION_RESOLVED, scope, lis tener));
558 // _index.getRelationships(new NameElementImpl(name), IndexConstants.NAME_IS_ READ_BY_RESOLVED, _newCallback(MatchKind.NAME_READ_RESOLVED, scope, listener));
559 // _index.getRelationships(new NameElementImpl(name), IndexConstants.NAME_IS_ READ_WRITTEN_BY_RESOLVED, _newCallback(MatchKind.NAME_READ_WRITE_RESOLVED, scope , listener));
560 // _index.getRelationships(new NameElementImpl(name), IndexConstants.NAME_IS_ WRITTEN_BY_RESOLVED, _newCallback(MatchKind.NAME_WRITE_RESOLVED, scope, listener ));
561 // // granular unresolved operations
562 // _index.getRelationships(new NameElementImpl(name), IndexConstants.NAME_IS_ INVOKED_BY_UNRESOLVED, _newCallback(MatchKind.NAME_INVOCATION_UNRESOLVED, scope, listener));
563 // _index.getRelationships(new NameElementImpl(name), IndexConstants.NAME_IS_ READ_BY_UNRESOLVED, _newCallback(MatchKind.NAME_READ_UNRESOLVED, scope, listener ));
564 // _index.getRelationships(new NameElementImpl(name), IndexConstants.NAME_IS_ READ_WRITTEN_BY_UNRESOLVED, _newCallback(MatchKind.NAME_READ_WRITE_UNRESOLVED, s cope, listener));
565 // _index.getRelationships(new NameElementImpl(name), IndexConstants.NAME_IS_ WRITTEN_BY_UNRESOLVED, _newCallback(MatchKind.NAME_WRITE_UNRESOLVED, scope, list ener));
566 // }
567 //
568 // @override
569 // List<SearchMatch> searchReferences(Element element, SearchScope scope, Searc hFilter filter) => _gatherResults(new SearchRunner_SearchEngineImpl_searchRefere nces(this, element, scope, filter));
570 //
571 // @override
572 // void searchReferences2(Element element, SearchScope scope, SearchFilter filt er, SearchListener listener) {
573 // if (element == null) {
574 // listener.searchComplete();
575 // return;
576 // }
577 // if (element is Member) {
578 // element = (element as Member).baseElement;
579 // }
580 // while (true) {
581 // if (element.kind == ElementKind.ANGULAR_COMPONENT || element.kind == Ele mentKind.ANGULAR_CONTROLLER || element.kind == ElementKind.ANGULAR_FORMATTER || element.kind == ElementKind.ANGULAR_PROPERTY || element.kind == ElementKind.ANGU LAR_SCOPE_PROPERTY || element.kind == ElementKind.ANGULAR_SELECTOR) {
582 // _searchReferences(element as AngularElement, scope, filter, listener);
583 // return;
584 // } else if (element.kind == ElementKind.CLASS) {
585 // _searchReferences2(element as ClassElement, scope, filter, listener);
586 // return;
587 // } else if (element.kind == ElementKind.COMPILATION_UNIT) {
588 // _searchReferences3(element as CompilationUnitElement, scope, filter, l istener);
589 // return;
590 // } else if (element.kind == ElementKind.CONSTRUCTOR) {
591 // _searchReferences4(element as ConstructorElement, scope, filter, liste ner);
592 // return;
593 // } else if (element.kind == ElementKind.FIELD || element.kind == ElementK ind.TOP_LEVEL_VARIABLE) {
594 // _searchReferences12(element as PropertyInducingElement, scope, filter, listener);
595 // return;
596 // } else if (element.kind == ElementKind.FUNCTION) {
597 // _searchReferences5(element as FunctionElement, scope, filter, listener );
598 // return;
599 // } else if (element.kind == ElementKind.GETTER || element.kind == Element Kind.SETTER) {
600 // _searchReferences11(element as PropertyAccessorElement, scope, filter, listener);
601 // return;
602 // } else if (element.kind == ElementKind.IMPORT) {
603 // _searchReferences7(element as ImportElement, scope, filter, listener);
604 // return;
605 // } else if (element.kind == ElementKind.LIBRARY) {
606 // _searchReferences8(element as LibraryElement, scope, filter, listener) ;
607 // return;
608 // } else if (element.kind == ElementKind.LOCAL_VARIABLE) {
609 // _searchReferences14(element as LocalVariableElement, scope, filter, li stener);
610 // return;
611 // } else if (element.kind == ElementKind.METHOD) {
612 // _searchReferences9(element as MethodElement, scope, filter, listener);
613 // return;
614 // } else if (element.kind == ElementKind.PARAMETER) {
615 // _searchReferences10(element as ParameterElement, scope, filter, listen er);
616 // return;
617 // } else if (element.kind == ElementKind.FUNCTION_TYPE_ALIAS) {
618 // _searchReferences6(element as FunctionTypeAliasElement, scope, filter, listener);
619 // return;
620 // } else if (element.kind == ElementKind.TYPE_PARAMETER) {
621 // _searchReferences13(element as TypeParameterElement, scope, filter, li stener);
622 // return;
623 // } else {
624 // listener.searchComplete();
625 // return;
626 // }
627 // break;
628 // }
629 // }
630 //
631 // @override
632 // List<SearchMatch> searchSubtypes(ClassElement type, SearchScope scope, Searc hFilter filter) => _gatherResults(new SearchRunner_SearchEngineImpl_searchSubtyp es(this, type, scope, filter));
633 //
634 // @override
635 // void searchSubtypes2(ClassElement type, SearchScope scope, SearchFilter filt er, SearchListener listener) {
636 // assert(listener != null);
637 // listener = _applyFilter(filter, listener);
638 // listener = new CountingSearchListener(3, listener);
639 // _index.getRelationships(type, IndexConstants.IS_EXTENDED_BY, _newCallback( MatchKind.EXTENDS_REFERENCE, scope, listener));
640 // _index.getRelationships(type, IndexConstants.IS_MIXED_IN_BY, _newCallback( MatchKind.WITH_REFERENCE, scope, listener));
641 // _index.getRelationships(type, IndexConstants.IS_IMPLEMENTED_BY, _newCallba ck(MatchKind.IMPLEMENTS_REFERENCE, scope, listener));
642 // }
643 //
644 // @override
645 // List<SearchMatch> searchTypeDeclarations(SearchScope scope, SearchPattern pa ttern, SearchFilter filter) => _gatherResults(new SearchRunner_SearchEngineImpl_ searchTypeDeclarations(this, scope, pattern, filter));
646 //
647 // @override
648 // void searchTypeDeclarations2(SearchScope scope, SearchPattern pattern, Searc hFilter filter, SearchListener listener) {
649 // assert(listener != null);
650 // List<Element> elements = _createElements(scope);
651 // listener = _applyPattern(pattern, listener);
652 // listener = _applyFilter(filter, listener);
653 // listener = new CountingSearchListener(elements.length * 3, listener);
654 // for (Element element in elements) {
655 // _index.getRelationships(element, IndexConstants.DEFINES_CLASS, _newCallb ack(MatchKind.CLASS_DECLARATION, scope, listener));
656 // _index.getRelationships(element, IndexConstants.DEFINES_CLASS_ALIAS, _ne wCallback(MatchKind.CLASS_ALIAS_DECLARATION, scope, listener));
657 // _index.getRelationships(element, IndexConstants.DEFINES_FUNCTION_TYPE, _ newCallback(MatchKind.FUNCTION_TYPE_DECLARATION, scope, listener));
658 // }
659 // }
660 //
661 // @override
662 // List<SearchMatch> searchVariableDeclarations(SearchScope scope, SearchPatter n pattern, SearchFilter filter) => _gatherResults(new SearchRunner_SearchEngineI mpl_searchVariableDeclarations(this, scope, pattern, filter));
663 //
664 // @override
665 // void searchVariableDeclarations2(SearchScope scope, SearchPattern pattern, S earchFilter filter, SearchListener listener) {
666 // assert(listener != null);
667 // List<Element> elements = _createElements(scope);
668 // listener = _applyPattern(pattern, listener);
669 // listener = _applyFilter(filter, listener);
670 // listener = new CountingSearchListener(elements.length, listener);
671 // for (Element element in elements) {
672 // _index.getRelationships(element, IndexConstants.DEFINES_VARIABLE, _newCa llback(MatchKind.VARIABLE_DECLARATION, scope, listener));
673 // }
674 // }
675 //
676 // /**
677 // * Use the given runner to perform the given number of asynchronous searches , then wait until the
678 // * search has completed and return the results that were produced.
679 // *
680 // * @param runner the runner used to perform an asynchronous search
681 // * @return the results that were produced @ if the results of at least one o f the searched could
682 // * not be computed
683 // */
684 // List<SearchMatch> _gatherResults(SearchEngineImpl_SearchRunner runner) {
685 // GatheringSearchListener listener = new GatheringSearchListener();
686 // runner.performSearch(listener);
687 // while (!listener.isComplete) {
688 // Thread.yield();
689 // }
690 // return listener.matches;
691 // }
692 //
693 // void _searchReferences(AngularElement element, SearchScope scope, SearchFilt er filter, SearchListener listener) {
694 // assert(listener != null);
695 // listener = _applyFilter(filter, listener);
696 // listener = new CountingSearchListener(2, listener);
697 // _index.getRelationships(element, IndexConstants.ANGULAR_REFERENCE, _newCal lback(MatchKind.ANGULAR_REFERENCE, scope, listener));
698 // _index.getRelationships(element, IndexConstants.ANGULAR_CLOSING_TAG_REFERE NCE, _newCallback(MatchKind.ANGULAR_CLOSING_TAG_REFERENCE, scope, listener));
699 // }
700 //
701 // void _searchReferences2(ClassElement type, SearchScope scope, SearchFilter f ilter, SearchListener listener) {
702 // assert(listener != null);
703 // listener = _applyFilter(filter, listener);
704 // _index.getRelationships(type, IndexConstants.IS_REFERENCED_BY, _newCallbac k(MatchKind.TYPE_REFERENCE, scope, listener));
705 // }
706 //
707 // void _searchReferences3(CompilationUnitElement unit, SearchScope scope, Sear chFilter filter, SearchListener listener) {
708 // assert(listener != null);
709 // listener = _applyFilter(filter, listener);
710 // _index.getRelationships(unit, IndexConstants.IS_REFERENCED_BY, _newCallbac k(MatchKind.UNIT_REFERENCE, scope, listener));
711 // }
712 //
713 // void _searchReferences4(ConstructorElement constructor, SearchScope scope, S earchFilter filter, SearchListener listener) {
714 // assert(listener != null);
715 // listener = _applyFilter(filter, listener);
716 // listener = new CountingSearchListener(2, listener);
717 // _index.getRelationships(constructor, IndexConstants.IS_DEFINED_BY, _newCal lback(MatchKind.CONSTRUCTOR_DECLARATION, scope, listener));
718 // _index.getRelationships(constructor, IndexConstants.IS_REFERENCED_BY, _new Callback(MatchKind.CONSTRUCTOR_REFERENCE, scope, listener));
719 // }
720 //
721 // void _searchReferences5(FunctionElement function, SearchScope scope, SearchF ilter filter, SearchListener listener) {
722 // assert(listener != null);
723 // listener = _applyFilter(filter, listener);
724 // listener = new CountingSearchListener(2, listener);
725 // _index.getRelationships(function, IndexConstants.IS_REFERENCED_BY, _newCal lback(MatchKind.FUNCTION_REFERENCE, scope, listener));
726 // _index.getRelationships(function, IndexConstants.IS_INVOKED_BY, _newCallba ck(MatchKind.FUNCTION_EXECUTION, scope, listener));
727 // }
728 //
729 // void _searchReferences6(FunctionTypeAliasElement alias, SearchScope scope, S earchFilter filter, SearchListener listener) {
730 // assert(listener != null);
731 // listener = _applyFilter(filter, listener);
732 // _index.getRelationships(alias, IndexConstants.IS_REFERENCED_BY, _newCallba ck(MatchKind.FUNCTION_TYPE_REFERENCE, scope, listener));
733 // }
734 //
735 // void _searchReferences7(ImportElement imp, SearchScope scope, SearchFilter f ilter, SearchListener listener) {
736 // assert(listener != null);
737 // listener = _applyFilter(filter, listener);
738 // _index.getRelationships(imp, IndexConstants.IS_REFERENCED_BY, _newCallback (MatchKind.IMPORT_REFERENCE, scope, listener));
739 // }
740 //
741 // void _searchReferences8(LibraryElement library, SearchScope scope, SearchFil ter filter, SearchListener listener) {
742 // assert(listener != null);
743 // listener = _applyFilter(filter, listener);
744 // _index.getRelationships(library, IndexConstants.IS_REFERENCED_BY, _newCall back(MatchKind.LIBRARY_REFERENCE, scope, listener));
745 // }
746 //
747 // void _searchReferences9(MethodElement method, SearchScope scope, SearchFilte r filter, SearchListener listener) {
748 // assert(listener != null);
749 // listener = _applyFilter(filter, listener);
750 // // TODO(scheglov) use "5" when add named matches
751 // listener = new CountingSearchListener(4, listener);
752 // // exact matches
753 // _index.getRelationships(method, IndexConstants.IS_INVOKED_BY_UNQUALIFIED, _newCallback(MatchKind.METHOD_INVOCATION, scope, listener));
754 // _index.getRelationships(method, IndexConstants.IS_INVOKED_BY_QUALIFIED, _n ewCallback(MatchKind.METHOD_INVOCATION, scope, listener));
755 // _index.getRelationships(method, IndexConstants.IS_REFERENCED_BY_UNQUALIFIE D, _newCallback(MatchKind.METHOD_REFERENCE, scope, listener));
756 // _index.getRelationships(method, IndexConstants.IS_REFERENCED_BY_QUALIFIED, _newCallback(MatchKind.METHOD_REFERENCE, scope, listener));
757 // }
758 //
759 // void _searchReferences10(ParameterElement parameter, SearchScope scope, Sear chFilter filter, SearchListener listener) {
760 // assert(listener != null);
761 // listener = _applyFilter(filter, listener);
762 // listener = new CountingSearchListener(5, listener);
763 // _index.getRelationships(parameter, IndexConstants.IS_READ_BY, _newCallback (MatchKind.VARIABLE_READ, scope, listener));
764 // _index.getRelationships(parameter, IndexConstants.IS_READ_WRITTEN_BY, _new Callback(MatchKind.VARIABLE_READ_WRITE, scope, listener));
765 // _index.getRelationships(parameter, IndexConstants.IS_WRITTEN_BY, _newCallb ack(MatchKind.VARIABLE_WRITE, scope, listener));
766 // _index.getRelationships(parameter, IndexConstants.IS_REFERENCED_BY, _newCa llback(MatchKind.NAMED_PARAMETER_REFERENCE, scope, listener));
767 // _index.getRelationships(parameter, IndexConstants.IS_INVOKED_BY, _newCallb ack(MatchKind.FUNCTION_EXECUTION, scope, listener));
768 // }
769 //
770 // void _searchReferences11(PropertyAccessorElement accessor, SearchScope scope , SearchFilter filter, SearchListener listener) {
771 // assert(listener != null);
772 // listener = _applyFilter(filter, listener);
773 // listener = new CountingSearchListener(2, listener);
774 // _index.getRelationships(accessor, IndexConstants.IS_REFERENCED_BY_QUALIFIE D, _newCallback(MatchKind.PROPERTY_ACCESSOR_REFERENCE, scope, listener));
775 // _index.getRelationships(accessor, IndexConstants.IS_REFERENCED_BY_UNQUALIF IED, _newCallback(MatchKind.PROPERTY_ACCESSOR_REFERENCE, scope, listener));
776 // }
777 //
778 // void _searchReferences12(PropertyInducingElement field, SearchScope scope, S earchFilter filter, SearchListener listener) {
779 // assert(listener != null);
780 // PropertyAccessorElement getter = field.getter;
781 // PropertyAccessorElement setter = field.setter;
782 // int numRequests = (getter != null ? 4 : 0) + (setter != null ? 2 : 0) + 2;
783 // listener = _applyFilter(filter, listener);
784 // listener = new CountingSearchListener(numRequests, listener);
785 // if (getter != null) {
786 // _index.getRelationships(getter, IndexConstants.IS_REFERENCED_BY_QUALIFIE D, _newCallback(MatchKind.FIELD_READ, scope, listener));
787 // _index.getRelationships(getter, IndexConstants.IS_REFERENCED_BY_UNQUALIF IED, _newCallback(MatchKind.FIELD_READ, scope, listener));
788 // _index.getRelationships(getter, IndexConstants.IS_INVOKED_BY_QUALIFIED, _newCallback(MatchKind.FIELD_INVOCATION, scope, listener));
789 // _index.getRelationships(getter, IndexConstants.IS_INVOKED_BY_UNQUALIFIED , _newCallback(MatchKind.FIELD_INVOCATION, scope, listener));
790 // }
791 // if (setter != null) {
792 // _index.getRelationships(setter, IndexConstants.IS_REFERENCED_BY_QUALIFIE D, _newCallback(MatchKind.FIELD_WRITE, scope, listener));
793 // _index.getRelationships(setter, IndexConstants.IS_REFERENCED_BY_UNQUALIF IED, _newCallback(MatchKind.FIELD_WRITE, scope, listener));
794 // }
795 // _index.getRelationships(field, IndexConstants.IS_REFERENCED_BY, _newCallba ck(MatchKind.FIELD_REFERENCE, scope, listener));
796 // _index.getRelationships(field, IndexConstants.IS_REFERENCED_BY_QUALIFIED, _newCallback(MatchKind.FIELD_REFERENCE, scope, listener));
797 // }
798 //
799 // void _searchReferences13(TypeParameterElement typeParameter, SearchScope sco pe, SearchFilter filter, SearchListener listener) {
800 // assert(listener != null);
801 // listener = _applyFilter(filter, listener);
802 // _index.getRelationships(typeParameter, IndexConstants.IS_REFERENCED_BY, _n ewCallback(MatchKind.TYPE_PARAMETER_REFERENCE, scope, listener));
803 // }
804 //
805 // void _searchReferences14(VariableElement variable, SearchScope scope, Search Filter filter, SearchListener listener) {
806 // assert(listener != null);
807 // listener = _applyFilter(filter, listener);
808 // listener = new CountingSearchListener(4, listener);
809 // _index.getRelationships(variable, IndexConstants.IS_READ_BY, _newCallback( MatchKind.VARIABLE_READ, scope, listener));
810 // _index.getRelationships(variable, IndexConstants.IS_READ_WRITTEN_BY, _newC allback(MatchKind.VARIABLE_READ_WRITE, scope, listener));
811 // _index.getRelationships(variable, IndexConstants.IS_WRITTEN_BY, _newCallba ck(MatchKind.VARIABLE_WRITE, scope, listener));
812 // _index.getRelationships(variable, IndexConstants.IS_INVOKED_BY, _newCallba ck(MatchKind.FUNCTION_EXECUTION, scope, listener));
813 // }
814 //}
815 //
816 ///**
817 // * Instances of the class <code>RelationshipCallbackImpl</code> implement a ca llback that can be
818 // * used to report results to a search listener.
819 // */
820 //class SearchEngineImpl_RelationshipCallbackImpl implements RelationshipCallbac k {
821 // final SearchScope _scope;
822 //
823 // /**
824 // * The kind of matches that are represented by the results that will be prov ided to this
825 // * callback.
826 // */
827 // final MatchKind _matchKind;
828 //
829 // /**
830 // * The search listener that should be notified when results are found.
831 // */
832 // final SearchListener _listener;
833 //
834 // /**
835 // * Initialize a newly created callback to report matches of the given kind t o the given listener
836 // * when results are found.
837 // *
838 // * @param scope the [SearchScope] to return matches from, may be `null` to r eturn
839 // * all matches
840 // * @param matchKind the kind of matches that are represented by the results
841 // * @param listener the search listener that should be notified when results are found
842 // */
843 // SearchEngineImpl_RelationshipCallbackImpl(this._scope, this._matchKind, this ._listener);
844 //
845 // @override
846 // void hasRelationships(Element element, Relationship relationship, List<Locat ion> locations) {
847 // for (Location location in locations) {
848 // Element targetElement = location.element;
849 // // check scope
850 // if (_scope != null && !_scope.encloses(targetElement)) {
851 // continue;
852 // }
853 // SourceRange range = new SourceRange(location.offset, location.length);
854 // // TODO(scheglov) IndexConstants.DYNAMIC for MatchQuality.NAME
855 // MatchQuality quality = MatchQuality.EXACT;
856 // // MatchQuality quality = element.getResource() != IndexConstan ts.DYNAMIC
857 // // ? MatchQuality.EXACT : MatchQuality.NAME;
858 // SearchMatch match = new SearchMatch(quality, _matchKind, targetElement, range);
859 // match.qualified = identical(relationship, IndexConstants.IS_REFERENCED_B Y_QUALIFIED) || identical(relationship, IndexConstants.IS_INVOKED_BY_QUALIFIED);
860 // _listener.matchFound(match);
861 // }
862 // _listener.searchComplete();
863 // }
864 //}
865 //
866 ///**
867 // * The interface <code>SearchRunner</code> defines the behavior of objects tha t can be used to
868 // * perform an asynchronous search.
869 // */
870 //abstract class SearchEngineImpl_SearchRunner {
871 // /**
872 // * Perform an asynchronous search, passing the results to the given listener .
873 // *
874 // * @param listener the listener to which search results should be passed @ i f the results could
875 // * not be computed
876 // */
877 // void performSearch(SearchListener listener);
878 //}
879 //
880 ///**
881 // * The interface <code>SearchListener</code> defines the behavior of objects t hat are listening for
882 // * the results of a search.
883 // */
884 //abstract class SearchListener {
885 // /**
886 // * Record the fact that the given match was found.
887 // *
888 // * @param match the match that was found
889 // */
890 // void matchFound(SearchMatch match);
891 //
892 // /**
893 // * This method is invoked when the search is complete and no additional matc hes will be found.
894 // */
895 // void searchComplete();
896 //}
897
898 ///**
899 // * The class <code>SearchPatternFactory</code> defines utility methods that ca n be used to create
900 // * search patterns.
901 // */
902 //class SearchPatternFactory {
903 // /**
904 // * Create a pattern that will match any element that is matched by all of th e given patterns. If
905 // * no patterns are given, then the resulting pattern will not match any elem ents.
906 // *
907 // * @param patterns the patterns that must all be matched in order for the ne w pattern to be
908 // * matched
909 // * @return the pattern that was created
910 // */
911 // static SearchPattern createAndPattern(List<SearchPattern> patterns) {
912 // if (patterns.length == 1) {
913 // return patterns[0];
914 // }
915 // return new AndSearchPattern(patterns);
916 // }
917 //
918 // /**
919 // * Create a pattern that will match any element whose name matches a partial identifier where
920 // * camel case conventions are used to perform what is essentially multiple p refix matches.
921 // *
922 // * @param pattern the pattern that matching elements must match
923 // * @param samePartCount `true` if the pattern and the name being matched mus t have
924 // * exactly the same number of parts (i.e. the same number of upperc ase characters)
925 // * @return the pattern that was created
926 // */
927 // static SearchPattern createCamelCasePattern(String prefix, bool samePartCoun t) => new CamelCaseSearchPattern(prefix, samePartCount);
928 //
929 // /**
930 // * Create a pattern that will match any element whose name matches a specifi ed identifier exactly.
931 // *
932 // * @param identifier the identifier that matching elements must be equal to
933 // * @param caseSensitive `true` if a case sensitive match is to be performed
934 // * @return the pattern that was created
935 // */
936 // static SearchPattern createExactPattern(String identifier, bool caseSensitiv e) => new ExactSearchPattern(identifier, caseSensitive);
937 //
938 // /**
939 // * Create a pattern that will match any element that is matched by at least one of the given
940 // * patterns. If no patterns are given, then the resulting pattern will not m atch any elements.
941 // *
942 // * @param patterns the patterns used to determine whether the new pattern is matched
943 // * @return the pattern that was created
944 // */
945 // static SearchPattern createOrPattern(List<SearchPattern> patterns) {
946 // if (patterns.length == 1) {
947 // return patterns[0];
948 // }
949 // return new OrSearchPattern(patterns);
950 // }
951 //
952 // /**
953 // * Create a pattern that will match any element whose name starts with the g iven prefix.
954 // *
955 // * @param prefix the prefix of names that match the pattern
956 // * @param caseSensitive `true` if a case sensitive match is to be performed
957 // * @return the pattern that was created
958 // */
959 // static SearchPattern createPrefixPattern(String prefix, bool caseSensitive) => new PrefixSearchPattern(prefix, caseSensitive);
960 //
961 // /**
962 // * Create a pattern that will match any element whose name matches a regular expression.
963 // *
964 // * @param regularExpression the regular expression that matching elements mu st match
965 // * @param caseSensitive `true` if a case sensitive match is to be performed
966 // * @return the pattern that was created
967 // */
968 // static SearchPattern createRegularExpressionPattern(String regularExpression , bool caseSensitive) => new RegularExpressionSearchPattern(regularExpression, c aseSensitive);
969 //
970 // /**
971 // * Create a pattern that will match any element whose name matches a pattern containing wildcard
972 // * characters. The wildcard characters that are currently supported are '?' (to match any single
973 // * character) and '*' (to match zero or more characters).
974 // *
975 // * @param pattern the pattern that matching elements must match
976 // * @param caseSensitive `true` if a case sensitive match is to be performed
977 // * @return the pattern that was created
978 // */
979 // static SearchPattern createWildcardPattern(String pattern, bool caseSensitiv e) => new WildcardSearchPattern(pattern, caseSensitive);
980 //}
981 //
982 //class SearchRunner_SearchEngineImpl_searchDeclarations implements SearchEngine Impl_SearchRunner {
983 // final SearchEngineImpl SearchEngineImpl_this;
984 //
985 // String name;
986 //
987 // SearchScope scope;
988 //
989 // SearchFilter filter;
990 //
991 // SearchRunner_SearchEngineImpl_searchDeclarations(this.SearchEngineImpl_this, this.name, this.scope, this.filter);
992 //
993 // @override
994 // void performSearch(SearchListener listener) {
995 // SearchEngineImpl_this.searchDeclarations2(name, scope, filter, listener);
996 // }
997 //}
998 //
999 //class SearchRunner_SearchEngineImpl_searchFunctionDeclarations implements Sear chEngineImpl_SearchRunner {
1000 // final SearchEngineImpl SearchEngineImpl_this;
1001 //
1002 // SearchScope scope;
1003 //
1004 // SearchPattern pattern;
1005 //
1006 // SearchFilter filter;
1007 //
1008 // SearchRunner_SearchEngineImpl_searchFunctionDeclarations(this.SearchEngineIm pl_this, this.scope, this.pattern, this.filter);
1009 //
1010 // @override
1011 // void performSearch(SearchListener listener) {
1012 // SearchEngineImpl_this.searchFunctionDeclarations2(scope, pattern, filter, listener);
1013 // }
1014 //}
1015 //
1016 //class SearchRunner_SearchEngineImpl_searchQualifiedMemberReferences implements SearchEngineImpl_SearchRunner {
1017 // final SearchEngineImpl SearchEngineImpl_this;
1018 //
1019 // String name;
1020 //
1021 // SearchScope scope;
1022 //
1023 // SearchFilter filter;
1024 //
1025 // SearchRunner_SearchEngineImpl_searchQualifiedMemberReferences(this.SearchEng ineImpl_this, this.name, this.scope, this.filter);
1026 //
1027 // @override
1028 // void performSearch(SearchListener listener) {
1029 // SearchEngineImpl_this.searchQualifiedMemberReferences2(name, scope, filter , listener);
1030 // }
1031 //}
1032 //
1033 //class SearchRunner_SearchEngineImpl_searchReferences implements SearchEngineIm pl_SearchRunner {
1034 // final SearchEngineImpl SearchEngineImpl_this;
1035 //
1036 // Element element;
1037 //
1038 // SearchScope scope;
1039 //
1040 // SearchFilter filter;
1041 //
1042 // SearchRunner_SearchEngineImpl_searchReferences(this.SearchEngineImpl_this, t his.element, this.scope, this.filter);
1043 //
1044 // @override
1045 // void performSearch(SearchListener listener) {
1046 // SearchEngineImpl_this.searchReferences2(element, scope, filter, listener);
1047 // }
1048 //}
1049 //
1050 //class SearchRunner_SearchEngineImpl_searchSubtypes implements SearchEngineImpl _SearchRunner {
1051 // final SearchEngineImpl SearchEngineImpl_this;
1052 //
1053 // ClassElement type;
1054 //
1055 // SearchScope scope;
1056 //
1057 // SearchFilter filter;
1058 //
1059 // SearchRunner_SearchEngineImpl_searchSubtypes(this.SearchEngineImpl_this, thi s.type, this.scope, this.filter);
1060 //
1061 // @override
1062 // void performSearch(SearchListener listener) {
1063 // SearchEngineImpl_this.searchSubtypes2(type, scope, filter, listener);
1064 // }
1065 //}
1066 //
1067 //class SearchRunner_SearchEngineImpl_searchTypeDeclarations implements SearchEn gineImpl_SearchRunner {
1068 // final SearchEngineImpl SearchEngineImpl_this;
1069 //
1070 // SearchScope scope;
1071 //
1072 // SearchPattern pattern;
1073 //
1074 // SearchFilter filter;
1075 //
1076 // SearchRunner_SearchEngineImpl_searchTypeDeclarations(this.SearchEngineImpl_t his, this.scope, this.pattern, this.filter);
1077 //
1078 // @override
1079 // void performSearch(SearchListener listener) {
1080 // SearchEngineImpl_this.searchTypeDeclarations2(scope, pattern, filter, list ener);
1081 // }
1082 //}
1083 //
1084 //class SearchRunner_SearchEngineImpl_searchVariableDeclarations implements Sear chEngineImpl_SearchRunner {
1085 // final SearchEngineImpl SearchEngineImpl_this;
1086 //
1087 // SearchScope scope;
1088 //
1089 // SearchPattern pattern;
1090 //
1091 // SearchFilter filter;
1092 //
1093 // SearchRunner_SearchEngineImpl_searchVariableDeclarations(this.SearchEngineIm pl_this, this.scope, this.pattern, this.filter);
1094 //
1095 // @override
1096 // void performSearch(SearchListener listener) {
1097 // SearchEngineImpl_this.searchVariableDeclarations2(scope, pattern, filter, listener);
1098 // }
1099 //}
1100 //
1101 ///**
1102 // * The class <code>SearchScopeFactory</code> defines utility methods that can be used to create
1103 // * search scopes.
1104 // */
1105 //class SearchScopeFactory {
1106 // /**
1107 // * A search scope that encompasses everything in the "universe". Because it does not hold any
1108 // * state there is no reason not to share a single instance.
1109 // */
1110 // static SearchScope _UNIVERSE_SCOPE = new UniverseSearchScope();
1111 //
1112 // /**
1113 // * Create a search scope that encompasses everything in the given library.
1114 // *
1115 // * @param library the library defining which elements are included in the sc ope
1116 // * @return the search scope that was created
1117 // */
1118 // static SearchScope createLibraryScope(Iterable<LibraryElement> libraries) => new LibrarySearchScope.con1(libraries);
1119 //
1120 // /**
1121 // * Create a search scope that encompasses everything in the given libraries.
1122 // *
1123 // * @param libraries the libraries defining which elements are included in th e scope
1124 // * @return the search scope that was created
1125 // */
1126 // static SearchScope createLibraryScope2(List<LibraryElement> libraries) => ne w LibrarySearchScope.con2(libraries);
1127 //
1128 // /**
1129 // * Create a search scope that encompasses everything in the given library.
1130 // *
1131 // * @param library the library defining which elements are included in the sc ope
1132 // * @return the search scope that was created
1133 // */
1134 // static SearchScope createLibraryScope3(LibraryElement library) => new Librar ySearchScope.con2([library]);
1135 //
1136 // /**
1137 // * Create a search scope that encompasses everything in the universe.
1138 // *
1139 // * @return the search scope that was created
1140 // */
1141 // static SearchScope createUniverseScope() => _UNIVERSE_SCOPE;
1142 //}
1143 //
1144 ///**
1145 // * The [SearchScope] that encompasses everything in the universe.
1146 // */
1147 //class UniverseSearchScope implements SearchScope {
1148 // @override
1149 // bool encloses(Element element) => true;
1150 //}
1151 //
1152 ///**
1153 // * Instances of the class <code>WildcardSearchPattern</code> implement a searc h pattern that matches
1154 // * elements whose name matches a pattern with wildcard characters. The wildcar d characters that are
1155 // * currently supported are '?' (to match any single character) and '*' (to mat ch zero or more
1156 // * characters).
1157 // */
1158 //class WildcardSearchPattern implements SearchPattern {
1159 // /**
1160 // * The pattern that matching elements must match.
1161 // */
1162 // List<int> _pattern;
1163 //
1164 // /**
1165 // * A flag indicating whether a case sensitive match is to be performed.
1166 // */
1167 // final bool _caseSensitive;
1168 //
1169 // /**
1170 // * Initialize a newly created search pattern to match elements whose names b egin with the given
1171 // * prefix.
1172 // *
1173 // * @param pattern the pattern that matching elements must match
1174 // * @param caseSensitive `true` if a case sensitive match is to be performed
1175 // */
1176 // WildcardSearchPattern(String pattern, this._caseSensitive) {
1177 // this._pattern = _caseSensitive ? pattern.toCharArray() : pattern.toLowerCa se().toCharArray();
1178 // }
1179 //
1180 // @override
1181 // MatchQuality matches(Element element) {
1182 // if (element == null) {
1183 // return null;
1184 // }
1185 // String name = element.displayName;
1186 // if (name == null) {
1187 // return null;
1188 // }
1189 // if (CharOperation.match(_pattern, name.toCharArray(), _caseSensitive)) {
1190 // return MatchQuality.EXACT;
1191 // }
1192 // return null;
1193 // }
1194 //}
1195 //
1196 ///**
1197 // * Instances of the class <code>ScopedSearchListener</code> implement a search listener that
1198 // * delegates to another search listener after removing matches that are outsid e a given scope.
1199 // */
1200 //abstract class WrappedSearchListener implements SearchListener {
1201 // /**
1202 // * The listener being wrapped.
1203 // */
1204 // SearchListener _baseListener;
1205 //
1206 // /**
1207 // * Initialize a newly created search listener to wrap the given listener.
1208 // *
1209 // * @param listener the search listener being wrapped
1210 // */
1211 // WrappedSearchListener(SearchListener listener) {
1212 // _baseListener = listener;
1213 // }
1214 //
1215 // @override
1216 // void searchComplete() {
1217 // _baseListener.searchComplete();
1218 // }
1219 //
1220 // /**
1221 // * Pass the given match on to the wrapped listener.
1222 // *
1223 // * @param match the match to be propagated
1224 // */
1225 // void propagateMatch(SearchMatch match) {
1226 // _baseListener.matchFound(match);
1227 // }
1228 //}
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/index/store/split_store.dart ('k') | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698