| Index: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/SemanticProcessor.java
|
| diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/SemanticProcessor.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/SemanticProcessor.java
|
| index ff7d9fba7067232fc537aede95e2ead73c61a97c..390be7d55065ca746fb09d3964723dd5485d74e1 100644
|
| --- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/SemanticProcessor.java
|
| +++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/SemanticProcessor.java
|
| @@ -16,6 +16,8 @@ package com.google.dart.java2dart.processor;
|
|
|
| import com.google.common.base.Objects;
|
| import com.google.dart.engine.ast.ASTNode;
|
| +import com.google.dart.engine.ast.Block;
|
| +import com.google.dart.engine.ast.ClassDeclaration;
|
| import com.google.dart.engine.ast.CompilationUnit;
|
| import com.google.dart.engine.ast.MethodInvocation;
|
| import com.google.dart.java2dart.Context;
|
| @@ -41,6 +43,19 @@ public abstract class SemanticProcessor {
|
| return (E) node;
|
| }
|
|
|
| + public static void removeNode(ASTNode node) {
|
| + ASTNode parent = node.getParent();
|
| + if (parent instanceof Block) {
|
| + ((Block) parent).getStatements().remove(node);
|
| + return;
|
| + }
|
| + if (parent instanceof ClassDeclaration) {
|
| + ((ClassDeclaration) parent).getMembers().remove(node);
|
| + return;
|
| + }
|
| + throw new IllegalArgumentException("Unsupported parent type: " + parent.getClass());
|
| + }
|
| +
|
| /**
|
| * Replaces "node" with "replacement" in parent of "node".
|
| */
|
|
|