| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * A [SearchEngine] implementation. | 25 * A [SearchEngine] implementation. |
| 26 */ | 26 */ |
| 27 class SearchEngineImpl implements SearchEngine { | 27 class SearchEngineImpl implements SearchEngine { |
| 28 final Index _index; | 28 final Index _index; |
| 29 | 29 |
| 30 SearchEngineImpl(this._index); | 30 SearchEngineImpl(this._index); |
| 31 | 31 |
| 32 @override | 32 @override |
| 33 Future<List<SearchMatch>> searchAllSubtypes(ClassElement type) async { | 33 Future<Set<ClassElement>> searchAllSubtypes(ClassElement type) async { |
| 34 List<SearchMatch> matches = <SearchMatch>[]; | 34 List<SearchMatch> matches = <SearchMatch>[]; |
| 35 await _addMatches( | 35 await _addMatches( |
| 36 matches, type, IndexRelationKind.IS_ANCESTOR_OF, MatchKind.DECLARATION); | 36 matches, type, IndexRelationKind.IS_ANCESTOR_OF, MatchKind.DECLARATION); |
| 37 return matches; | 37 return matches.map((match) => match.element as ClassElement).toSet(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 @override | 40 @override |
| 41 Future<List<SearchMatch>> searchMemberDeclarations(String name) { | 41 Future<List<SearchMatch>> searchMemberDeclarations(String name) { |
| 42 String pattern = '^$name\$'; | 42 String pattern = '^$name\$'; |
| 43 return _searchDefinedNames(pattern, IndexNameKind.classMember); | 43 return _searchDefinedNames(pattern, IndexNameKind.classMember); |
| 44 } | 44 } |
| 45 | 45 |
| 46 @override | 46 @override |
| 47 Future<List<SearchMatch>> searchMemberReferences(String name) async { | 47 Future<List<SearchMatch>> searchMemberReferences(String name) async { |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 _addMatch(node, kind); | 575 _addMatch(node, kind); |
| 576 } | 576 } |
| 577 } | 577 } |
| 578 | 578 |
| 579 void _addMatch(AstNode node, MatchKind kind) { | 579 void _addMatch(AstNode node, MatchKind kind) { |
| 580 bool isQualified = node.parent is Label; | 580 bool isQualified = node.parent is Label; |
| 581 matches.add(new SearchMatchImpl(context, libraryUri, unitUri, kind, | 581 matches.add(new SearchMatchImpl(context, libraryUri, unitUri, kind, |
| 582 rangeNode(node), true, isQualified)); | 582 rangeNode(node), true, isQualified)); |
| 583 } | 583 } |
| 584 } | 584 } |
| OLD | NEW |