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

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

Issue 812593008: Completion support for loop labels. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix problems with toplevel variables. Created 5 years, 11 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 21678a35e6a5d022e5b7310d9902bdbd949ad7fe..c4d0cfec7b2f4a133c7600e40dc67de0df02b314 100644
--- a/pkg/analysis_server/lib/src/services/completion/optype.dart
+++ b/pkg/analysis_server/lib/src/services/completion/optype.dart
@@ -37,6 +37,11 @@ class OpType {
bool includeReturnValueSuggestions = false;
/**
+ * Indicates whether statement labels should be suggested.
+ */
+ bool includeStatementLabelSuggestions = false;
+
+ /**
* Determine the suggestions that should be made based upon the given
* [CompletionTarget] and [offset].
*/
@@ -146,6 +151,13 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
}
@override
+ void visitBreakStatement(BreakStatement node) {
+ if (node.label == null || identical(entity, node.label)) {
+ optype.includeStatementLabelSuggestions = true;
+ }
+ }
+
+ @override
void visitCascadeExpression(CascadeExpression node) {
if (node.cascadeSections.contains(entity)) {
optype.includeInvocationSuggestions = true;
@@ -191,6 +203,13 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
}
@override
+ void visitContinueStatement(ContinueStatement node) {
+ if (node.label == null || identical(entity, node.label)) {
+ optype.includeStatementLabelSuggestions = true;
+ }
+ }
+
+ @override
void visitDoStatement(DoStatement node) {
if (identical(entity, node.condition)) {
optype.includeReturnValueSuggestions = true;

Powered by Google App Engine
This is Rietveld 408576698