Index: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java |
=================================================================== |
--- editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java (revision 23549) |
+++ editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java (working copy) |
@@ -29,6 +29,7 @@ |
import com.google.dart.engine.ast.ConstructorDeclaration; |
import com.google.dart.engine.ast.Expression; |
import com.google.dart.engine.ast.FieldDeclaration; |
+import com.google.dart.engine.ast.ForEachStatement; |
import com.google.dart.engine.ast.FormalParameter; |
import com.google.dart.engine.ast.FormalParameterList; |
import com.google.dart.engine.ast.Identifier; |
@@ -251,6 +252,19 @@ |
} |
@Override |
+ public Void visitForEachStatement(ForEachStatement node) { |
+ SimpleIdentifier nameNode = node.getLoopVariable().getIdentifier(); |
+ String variableName = nameNode.getName(); |
+ if (forbiddenNames.contains(variableName)) { |
+ ensureHierarchyNames(node); |
+ ensureMethodNames(node); |
+ String newName = generateUniqueVariableName(variableName); |
+ renameIdentifier(nameNode, newName); |
+ } |
+ return super.visitForEachStatement(node); |
+ } |
+ |
+ @Override |
public Void visitMethodDeclaration(MethodDeclaration node) { |
methodNames = null; |
try { |