From 6307201006b2672f28e9a14522288574464e1797 Mon Sep 17 00:00:00 2001 From: develar Date: Thu, 25 Oct 2012 09:52:19 +0400 Subject: [PATCH] simplify AST (idea like) --- .../dart/compiler/backend/js/ast/JsConditional.java | 3 --- .../google/dart/compiler/backend/js/ast/JsContinue.java | 5 ----- .../google/dart/compiler/backend/js/ast/JsDocComment.java | 4 ---- src/com/google/dart/compiler/backend/js/ast/JsEmpty.java | 4 ---- .../google/dart/compiler/backend/js/ast/JsFunction.java | 2 +- src/com/google/dart/compiler/backend/js/ast/JsIf.java | 8 ++++---- .../google/dart/compiler/backend/js/ast/JsLiteral.java | 4 ---- .../google/dart/compiler/backend/js/ast/JsNameRef.java | 4 ++-- .../google/dart/compiler/backend/js/ast/JsNodeImpl.java | 4 ++++ .../google/dart/compiler/backend/js/ast/JsParameter.java | 5 ----- .../compiler/backend/js/ast/JsPropertyInitializer.java | 2 +- 11 files changed, 12 insertions(+), 33 deletions(-) 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 6ac57c2dc54..e89b7f40a19 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsConditional.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsConditional.java @@ -4,9 +4,6 @@ package com.google.dart.compiler.backend.js.ast; -/** - * Represents a JavaScript conditional expression. - */ public final class JsConditional extends JsExpressionImpl { private JsExpression testExpression; private JsExpression elseExpression; 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 3aa329aa51c..3b5b5fc8070 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsContinue.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsContinue.java @@ -26,9 +26,4 @@ public class JsContinue extends JsNodeImpl implements JsStatement { public void accept(JsVisitor v, JsContext context) { v.visitContinue(this, context); } - - @Override - public void acceptChildren(JsVisitor visitor, JsContext 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 2c5ee580316..da90d894862 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsDocComment.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsDocComment.java @@ -27,10 +27,6 @@ public class JsDocComment extends JsExpressionImpl { v.visitDocComment(this, context); } - @Override - public void acceptChildren(JsVisitor visitor, JsContext context) { - } - @Override public boolean hasSideEffects() { return false; 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 0e50c6108aa..0835eaf3439 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsEmpty.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsEmpty.java @@ -12,8 +12,4 @@ public class JsEmpty extends JsNodeImpl implements JsStatement { public void accept(JsVisitor v, JsContext context) { v.visitEmpty(this, context); } - - @Override - public void acceptChildren(JsVisitor visitor, JsContext context) { - } } 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 472b0433945..b44cfc8140a 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsFunction.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsFunction.java @@ -97,6 +97,6 @@ public final class JsFunction extends JsLiteral implements HasName { @Override public void acceptChildren(JsVisitor visitor, JsContext context) { visitor.acceptWithInsertRemove(params); - body = visitor.accept(body); + body = visitor.accept(body); } } 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 2ebbc45a728..6d45f4ef1e1 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsIf.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsIf.java @@ -58,9 +58,9 @@ public final class JsIf extends JsNodeImpl implements JsStatement { @Override public void acceptChildren(JsVisitor visitor, JsContext context) { ifExpression = visitor.accept(ifExpression); - thenStatement = visitor.accept(thenStatement); - if (elseStatement != null) { - elseStatement = visitor.accept(elseStatement); - } + thenStatement = visitor.accept(thenStatement); + if (elseStatement != null) { + elseStatement = visitor.accept(elseStatement); + } } } 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 dd691ddf905..2e1925abf30 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsLiteral.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsLiteral.java @@ -102,9 +102,5 @@ public abstract class JsLiteral extends JsExpressionImpl implements CanBooleanEv public final boolean isLeaf() { return true; } - - @Override - public void acceptChildren(JsVisitor visitor, JsContext context) { - } } } 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 8ccb13d8367..31974d93339 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsNameRef.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsNameRef.java @@ -101,7 +101,7 @@ public final class JsNameRef extends JsExpressionImpl implements CanBooleanEval, @Override public void acceptChildren(JsVisitor visitor, JsContext context) { if (qualifier != null) { - qualifier = visitor.accept(qualifier); - } + qualifier = visitor.accept(qualifier); + } } } diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNodeImpl.java b/src/com/google/dart/compiler/backend/js/ast/JsNodeImpl.java index b41e793dd4a..83fe04c8936 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsNodeImpl.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsNodeImpl.java @@ -15,4 +15,8 @@ abstract class JsNodeImpl extends AbstractNode { public void setSourceInfo(Object info) { sourceInfo = info; } + + @Override + public void acceptChildren(JsVisitor visitor, JsContext context) { + } } \ No newline at end of file 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 da2c2942520..1af5537ef7f 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsParameter.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsParameter.java @@ -30,9 +30,4 @@ public final class JsParameter extends JsNodeImpl implements HasName { public void accept(JsVisitor v, JsContext context) { v.visitParameter(this, context); } - - @Override - public void acceptChildren(JsVisitor visitor, JsContext context) { - - } } 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 48abb4d607e..caaef16b4f0 100644 --- a/src/com/google/dart/compiler/backend/js/ast/JsPropertyInitializer.java +++ b/src/com/google/dart/compiler/backend/js/ast/JsPropertyInitializer.java @@ -46,6 +46,6 @@ public class JsPropertyInitializer extends JsNodeImpl { @Override public void acceptChildren(JsVisitor visitor, JsContext context) { labelExpr = visitor.accept(labelExpr); - valueExpr = visitor.accept(valueExpr); + valueExpr = visitor.accept(valueExpr); } }