| 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 dff7643707aad1d9216616ebd1365ffe7123328b..ca2736177f5b71345938facfc763888f2b5288b3 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
|
| @@ -44,6 +44,7 @@ import com.google.dart.engine.ast.VariableDeclaration;
|
| import com.google.dart.engine.ast.VariableDeclarationList;
|
| import com.google.dart.engine.ast.visitor.GeneralizingASTVisitor;
|
| import com.google.dart.engine.ast.visitor.RecursiveASTVisitor;
|
| +import com.google.dart.engine.ast.visitor.UnifyingASTVisitor;
|
| import com.google.dart.engine.scanner.Keyword;
|
| import com.google.dart.engine.scanner.KeywordToken;
|
| import com.google.dart.engine.scanner.TokenType;
|
| @@ -214,6 +215,21 @@ public class Context {
|
| return !notPropertySet.contains(signature);
|
| }
|
|
|
| + /**
|
| + * Clears information about the given {@link ASTNode} and its children.
|
| + */
|
| + public void clearNodes(ASTNode node) {
|
| + if (node != null) {
|
| + node.accept(new UnifyingASTVisitor<Void>() {
|
| + @Override
|
| + public Void visitNode(ASTNode node) {
|
| + clearNode(node);
|
| + return super.visitNode(node);
|
| + }
|
| + });
|
| + }
|
| + }
|
| +
|
| public void ensureUniqueClassMemberNames(CompilationUnit unit) {
|
| unit.accept(new RecursiveASTVisitor<Void>() {
|
| private final Set<ClassMember> untouchableMethods = Sets.newHashSet();
|
| @@ -492,6 +508,17 @@ public class Context {
|
| usedNames.add(identifier.getName());
|
| }
|
|
|
| + /**
|
| + * Removes recorded identifier reference.
|
| + */
|
| + public void removeReference(SimpleIdentifier identifier) {
|
| + IBinding binding = getNodeBinding(identifier);
|
| + List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding);
|
| + if (identifiers != null) {
|
| + identifiers.remove(identifier);
|
| + }
|
| + }
|
| +
|
| public void renameConstructor(ConstructorDeclaration node, String name) {
|
| IMethodBinding binding = constructorToBinding.get(node);
|
| //
|
| @@ -644,6 +671,17 @@ public class Context {
|
| privateClassMembers.add(member);
|
| }
|
|
|
| + /**
|
| + * Clears information about the given {@link ASTNode}.
|
| + */
|
| + private void clearNode(ASTNode node) {
|
| + if (node instanceof SimpleIdentifier) {
|
| + removeReference((SimpleIdentifier) node);
|
| + }
|
| + nodeToBinding.remove(node);
|
| + nodeToTypeBinding.remove(node);
|
| + }
|
| +
|
| private void dontUseThisInFieldInitializers(CompilationUnit unit) {
|
| unit.accept(new RecursiveASTVisitor<Void>() {
|
| @Override
|
|
|