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

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

Issue 1319753002: exclude instance suggestions in static context - fixes #22932 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 4 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/optype.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/optype.dart b/pkg/analysis_server/lib/src/services/completion/optype.dart
index 76967312eff1e86e8bccc0fd54800643b12b15a6..02c89bf043635ef18596a3357f5a4c7402724211 100644
--- a/pkg/analysis_server/lib/src/services/completion/optype.dart
+++ b/pkg/analysis_server/lib/src/services/completion/optype.dart
@@ -14,7 +14,6 @@ import 'package:analyzer/src/generated/scanner.dart';
* suggestions were requested.
*/
class OpType {
-
/**
* Indicates whether constructor suggestions should be included.
*/
@@ -48,6 +47,11 @@ class OpType {
bool includeCaseLabelSuggestions = false;
/**
+ * Indicates whether the completion location is in the body of a static method.
+ */
+ bool inStaticMethodBody = false;
+
+ /**
* Indicates whether the completion target is prefixed.
*/
bool isPrefixed = false;
@@ -60,6 +64,10 @@ class OpType {
OpType optype = new OpType._();
target.containingNode
.accept(new _OpTypeAstVisitor(optype, target.entity, offset));
+ var mthDecl =
+ target.containingNode.getAncestor((p) => p is MethodDeclaration);
+ optype.inStaticMethodBody =
+ mthDecl is MethodDeclaration && mthDecl.isStatic;
return optype;
}
@@ -74,7 +82,6 @@ class OpType {
}
class _OpTypeAstVisitor extends GeneralizingAstVisitor {
-
/**
* The entity (AstNode or Token) which will be replaced or displaced by the
* added text.

Powered by Google App Engine
This is Rietveld 408576698