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

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

Issue 806473007: Add support for completion of case labels. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/local_declaration_visitor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/local_declaration_visitor.dart b/pkg/analysis_server/lib/src/services/completion/local_declaration_visitor.dart
index f26b3669412a958e531fe7f64b5d25557c0fd20a..e7860abf98e31c9b68c433cf323cc958f683be49 100644
--- a/pkg/analysis_server/lib/src/services/completion/local_declaration_visitor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/local_declaration_visitor.dart
@@ -34,7 +34,7 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor<bool> {
void declaredFunctionTypeAlias(FunctionTypeAlias declaration);
- void declaredLabel(Label label);
+ void declaredLabel(Label label, bool isCaseLabel);
void declaredLocalVar(SimpleIdentifier name, TypeName type);
@@ -181,8 +181,20 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor<bool> {
}
@override
+ bool visitSwitchStatement(SwitchStatement node) {
+ for (SwitchMember member in node.members) {
+ for (Label label in member.labels) {
+ declaredLabel(label, true);
+ }
+ }
+ return visitNode(node);
+ }
+
+ @override
bool visitLabeledStatement(LabeledStatement node) {
- node.labels.forEach(declaredLabel);
+ for (Label label in node.labels) {
+ declaredLabel(label, false);
+ }
return visitNode(node);
}

Powered by Google App Engine
This is Rietveld 408576698