| 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 search.top_level_declarations; | 5 library search.member_declarations; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/search/search_result.dart'; | 9 import 'package:analysis_server/src/search/search_result.dart'; |
| 10 import 'package:analysis_services/search/search_engine.dart'; | 10 import 'package:analysis_services/search/search_engine.dart'; |
| 11 | 11 |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * A computer for `search.findTopLevelDeclarations` request results. | 14 * A computer for `search.findMemberDeclarations` request results. |
| 15 */ | 15 */ |
| 16 class TopLevelDeclarationsComputer { | 16 class MemberDeclarationsComputer { |
| 17 final SearchEngine searchEngine; | 17 final SearchEngine searchEngine; |
| 18 | 18 |
| 19 TopLevelDeclarationsComputer(this.searchEngine); | 19 MemberDeclarationsComputer(this.searchEngine); |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * Computes [SearchResult]s for top-level [element] declarations. | 22 * Computes [SearchResult]s for declarations of members whose name is equal to
[name]. |
| 23 */ | 23 */ |
| 24 Future<List<SearchResult>> compute(String pattern) { | 24 Future<List<SearchResult>> compute(String name) { |
| 25 var matchesFuture = searchEngine.searchTopLevelDeclarations(pattern); | 25 var matchesFuture = searchEngine.searchMemberDeclarations(name); |
| 26 return matchesFuture.then((List<SearchMatch> matches) { | 26 return matchesFuture.then((List<SearchMatch> matches) { |
| 27 return matches.map(toResult).toList(); | 27 return matches.map(toResult).toList(); |
| 28 }); | 28 }); |
| 29 } | 29 } |
| 30 | 30 |
| 31 static SearchResult toResult(SearchMatch match) { | 31 static SearchResult toResult(SearchMatch match) { |
| 32 return new SearchResult.fromMatch(match); | 32 return new SearchResult.fromMatch(match); |
| 33 } | 33 } |
| 34 } | 34 } |
| OLD | NEW |