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

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

Issue 395623006: Add hierarchy utils and use them in search. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tweaks 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
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 services.search_engine;
9 9
10 import 'dart:async'; 10 import 'dart:async';
11 11
12 import 'package:analysis_services/index/index.dart'; 12 import 'package:analysis_services/index/index.dart';
13 import 'package:analysis_services/src/search/search_engine.dart'; 13 import 'package:analysis_services/src/search/search_engine.dart';
14 import 'package:analyzer/src/generated/element.dart'; 14 import 'package:analyzer/src/generated/element.dart';
15 import 'package:analyzer/src/generated/java_core.dart'; 15 import 'package:analyzer/src/generated/java_core.dart';
16 import 'package:analyzer/src/generated/source.dart'; 16 import 'package:analyzer/src/generated/source.dart';
17 17
18 18
19 /** 19 /**
20 * A [Comparator] that can be used to sort the [SearchMatch]s based on the names
21 * of the matched elements.
22 */
23 final Comparator<SearchMatch> SEARCH_MATCH_NAME_COMPARATOR =
24 (SearchMatch firstMatch, SearchMatch secondMatch) {
25 String firstName = firstMatch.element.displayName;
26 String secondName = secondMatch.element.displayName;
27 return firstName.compareTo(secondName);
28 };
29
30
31 /**
32 * Returns a new [SearchEngine] instance based on the given [Index]. 20 * Returns a new [SearchEngine] instance based on the given [Index].
33 */ 21 */
34 SearchEngine createSearchEngine(Index index) { 22 SearchEngine createSearchEngine(Index index) {
35 return new SearchEngineImpl(index); 23 return new SearchEngineImpl(index);
36 } 24 }
37 25
38 26
39 /** 27 /**
40 * Instances of the enum [MatchKind] represent the kind of reference that was 28 * Instances of the enum [MatchKind] represent the kind of reference that was
41 * found when a match represents a reference to an element. 29 * found when a match represents a reference to an element.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 /** 64 /**
77 * A reference to an element in which it is being invoked. 65 * A reference to an element in which it is being invoked.
78 */ 66 */
79 static const MatchKind INVOCATION = const MatchKind('INVOCATION'); 67 static const MatchKind INVOCATION = const MatchKind('INVOCATION');
80 68
81 /** 69 /**
82 * A reference to an element in which it is referenced. 70 * A reference to an element in which it is referenced.
83 */ 71 */
84 static const MatchKind REFERENCE = const MatchKind('REFERENCE'); 72 static const MatchKind REFERENCE = const MatchKind('REFERENCE');
85 73
86 // /**
87 // * A declaration of a name.
88 // */
89 // static const MatchKind NAME_DECLARATION = const MatchKind('NAME_DECLARATION' );
90 //
91 // /**
92 // * A reference to a name, resolved.
93 // */
94 // static const MatchKind NAME_REFERENCE_RESOLVED =
95 // const MatchKind('NAME_REFERENCE_RESOLVED');
96 //
97 // /**
98 // * An invocation of a name, resolved.
99 // */
100 // static const MatchKind NAME_INVOCATION_RESOLVED =
101 // const MatchKind('NAME_INVOCATION_RESOLVED');
102 //
103 // /**
104 // * A reference to a name in which the name's value is being read.
105 // */
106 // static const MatchKind NAME_READ_RESOLVED =
107 // const MatchKind('NAME_READ_RESOLVED');
108 //
109 // /**
110 // * A reference to a name in which the name's value is being read and written .
111 // */
112 // static const MatchKind NAME_READ_WRITE_RESOLVED =
113 // const MatchKind('NAME_READ_WRITE_RESOLVED');
114 //
115 // /**
116 // * A reference to a name in which the name's value is being written.
117 // */
118 // static const MatchKind NAME_WRITE_RESOLVED =
119 // const MatchKind('NAME_WRITE_RESOLVED');
120 //
121 // /**
122 // * An invocation of a name, unresolved.
123 // */
124 // static const MatchKind NAME_INVOCATION_UNRESOLVED =
125 // const MatchKind('NAME_INVOCATION_UNRESOLVED');
126 //
127 // /**
128 // * A reference to a name in which the name's value is being read.
129 // */
130 // static const MatchKind NAME_READ_UNRESOLVED =
131 // const MatchKind('NAME_READ_UNRESOLVED');
132 //
133 // /**
134 // * A reference to a name in which the name's value is being read and written .
135 // */
136 // static const MatchKind NAME_READ_WRITE_UNRESOLVED =
137 // const MatchKind('NAME_READ_WRITE_UNRESOLVED');
138 //
139 // /**
140 // * A reference to a name in which the name's value is being written.
141 // */
142 // static const MatchKind NAME_WRITE_UNRESOLVED =
143 // const MatchKind('NAME_WRITE_UNRESOLVED');
144 //
145 // /**
146 // * A reference to a name, unresolved.
147 // */
148 // static const MatchKind NAME_REFERENCE_UNRESOLVED =
149 // const MatchKind('NAME_REFERENCE_UNRESOLVED');
150
151 final String name; 74 final String name;
152 75
153 const MatchKind(this.name); 76 const MatchKind(this.name);
154 77
155 @override 78 @override
156 String toString() => name; 79 String toString() => name;
157 } 80 }
158 81
159 82
160 /** 83 /**
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 buffer.write(", range="); 184 buffer.write(", range=");
262 buffer.write(sourceRange); 185 buffer.write(sourceRange);
263 buffer.write(", isResolved="); 186 buffer.write(", isResolved=");
264 buffer.write(isResolved); 187 buffer.write(isResolved);
265 buffer.write(", isQualified="); 188 buffer.write(", isQualified=");
266 buffer.write(isQualified); 189 buffer.write(isQualified);
267 buffer.write(")"); 190 buffer.write(")");
268 return buffer.toString(); 191 return buffer.toString();
269 } 192 }
270 } 193 }
OLDNEW
« no previous file with comments | « pkg/analysis_services/lib/search/hierarchy.dart ('k') | pkg/analysis_services/test/search/hierarchy_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698