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

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart

Issue 1898983004: Code completion API refactoring: replace resolveExpression(Expression) with resolveContainingExpres… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comments from danrubel Created 4 years, 8 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/services/completion/dart/completion_manager.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index 5eb41fec8f0729bdaa1ecfb9742ce4ce0b472a8d..6ab671d20899702db4f9336c143cc1adaba0fd1c 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -225,11 +225,24 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
}
@override
- Future resolveExpression(Expression expression) async {
+ Future resolveContainingExpression(AstNode node) async {
+ // TODO When an Expression can be resolved instead of just an entire unit,
+ // this will be revisited with code searching up the parent until an
+ // Expression is found.
+
+ return resolveContainingStatement(node);
+ }
+
+ @override
+ Future resolveContainingStatement(AstNode node) async {
+ // TODO When a Statement can be resolved instead of just an entire unit,
+ // this will be revisited with code searching up the parent until a
+ // Statement is found.
+
checkAborted();
// Return immediately if the expression has already been resolved
- if (expression.propagatedType != null) {
+ if (node is Expression && node.propagatedType != null) {
return;
}
@@ -240,7 +253,7 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
// Resolve declarations in the target unit
// TODO(danrubel) resolve the expression or containing method
- // rather than the entire complilation unit
+ // rather than the entire compilation unit
CompilationUnit resolvedUnit = await _computeAsync(
this,
new LibrarySpecificUnit(librarySource, source),
@@ -399,7 +412,7 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
if (node is Expression) {
const FUNCTIONAL_ARG_TAG = 'resolve expression for isFunctionalArg';
performance.logStartTime(FUNCTIONAL_ARG_TAG);
- await dartRequest.resolveExpression(node);
+ await dartRequest.resolveContainingExpression(node);
performance.logElapseTime(FUNCTIONAL_ARG_TAG);
dartRequest.checkAborted();
}

Powered by Google App Engine
This is Rietveld 408576698