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.search_engine; | 5 library services.search_engine; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/services/index/index.dart'; | |
10 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; | |
11 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
12 import 'package:analyzer/dart/element/visitor.dart'; | 10 import 'package:analyzer/dart/element/visitor.dart'; |
13 import 'package:analyzer/src/dart/element/element.dart'; | 11 import 'package:analyzer/src/dart/element/element.dart'; |
14 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | 12 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; |
15 import 'package:analyzer/src/generated/java_core.dart'; | 13 import 'package:analyzer/src/generated/java_core.dart'; |
16 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
17 | 15 |
18 /** | 16 /** |
19 * Returns a new [SearchEngine] instance based on the given [Index]. | |
20 */ | |
21 SearchEngine createSearchEngine(Index index) { | |
22 return new SearchEngineImpl(index); | |
23 } | |
24 | |
25 /** | |
26 * Instances of the enum [MatchKind] represent the kind of reference that was | 17 * Instances of the enum [MatchKind] represent the kind of reference that was |
27 * found when a match represents a reference to an element. | 18 * found when a match represents a reference to an element. |
28 */ | 19 */ |
29 class MatchKind { | 20 class MatchKind { |
30 /** | 21 /** |
31 * A declaration of an element. | 22 * A declaration of an element. |
32 */ | 23 */ |
33 static const MatchKind DECLARATION = const MatchKind('DECLARATION'); | 24 static const MatchKind DECLARATION = const MatchKind('DECLARATION'); |
34 | 25 |
35 /** | 26 /** |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 if (element is ElementImpl) { | 251 if (element is ElementImpl) { |
261 if (element.codeOffset != null && | 252 if (element.codeOffset != null && |
262 element.codeOffset <= offset && | 253 element.codeOffset <= offset && |
263 offset <= element.codeOffset + element.codeLength) { | 254 offset <= element.codeOffset + element.codeLength) { |
264 containingElement = element; | 255 containingElement = element; |
265 super.visitElement(element); | 256 super.visitElement(element); |
266 } | 257 } |
267 } | 258 } |
268 } | 259 } |
269 } | 260 } |
OLD | NEW |