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

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.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/local_constructor_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart
index f51aa26cc097825d0cd052f221f4721e1bfb38a4..9344e15d44de11e2c426d49c20ecc484334fdb82 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart
@@ -166,20 +166,13 @@ class LocalConstructorContributor extends DartCompletionContributor {
if (!optype.isPrefixed) {
if (optype.includeConstructorSuggestions) {
AstNode node = request.target.containingNode;
- // TODO (jwren) not quite right, see the test
- // test_InstanceCreationExpression_variable_declaration_filter,
- // the node at this point is an InstanceCreationExpression, but we want
- // the containing variable declaration resolved,
- if (node is Expression) {
- while (node.parent is Expression) {
- node = node.parent;
- }
- await request.resolveExpression(node);
-
- // Discard any cached target information
- // because it may have changed as a result of the resolution
- node = request.target.containingNode;
- }
+
+ await request.resolveContainingStatement(node);
+
+ // Discard any cached target information
+ // because it may have changed as a result of the resolution
+ node = request.target.containingNode;
+
_Visitor visitor = new _Visitor(request, suggestions, optype);
visitor.visit(node);
}

Powered by Google App Engine
This is Rietveld 408576698