OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analysis_server.src.services.search.search_engine_internal; | 5 library analysis_server.src.services.search.search_engine_internal; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/services/correction/source_range.dart'; | 9 import 'package:analysis_server/src/services/correction/source_range.dart'; |
10 import 'package:analysis_server/src/services/index/index.dart'; | 10 import 'package:analysis_server/src/services/index/index.dart'; |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 @override | 29 @override |
30 Future<List<SearchMatch>> searchAllSubtypes(ClassElement type) async { | 30 Future<List<SearchMatch>> searchAllSubtypes(ClassElement type) async { |
31 List<SearchMatch> matches = <SearchMatch>[]; | 31 List<SearchMatch> matches = <SearchMatch>[]; |
32 await _addMatches( | 32 await _addMatches( |
33 matches, type, IndexRelationKind.IS_ANCESTOR_OF, MatchKind.DECLARATION); | 33 matches, type, IndexRelationKind.IS_ANCESTOR_OF, MatchKind.DECLARATION); |
34 return matches; | 34 return matches; |
35 } | 35 } |
36 | 36 |
37 @override | 37 @override |
38 Future<List<SearchMatch>> searchMemberDeclarations(String pattern) { | 38 Future<List<SearchMatch>> searchMemberDeclarations(String name) { |
| 39 String pattern = '^$name\$'; |
39 return _searchDefinedNames(pattern, IndexNameKind.classMember); | 40 return _searchDefinedNames(pattern, IndexNameKind.classMember); |
40 } | 41 } |
41 | 42 |
42 @override | 43 @override |
43 Future<List<SearchMatch>> searchMemberReferences(String name) async { | 44 Future<List<SearchMatch>> searchMemberReferences(String name) async { |
44 List<Location> locations = await _index.getUnresolvedMemberReferences(name); | 45 List<Location> locations = await _index.getUnresolvedMemberReferences(name); |
45 return locations.map((location) { | 46 return locations.map((location) { |
46 return _newMatchForLocation(location, null); | 47 return _newMatchForLocation(location, null); |
47 }).toList(); | 48 }).toList(); |
48 } | 49 } |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 _addMatch(node, kind); | 406 _addMatch(node, kind); |
406 } | 407 } |
407 } | 408 } |
408 | 409 |
409 void _addMatch(AstNode node, MatchKind kind) { | 410 void _addMatch(AstNode node, MatchKind kind) { |
410 bool isQualified = node is SimpleIdentifier && node.isQualified; | 411 bool isQualified = node is SimpleIdentifier && node.isQualified; |
411 matches.add(new SearchMatch(context, libraryUri, unitUri, kind, | 412 matches.add(new SearchMatch(context, libraryUri, unitUri, kind, |
412 rangeNode(node), true, isQualified)); | 413 rangeNode(node), true, isQualified)); |
413 } | 414 } |
414 } | 415 } |
OLD | NEW |