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

Unified Diff: pkg/analysis_server/lib/src/search/top_level_declarations.dart

Issue 399483002: Implementation for 'search.findTopLevelDeclarations' 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/search/top_level_declarations.dart
diff --git a/pkg/analysis_server/lib/src/search/top_level_declarations.dart b/pkg/analysis_server/lib/src/search/top_level_declarations.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b2eee2b0903a201b4705f9f140683d5906fe2cfc
--- /dev/null
+++ b/pkg/analysis_server/lib/src/search/top_level_declarations.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library search.top_level_declarations;
+
+import 'dart:async';
+
+import 'package:analysis_server/src/search/search_result.dart';
+import 'package:analysis_services/search/search_engine.dart';
+
+
+/**
+ * A computer for `search.findTopLevelDeclarations` request results.
+ */
+class TopLevelDeclarationsComputer {
+ final SearchEngine searchEngine;
+
+ TopLevelDeclarationsComputer(this.searchEngine);
+
+ /**
+ * Computes [SearchResult]s for top-level [element] declarations.
+ */
+ Future<List<SearchResult>> compute(String pattern) {
+ var matchesFuture = searchEngine.searchTopLevelDeclarations(pattern);
+ return matchesFuture.then((List<SearchMatch> matches) {
+ return matches.map(toResult).toList();
+ });
+ }
+
+ static SearchResult toResult(SearchMatch match) {
+ return new SearchResult.fromMatch(match);
+ }
+}
« no previous file with comments | « pkg/analysis_server/lib/src/search/search_domain.dart ('k') | pkg/analysis_server/test/search/abstract_search_domain.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698