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

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

Issue 2526473003: Make AnalysisSErver APIs to access unit/node/element asynchronous. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 83e66f4e469fb4acbcdfddab6d64d06be72d8738..047efd6e6719415db2497d6be6464015c61ffc7f 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -706,11 +706,12 @@ class AnalysisServer {
}
/**
- * Return the [Element] at the given [offset] of the given [file], or `null`
- * if there is no node at the [offset] or the node does not have an element.
+ * Return the [Future] that completes with the [Element] at the given
Paul Berry 2016/11/22 18:06:18 s/Return the [Future]/Return a [Future]/ ("Return
scheglov 2016/11/22 18:45:47 Done.
+ * [offset] of the given [file], or with `null` if there is no node at the
+ * [offset] or the node does not have an element.
*/
- Element getElementAtOffset(String file, int offset) {
- AstNode node = getNodeAtOffset(file, offset);
+ Future<Element> getElementAtOffset(String file, int offset) async {
+ AstNode node = await getNodeAtOffset(file, offset);
return getElementOfNode(node);
}
@@ -765,11 +766,12 @@ class AnalysisServer {
}
/**
- * Return the resolved [AstNode]s at the given [offset] of the given [file],
- * or `null` if there is no node as the [offset].
+ * Return the [Future] that completes with the resolved [AstNode] at the
+ * given [offset] of the given [file], or with `null` if there is no node as
+ * the [offset].
*/
- AstNode getNodeAtOffset(String file, int offset) {
- CompilationUnit unit = getResolvedCompilationUnit(file);
+ Future<AstNode> getNodeAtOffset(String file, int offset) async {
+ CompilationUnit unit = await getResolvedCompilationUnit(file);
if (unit != null) {
return new NodeLocator(offset).searchWithin(unit);
}
@@ -777,10 +779,11 @@ class AnalysisServer {
}
/**
- * Return the resolved [CompilationUnit] for the Dart file with the given
- * [path], or `null` if the file is not a Dart file or cannot be resolved.
+ * Return the [Future] that completes with the resolved [CompilationUnit] for
+ * the Dart file with the given [path], or with `null` if the file is not a
+ * Dart file or cannot be resolved.
*/
- CompilationUnit getResolvedCompilationUnit(String path) {
+ Future<CompilationUnit> getResolvedCompilationUnit(String path) async {
ContextSourcePair contextSource = getContextSourcePair(path);
AnalysisContext context = contextSource.context;
if (context == null) {
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698