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

Unified Diff: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java

Issue 16302002: analyzer_experimental snapshot (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
index d81910e647e3454ac5d0e0c150b9a0e194f082e5..e46a75aca74ccd5581cccf96fac96e181b78e11e 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
@@ -29,6 +29,7 @@ import com.google.dart.engine.ast.CompilationUnitMember;
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 @@ public class Context {
}
@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 {

Powered by Google App Engine
This is Rietveld 408576698