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

Side by Side Diff: pkg/analysis_server/lib/src/search/member_declarations.dart

Issue 397883004: Implementation of the 'search.findMemberDeclarations' API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/search/search_domain.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/search/search_domain.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698