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

Unified Diff: pkg/analysis_server/lib/src/services/completion/local_declaration_visitor.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/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 ccdd8ba658fd7200732f5d069d8748d49aef498e..f26b3669412a958e531fe7f64b5d25557c0fd20a 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
@@ -49,11 +49,7 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor<bool> {
bool visitBlock(Block node) {
node.statements.forEach((Statement stmt) {
if (stmt.offset < offset) {
- if (stmt is LabeledStatement) {
- stmt.labels.forEach((Label label) {
- declaredLabel(label);
- });
- } else if (stmt is VariableDeclarationStatement) {
+ if (stmt is VariableDeclarationStatement) {
VariableDeclarationList varList = stmt.variables;
if (varList != null) {
varList.variables.forEach((VariableDeclaration varDecl) {
@@ -185,6 +181,12 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor<bool> {
}
@override
+ bool visitLabeledStatement(LabeledStatement node) {
+ node.labels.forEach(declaredLabel);
+ return visitNode(node);
+ }
+
+ @override
bool visitMethodDeclaration(MethodDeclaration node) {
_visitParamList(node.parameters);
return visitNode(node);

Powered by Google App Engine
This is Rietveld 408576698