From ca016fcb32c612f21c8ac8bde9ac6b9157cf593a Mon Sep 17 00:00:00 2001 From: develar Date: Thu, 25 Oct 2012 09:43:19 +0400 Subject: [PATCH] simplify AST (idea like) --- .../backend/js/ast/ChameleonJsExpression.java | 5 -- .../backend/js/ast/JsArrayAccess.java | 5 -- .../backend/js/ast/JsArrayLiteral.java | 5 -- .../backend/js/ast/JsBinaryOperation.java | 5 -- .../dart/compiler/backend/js/ast/JsBlock.java | 5 -- .../dart/compiler/backend/js/ast/JsBreak.java | 5 -- .../dart/compiler/backend/js/ast/JsCase.java | 5 -- .../dart/compiler/backend/js/ast/JsCatch.java | 5 -- .../backend/js/ast/JsConditional.java | 5 -- .../compiler/backend/js/ast/JsContinue.java | 5 -- .../compiler/backend/js/ast/JsDebugger.java | 18 ++--- .../compiler/backend/js/ast/JsDefault.java | 13 +--- .../compiler/backend/js/ast/JsDoWhile.java | 5 -- .../compiler/backend/js/ast/JsDocComment.java | 5 -- .../dart/compiler/backend/js/ast/JsEmpty.java | 5 -- .../backend/js/ast/JsExpressionStatement.java | 5 -- .../dart/compiler/backend/js/ast/JsFor.java | 5 -- .../dart/compiler/backend/js/ast/JsForIn.java | 5 -- .../compiler/backend/js/ast/JsFunction.java | 5 -- .../dart/compiler/backend/js/ast/JsIf.java | 5 -- .../compiler/backend/js/ast/JsInvocation.java | 5 -- .../dart/compiler/backend/js/ast/JsLabel.java | 9 +-- .../compiler/backend/js/ast/JsLiteral.java | 10 --- .../compiler/backend/js/ast/JsNameRef.java | 5 -- .../dart/compiler/backend/js/ast/JsNew.java | 5 -- .../dart/compiler/backend/js/ast/JsNode.java | 2 - .../backend/js/ast/JsNullLiteral.java | 5 -- .../backend/js/ast/JsNumberLiteral.java | 5 -- .../backend/js/ast/JsObjectLiteral.java | 5 -- .../compiler/backend/js/ast/JsParameter.java | 5 -- .../backend/js/ast/JsPostfixOperation.java | 5 -- .../backend/js/ast/JsPrefixOperation.java | 75 +++++++++---------- .../compiler/backend/js/ast/JsProgram.java | 5 -- .../backend/js/ast/JsProgramFragment.java | 5 -- .../backend/js/ast/JsPropertyInitializer.java | 5 -- .../compiler/backend/js/ast/JsRegExp.java | 5 -- .../compiler/backend/js/ast/JsReturn.java | 9 +-- .../backend/js/ast/JsStringLiteral.java | 5 -- .../compiler/backend/js/ast/JsSwitch.java | 5 -- .../dart/compiler/backend/js/ast/JsThrow.java | 5 -- .../dart/compiler/backend/js/ast/JsTry.java | 5 -- .../dart/compiler/backend/js/ast/JsVars.java | 10 --- .../dart/compiler/backend/js/ast/JsWhile.java | 7 +- .../compiler/backend/js/ast/NodeKind.java | 50 ------------- 44 files changed, 50 insertions(+), 323 deletions(-) delete mode 100644 src/com/google/dart/compiler/backend/js/ast/NodeKind.java diff --git a/src/com/google/dart/compiler/backend/js/ast/ChameleonJsExpression.java b/src/com/google/dart/compiler/backend/js/ast/ChameleonJsExpression.java index d926ef6ec46..e3c0a06c85a 100644 --- a/src/com/google/dart/compiler/backend/js/ast/ChameleonJsExpression.java +++ b/src/com/google/dart/compiler/backend/js/ast/ChameleonJsExpression.java @@ -39,11 +39,6 @@ public class ChameleonJsExpression implements JsExpression { return expression.makeStmt(); } - @Override - public NodeKind getKind() { - return expression.getKind(); - } - @Override public void accept(JsVisitor visitor, JsContext context) { expression.accept(visitor, context); diff --git a/src/com/google/dart/compiler/backend/js/ast/JsArrayAccess.java b/src/com/google/dart/compiler/backend/js/ast/JsArrayAccess.java index 617282de797..338ab95c08d 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsArrayAccess.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsArrayAccess.java @@ -61,9 +61,4 @@ public final class JsArrayAccess extends JsExpressionImpl { arrayExpression = visitor.accept(arrayExpression); indexExpression = visitor.accept(indexExpression); } - - @Override - public NodeKind getKind() { - return NodeKind.ARRAY_ACCESS; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsArrayLiteral.java b/src/com/google/dart/compiler/backend/js/ast/JsArrayLiteral.java index fc79e5be9b0..6358d3c34e7 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsArrayLiteral.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsArrayLiteral.java @@ -65,9 +65,4 @@ public final class JsArrayLiteral extends JsLiteral { public void acceptChildren(JsVisitor visitor, JsContext context) { visitor.acceptWithInsertRemove(expressions); } - - @Override - public NodeKind getKind() { - return NodeKind.ARRAY; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsBinaryOperation.java b/src/com/google/dart/compiler/backend/js/ast/JsBinaryOperation.java index 36a6084d738..1c82f99bc97 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsBinaryOperation.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsBinaryOperation.java @@ -83,9 +83,4 @@ public final class JsBinaryOperation extends JsExpressionImpl { } arg2 = visitor.accept(arg2); } - - @Override - public NodeKind getKind() { - return NodeKind.BINARY_OP; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsBlock.java b/src/com/google/dart/compiler/backend/js/ast/JsBlock.java index 2f41e6dee11..a6b133071f3 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsBlock.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsBlock.java @@ -52,9 +52,4 @@ public class JsBlock extends JsNodeImpl implements JsStatement { public void acceptChildren(JsVisitor visitor, JsContext context) { visitor.acceptWithInsertRemove(statements); } - - @Override - public NodeKind getKind() { - return NodeKind.BLOCK; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsBreak.java b/src/com/google/dart/compiler/backend/js/ast/JsBreak.java index 117e2e72964..4513a153a45 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsBreak.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsBreak.java @@ -16,11 +16,6 @@ public final class JsBreak extends JsContinue { super(label); } - @Override - public NodeKind getKind() { - return NodeKind.BREAK; - } - @Override public void accept(JsVisitor v, JsContext context) { v.visitBreak(this, context); diff --git a/src/com/google/dart/compiler/backend/js/ast/JsCase.java b/src/com/google/dart/compiler/backend/js/ast/JsCase.java index dabd7329d40..1ccc4c1349b 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsCase.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsCase.java @@ -32,9 +32,4 @@ public final class JsCase extends JsSwitchMember { caseExpression = visitor.accept(caseExpression); super.acceptChildren(visitor, context); } - - @Override - public NodeKind getKind() { - return NodeKind.CASE; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsCatch.java b/src/com/google/dart/compiler/backend/js/ast/JsCatch.java index a779f797da9..9fb2f5ae653 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsCatch.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsCatch.java @@ -60,9 +60,4 @@ public class JsCatch extends JsNodeImpl implements HasCondition { } body = visitor.accept(body); } - - @Override - public NodeKind getKind() { - return NodeKind.CATCH; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsConditional.java b/src/com/google/dart/compiler/backend/js/ast/JsConditional.java index 24e30ffa8b7..36c73480ce1 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsConditional.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsConditional.java @@ -71,9 +71,4 @@ public final class JsConditional extends JsExpressionImpl { thenExpr = visitor.accept(thenExpr); elseExpr = visitor.accept(elseExpr); } - - @Override - public NodeKind getKind() { - return NodeKind.CONDITIONAL; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsContinue.java b/src/com/google/dart/compiler/backend/js/ast/JsContinue.java index 00706fd77fb..3aa329aa51c 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsContinue.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsContinue.java @@ -31,9 +31,4 @@ public class JsContinue extends JsNodeImpl implements JsStatement { public void acceptChildren(JsVisitor visitor, JsContext context) { } - - @Override - public NodeKind getKind() { - return NodeKind.CONTINUE; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsDebugger.java b/src/com/google/dart/compiler/backend/js/ast/JsDebugger.java index 0a3a45b8733..973bc5210dc 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsDebugger.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsDebugger.java @@ -8,22 +8,16 @@ package com.google.dart.compiler.backend.js.ast; * Represents a JavaScript debugger statement. */ public class JsDebugger extends JsNodeImpl implements JsStatement { + public JsDebugger() { + } - public JsDebugger() { - } - - @Override - public void accept(JsVisitor v, JsContext context) { - v.visitDebugger(this, context); - } + @Override + public void accept(JsVisitor v, JsContext context) { + v.visitDebugger(this, context); + } @Override public void acceptChildren(JsVisitor visitor, JsContext context) { } - - @Override - public NodeKind getKind() { - return NodeKind.DEBUGGER; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsDefault.java b/src/com/google/dart/compiler/backend/js/ast/JsDefault.java index f20fab4572f..4a83b7c4979 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsDefault.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsDefault.java @@ -8,13 +8,8 @@ package com.google.dart.compiler.backend.js.ast; * Represents the default option in a JavaScript swtich statement. */ public final class JsDefault extends JsSwitchMember { - @Override - public void accept(JsVisitor v, JsContext context) { - v.visitDefault(this, context); - } - - @Override - public NodeKind getKind() { - return NodeKind.DEFAULT; - } + @Override + public void accept(JsVisitor v, JsContext context) { + v.visitDefault(this, context); + } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsDoWhile.java b/src/com/google/dart/compiler/backend/js/ast/JsDoWhile.java index 97523c3d605..87dbf9a7636 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsDoWhile.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsDoWhile.java @@ -15,11 +15,6 @@ public class JsDoWhile extends JsWhile { super(condition, body); } - @Override - public NodeKind getKind() { - return NodeKind.DO; - } - @Override public void accept(JsVisitor v, JsContext context) { v.visitDoWhile(this, context); diff --git a/src/com/google/dart/compiler/backend/js/ast/JsDocComment.java b/src/com/google/dart/compiler/backend/js/ast/JsDocComment.java index 92ec026b93b..2c5ee580316 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsDocComment.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsDocComment.java @@ -22,11 +22,6 @@ public class JsDocComment extends JsExpressionImpl { tags = Collections.singletonMap(tagName, tagValue); } - @Override - public NodeKind getKind() { - throw new UnsupportedOperationException(); - } - @Override public void accept(JsVisitor v, JsContext context) { v.visitDocComment(this, context); diff --git a/src/com/google/dart/compiler/backend/js/ast/JsEmpty.java b/src/com/google/dart/compiler/backend/js/ast/JsEmpty.java index 8229617fe6d..0e50c6108aa 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsEmpty.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsEmpty.java @@ -16,9 +16,4 @@ public class JsEmpty extends JsNodeImpl implements JsStatement { @Override public void acceptChildren(JsVisitor visitor, JsContext context) { } - - @Override - public NodeKind getKind() { - return NodeKind.EMPTY; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsExpressionStatement.java b/src/com/google/dart/compiler/backend/js/ast/JsExpressionStatement.java index ae680e65afa..5c1f439b0cc 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsExpressionStatement.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsExpressionStatement.java @@ -25,11 +25,6 @@ public final class JsExpressionStatement extends AbstractNode implements JsState expression = visitor.accept(expression); } - @Override - public NodeKind getKind() { - return NodeKind.EXPRESSION_STMT; - } - @Override public Object getSourceInfo() { return null; diff --git a/src/com/google/dart/compiler/backend/js/ast/JsFor.java b/src/com/google/dart/compiler/backend/js/ast/JsFor.java index c7bca577adb..533bb0abfc9 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsFor.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsFor.java @@ -95,9 +95,4 @@ public class JsFor extends JsNodeImpl implements JsStatement { } body = visitor.accept(body); } - - @Override - public NodeKind getKind() { - return NodeKind.FOR; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsForIn.java b/src/com/google/dart/compiler/backend/js/ast/JsForIn.java index f635252dc0f..52697eda9c7 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsForIn.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsForIn.java @@ -64,9 +64,4 @@ public class JsForIn extends JsNodeImpl implements JsStatement { objectExpression = visitor.accept(objectExpression); body = visitor.accept(body); } - - @Override - public NodeKind getKind() { - return NodeKind.FOR_IN; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsFunction.java b/src/com/google/dart/compiler/backend/js/ast/JsFunction.java index 21b0fdbe98e..472b0433945 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsFunction.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsFunction.java @@ -99,9 +99,4 @@ public final class JsFunction extends JsLiteral implements HasName { visitor.acceptWithInsertRemove(params); body = visitor.accept(body); } - - @Override - public NodeKind getKind() { - return NodeKind.FUNCTION; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsIf.java b/src/com/google/dart/compiler/backend/js/ast/JsIf.java index aa4bc22bc22..2ebbc45a728 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsIf.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsIf.java @@ -63,9 +63,4 @@ public final class JsIf extends JsNodeImpl implements JsStatement { elseStatement = visitor.accept(elseStatement); } } - - @Override - public NodeKind getKind() { - return NodeKind.IF; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsInvocation.java b/src/com/google/dart/compiler/backend/js/ast/JsInvocation.java index 3e887940b0f..ec771107033 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsInvocation.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsInvocation.java @@ -76,9 +76,4 @@ public final class JsInvocation extends JsExpressionImpl.JsExpressionHasArgument qualifier = visitor.accept(qualifier); visitor.acceptList(arguments); } - - @Override - public NodeKind getKind() { - return NodeKind.INVOKE; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsLabel.java b/src/com/google/dart/compiler/backend/js/ast/JsLabel.java index dbe63cc237e..8a73b4318c0 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsLabel.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsLabel.java @@ -45,14 +45,9 @@ public class JsLabel extends JsNodeImpl implements JsStatement, HasName { public void accept(JsVisitor v, JsContext context) { v.visitLabel(this, context); } - - @Override - public void acceptChildren(JsVisitor visitor, JsContext context) { - statement = visitor.accept(statement); - } @Override - public NodeKind getKind() { - return NodeKind.LABEL; + public void acceptChildren(JsVisitor visitor, JsContext context) { + statement = visitor.accept(statement); } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsLiteral.java b/src/com/google/dart/compiler/backend/js/ast/JsLiteral.java index edfd17a1a90..dd691ddf905 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsLiteral.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsLiteral.java @@ -46,11 +46,6 @@ public abstract class JsLiteral extends JsExpressionImpl implements CanBooleanEv public void accept(JsVisitor v, JsContext context) { v.visitThis(this, context); } - - @Override - public NodeKind getKind() { - return NodeKind.THIS; - } } public static final class JsBooleanLiteral extends JsValueLiteral { @@ -89,11 +84,6 @@ public abstract class JsLiteral extends JsExpressionImpl implements CanBooleanEv public void accept(JsVisitor v, JsContext context) { v.visitBoolean(this, context); } - - @Override - public NodeKind getKind() { - return NodeKind.BOOLEAN; - } } /** diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNameRef.java b/src/com/google/dart/compiler/backend/js/ast/JsNameRef.java index ce9eeca248b..8ccb13d8367 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsNameRef.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsNameRef.java @@ -104,9 +104,4 @@ public final class JsNameRef extends JsExpressionImpl implements CanBooleanEval, qualifier = visitor.accept(qualifier); } } - - @Override - public NodeKind getKind() { - return NodeKind.NAME_REF; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNew.java b/src/com/google/dart/compiler/backend/js/ast/JsNew.java index e5adf766a7f..da61fffd653 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsNew.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsNew.java @@ -51,9 +51,4 @@ public final class JsNew extends JsExpressionImpl.JsExpressionHasArguments { constructorExpression = visitor.accept(constructorExpression); visitor.acceptList(arguments); } - - @Override - public NodeKind getKind() { - return NodeKind.NEW; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNode.java b/src/com/google/dart/compiler/backend/js/ast/JsNode.java index cd7e268fdb5..308b71393b8 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsNode.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsNode.java @@ -7,8 +7,6 @@ package com.google.dart.compiler.backend.js.ast; import com.google.dart.compiler.common.HasSourceInfo; public interface JsNode extends HasSourceInfo { - NodeKind getKind(); - /** * Causes this object to have the visitor visit itself and its children. * diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNullLiteral.java b/src/com/google/dart/compiler/backend/js/ast/JsNullLiteral.java index a17ac877ef6..226c8a3bc49 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsNullLiteral.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsNullLiteral.java @@ -32,9 +32,4 @@ public final class JsNullLiteral extends JsLiteral.JsValueLiteral { public void accept(JsVisitor v, JsContext context) { v.visitNull(this, context); } - - @Override - public NodeKind getKind() { - return NodeKind.NULL; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNumberLiteral.java b/src/com/google/dart/compiler/backend/js/ast/JsNumberLiteral.java index e77dceefb17..1cf02b66aa6 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsNumberLiteral.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsNumberLiteral.java @@ -15,11 +15,6 @@ public abstract class JsNumberLiteral extends JsLiteral.JsValueLiteral { return false; } - @Override - public NodeKind getKind() { - return NodeKind.NUMBER; - } - public static final class JsDoubleLiteral extends JsNumberLiteral { public final double value; diff --git a/src/com/google/dart/compiler/backend/js/ast/JsObjectLiteral.java b/src/com/google/dart/compiler/backend/js/ast/JsObjectLiteral.java index 7cc65fc7b8a..1d3eb811bc0 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsObjectLiteral.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsObjectLiteral.java @@ -77,9 +77,4 @@ public final class JsObjectLiteral extends JsLiteral { public void acceptChildren(JsVisitor visitor, JsContext context) { visitor.acceptWithInsertRemove(properties); } - - @Override - public NodeKind getKind() { - return NodeKind.OBJECT; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsParameter.java b/src/com/google/dart/compiler/backend/js/ast/JsParameter.java index 68e3b313375..da2c2942520 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsParameter.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsParameter.java @@ -35,9 +35,4 @@ public final class JsParameter extends JsNodeImpl implements HasName { public void acceptChildren(JsVisitor visitor, JsContext context) { } - - @Override - public NodeKind getKind() { - return NodeKind.PARAMETER; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsPostfixOperation.java b/src/com/google/dart/compiler/backend/js/ast/JsPostfixOperation.java index 72efa7868c4..b7c644cba3f 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsPostfixOperation.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsPostfixOperation.java @@ -31,9 +31,4 @@ public final class JsPostfixOperation extends JsUnaryOperation { public void accept(JsVisitor v, JsContext context) { v.visitPostfixOperation(this, context); } - - @Override - public NodeKind getKind() { - return NodeKind.POSTFIX_OP; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsPrefixOperation.java b/src/com/google/dart/compiler/backend/js/ast/JsPrefixOperation.java index ba0e3458c76..e08cd06876e 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsPrefixOperation.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsPrefixOperation.java @@ -6,52 +6,47 @@ package com.google.dart.compiler.backend.js.ast; public final class JsPrefixOperation extends JsUnaryOperation implements CanBooleanEval { - public JsPrefixOperation(JsUnaryOperator op) { - this(op, null); - } - - public JsPrefixOperation(JsUnaryOperator op, JsExpression arg) { - super(op, arg); - } - - @Override - public boolean isBooleanFalse() { - if (getOperator() == JsUnaryOperator.VOID) { - return true; + public JsPrefixOperation(JsUnaryOperator op) { + this(op, null); } - if (getOperator() == JsUnaryOperator.NOT && getArg() instanceof CanBooleanEval) { - CanBooleanEval eval = (CanBooleanEval) getArg(); - return eval.isBooleanTrue(); + + public JsPrefixOperation(JsUnaryOperator op, JsExpression arg) { + super(op, arg); } - return false; - } - @Override - public boolean isBooleanTrue() { - if (getOperator() == JsUnaryOperator.NOT && getArg() instanceof CanBooleanEval) { - CanBooleanEval eval = (CanBooleanEval) getArg(); - return eval.isBooleanFalse(); + @Override + public boolean isBooleanFalse() { + if (getOperator() == JsUnaryOperator.VOID) { + return true; + } + if (getOperator() == JsUnaryOperator.NOT && getArg() instanceof CanBooleanEval) { + CanBooleanEval eval = (CanBooleanEval) getArg(); + return eval.isBooleanTrue(); + } + return false; } - return getOperator() == JsUnaryOperator.TYPEOF; - } - @Override - public boolean isDefinitelyNotNull() { - return getOperator() == JsUnaryOperator.TYPEOF || getOperator() != JsUnaryOperator.VOID; - } + @Override + public boolean isBooleanTrue() { + if (getOperator() == JsUnaryOperator.NOT && getArg() instanceof CanBooleanEval) { + CanBooleanEval eval = (CanBooleanEval) getArg(); + return eval.isBooleanFalse(); + } + return getOperator() == JsUnaryOperator.TYPEOF; + } - @Override - public boolean isDefinitelyNull() { - return getOperator() == JsUnaryOperator.VOID; - } + @Override + public boolean isDefinitelyNotNull() { + return getOperator() == JsUnaryOperator.TYPEOF || getOperator() != JsUnaryOperator.VOID; + } - @Override - public void accept(JsVisitor v, JsContext context) { - v.visitPrefixOperation(this, context); - } + @Override + public boolean isDefinitelyNull() { + return getOperator() == JsUnaryOperator.VOID; + } - @Override - public NodeKind getKind() { - return NodeKind.PREFIX_OP; - } + @Override + public void accept(JsVisitor v, JsContext context) { + v.visitPrefixOperation(this, context); + } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsProgram.java b/src/com/google/dart/compiler/backend/js/ast/JsProgram.java index 5eaee9c19c3..277c74a0b7c 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsProgram.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsProgram.java @@ -119,9 +119,4 @@ public final class JsProgram extends JsNodeImpl { visitor.accept(fragment); } } - - @Override - public NodeKind getKind() { - return NodeKind.PROGRAM; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsProgramFragment.java b/src/com/google/dart/compiler/backend/js/ast/JsProgramFragment.java index 3f1b8d0ce77..0f684a581f4 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsProgramFragment.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsProgramFragment.java @@ -27,9 +27,4 @@ public class JsProgramFragment extends JsNodeImpl { public void acceptChildren(JsVisitor visitor, JsContext context) { visitor.accept(globalBlock); } - - @Override - public NodeKind getKind() { - return NodeKind.PROGRAM_FRAGMENT; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsPropertyInitializer.java b/src/com/google/dart/compiler/backend/js/ast/JsPropertyInitializer.java index 5e184f071f6..48abb4d607e 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsPropertyInitializer.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsPropertyInitializer.java @@ -48,9 +48,4 @@ public class JsPropertyInitializer extends JsNodeImpl { labelExpr = visitor.accept(labelExpr); valueExpr = visitor.accept(valueExpr); } - - @Override - public NodeKind getKind() { - return NodeKind.PROPERTY_INIT; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsRegExp.java b/src/com/google/dart/compiler/backend/js/ast/JsRegExp.java index 2015a5f8b8c..a9ef973af14 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsRegExp.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsRegExp.java @@ -54,9 +54,4 @@ public final class JsRegExp extends JsLiteral.JsValueLiteral { public void accept(JsVisitor v, JsContext context) { v.visitRegExp(this, context); } - - @Override - public NodeKind getKind() { - return NodeKind.REGEXP; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsReturn.java b/src/com/google/dart/compiler/backend/js/ast/JsReturn.java index ee798d5573f..456dced912f 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsReturn.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsReturn.java @@ -33,12 +33,7 @@ public final class JsReturn extends JsNodeImpl implements JsStatement { @Override public void acceptChildren(JsVisitor visitor, JsContext context) { if (expression != null) { - expression = visitor.accept(expression); - } - } - - @Override - public NodeKind getKind() { - return NodeKind.RETURN; + expression = visitor.accept(expression); + } } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsStringLiteral.java b/src/com/google/dart/compiler/backend/js/ast/JsStringLiteral.java index 68448bda891..bdc15456722 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsStringLiteral.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsStringLiteral.java @@ -44,9 +44,4 @@ public final class JsStringLiteral extends JsLiteral.JsValueLiteral { public void accept(JsVisitor v, JsContext context) { v.visitString(this, context); } - - @Override - public NodeKind getKind() { - return NodeKind.STRING; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsSwitch.java b/src/com/google/dart/compiler/backend/js/ast/JsSwitch.java index c4b3a3c1ae6..ed41056624c 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsSwitch.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsSwitch.java @@ -41,9 +41,4 @@ public class JsSwitch extends JsNodeImpl implements JsStatement { expr = visitor.accept(expr); visitor.acceptWithInsertRemove(cases); } - - @Override - public NodeKind getKind() { - return NodeKind.SWITCH; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsThrow.java b/src/com/google/dart/compiler/backend/js/ast/JsThrow.java index 164d2dae0f2..69e7ee4a085 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsThrow.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsThrow.java @@ -31,9 +31,4 @@ public class JsThrow extends JsNodeImpl implements JsStatement { public void acceptChildren(JsVisitor visitor, JsContext context) { visitor.accept(expression); } - - @Override - public NodeKind getKind() { - return NodeKind.THROW; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsTry.java b/src/com/google/dart/compiler/backend/js/ast/JsTry.java index 3625bd0ebca..613f73da92e 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsTry.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsTry.java @@ -60,9 +60,4 @@ public class JsTry extends JsNodeImpl implements JsStatement { finallyBlock = visitor.accept(finallyBlock); } } - - @Override - public NodeKind getKind() { - return NodeKind.TRY; - } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsVars.java b/src/com/google/dart/compiler/backend/js/ast/JsVars.java index c88016f0de7..f955fa88331 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsVars.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsVars.java @@ -91,11 +91,6 @@ public class JsVars extends JsNodeImpl implements JsStatement, Iterable