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

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

Issue 109853003: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. Created 7 years 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
« no previous file with comments | « no previous file | editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698