| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
| 3 * | 3 * |
| 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
| 5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
| 6 * | 6 * |
| 7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
| 8 * | 8 * |
| 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
| 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 import com.google.dart.engine.ast.ArgumentList; | 22 import com.google.dart.engine.ast.ArgumentList; |
| 23 import com.google.dart.engine.ast.Block; | 23 import com.google.dart.engine.ast.Block; |
| 24 import com.google.dart.engine.ast.BlockFunctionBody; | 24 import com.google.dart.engine.ast.BlockFunctionBody; |
| 25 import com.google.dart.engine.ast.ClassDeclaration; | 25 import com.google.dart.engine.ast.ClassDeclaration; |
| 26 import com.google.dart.engine.ast.ClassMember; | 26 import com.google.dart.engine.ast.ClassMember; |
| 27 import com.google.dart.engine.ast.CompilationUnit; | 27 import com.google.dart.engine.ast.CompilationUnit; |
| 28 import com.google.dart.engine.ast.CompilationUnitMember; | 28 import com.google.dart.engine.ast.CompilationUnitMember; |
| 29 import com.google.dart.engine.ast.ConstructorDeclaration; | 29 import com.google.dart.engine.ast.ConstructorDeclaration; |
| 30 import com.google.dart.engine.ast.Expression; | 30 import com.google.dart.engine.ast.Expression; |
| 31 import com.google.dart.engine.ast.FieldDeclaration; | 31 import com.google.dart.engine.ast.FieldDeclaration; |
| 32 import com.google.dart.engine.ast.ForEachStatement; |
| 32 import com.google.dart.engine.ast.FormalParameter; | 33 import com.google.dart.engine.ast.FormalParameter; |
| 33 import com.google.dart.engine.ast.FormalParameterList; | 34 import com.google.dart.engine.ast.FormalParameterList; |
| 34 import com.google.dart.engine.ast.Identifier; | 35 import com.google.dart.engine.ast.Identifier; |
| 35 import com.google.dart.engine.ast.InstanceCreationExpression; | 36 import com.google.dart.engine.ast.InstanceCreationExpression; |
| 36 import com.google.dart.engine.ast.ListLiteral; | 37 import com.google.dart.engine.ast.ListLiteral; |
| 37 import com.google.dart.engine.ast.MethodDeclaration; | 38 import com.google.dart.engine.ast.MethodDeclaration; |
| 38 import com.google.dart.engine.ast.MethodInvocation; | 39 import com.google.dart.engine.ast.MethodInvocation; |
| 39 import com.google.dart.engine.ast.NodeList; | 40 import com.google.dart.engine.ast.NodeList; |
| 40 import com.google.dart.engine.ast.SimpleIdentifier; | 41 import com.google.dart.engine.ast.SimpleIdentifier; |
| 41 import com.google.dart.engine.ast.SuperConstructorInvocation; | 42 import com.google.dart.engine.ast.SuperConstructorInvocation; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 public Void visitClassDeclaration(ClassDeclaration node) { | 245 public Void visitClassDeclaration(ClassDeclaration node) { |
| 245 hierarchyNames = null; | 246 hierarchyNames = null; |
| 246 try { | 247 try { |
| 247 return super.visitClassDeclaration(node); | 248 return super.visitClassDeclaration(node); |
| 248 } finally { | 249 } finally { |
| 249 hierarchyNames = null; | 250 hierarchyNames = null; |
| 250 } | 251 } |
| 251 } | 252 } |
| 252 | 253 |
| 253 @Override | 254 @Override |
| 255 public Void visitForEachStatement(ForEachStatement node) { |
| 256 SimpleIdentifier nameNode = node.getLoopVariable().getIdentifier(); |
| 257 String variableName = nameNode.getName(); |
| 258 if (forbiddenNames.contains(variableName)) { |
| 259 ensureHierarchyNames(node); |
| 260 ensureMethodNames(node); |
| 261 String newName = generateUniqueVariableName(variableName); |
| 262 renameIdentifier(nameNode, newName); |
| 263 } |
| 264 return super.visitForEachStatement(node); |
| 265 } |
| 266 |
| 267 @Override |
| 254 public Void visitMethodDeclaration(MethodDeclaration node) { | 268 public Void visitMethodDeclaration(MethodDeclaration node) { |
| 255 methodNames = null; | 269 methodNames = null; |
| 256 try { | 270 try { |
| 257 return super.visitMethodDeclaration(node); | 271 return super.visitMethodDeclaration(node); |
| 258 } finally { | 272 } finally { |
| 259 methodNames = null; | 273 methodNames = null; |
| 260 } | 274 } |
| 261 } | 275 } |
| 262 | 276 |
| 263 @Override | 277 @Override |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 } | 1039 } |
| 1026 } | 1040 } |
| 1027 } | 1041 } |
| 1028 } | 1042 } |
| 1029 } | 1043 } |
| 1030 } | 1044 } |
| 1031 } | 1045 } |
| 1032 }); | 1046 }); |
| 1033 } | 1047 } |
| 1034 } | 1048 } |
| OLD | NEW |