ordercheck passes. git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@40 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsArrayAccess.java b/dev/core/src/com/google/gwt/dev/js/ast/JsArrayAccess.java index 01d4e0e..b54bf2d 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsArrayAccess.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsArrayAccess.java
@@ -20,6 +20,10 @@ */ public final class JsArrayAccess extends JsExpression { + private JsExpression arrayExpr; + + private JsExpression indexExpr; + public JsArrayAccess() { } @@ -51,7 +55,4 @@ } v.endVisit(this); } - - private JsExpression arrayExpr; - private JsExpression indexExpr; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsArrayLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsArrayLiteral.java index 245edbd..634d43c 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsArrayLiteral.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsArrayLiteral.java
@@ -20,19 +20,19 @@ */ public final class JsArrayLiteral extends JsExpression { + private final JsExpressions exprs = new JsExpressions(); + public JsArrayLiteral() { } + public JsExpressions getExpressions() { + return exprs; + } + public void traverse(JsVisitor v) { if (v.visit(this)) { exprs.traverse(v); } v.endVisit(this); } - - public JsExpressions getExpressions() { - return exprs; - } - - private final JsExpressions exprs = new JsExpressions(); }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperation.java b/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperation.java index 8f78d37..bae47c0 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperation.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperation.java
@@ -20,23 +20,22 @@ */ public final class JsBinaryOperation extends JsExpression { + private JsExpression arg1; + + private JsExpression arg2; + + private final JsBinaryOperator op; + public JsBinaryOperation(JsBinaryOperator op) { this(op, null, null); } - public JsBinaryOperation(JsBinaryOperator op, JsExpression arg1, JsExpression arg2) { + public JsBinaryOperation(JsBinaryOperator op, JsExpression arg1, + JsExpression arg2) { this.op = op; this.arg1 = arg1; this.arg2 = arg2; } - - public void traverse(JsVisitor v) { - if (v.visit(this)) { - arg1.traverse(v); - arg2.traverse(v); - } - v.endVisit(this); - } public JsExpression getArg1() { return arg1; @@ -58,7 +57,11 @@ this.arg2 = arg2; } - private JsExpression arg1; - private JsExpression arg2; - private final JsBinaryOperator op; + public void traverse(JsVisitor v) { + if (v.visit(this)) { + arg1.traverse(v); + arg2.traverse(v); + } + v.endVisit(this); + } }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperator.java b/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperator.java index 5b95a0a..2173aff 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperator.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsBinaryOperator.java
@@ -81,13 +81,12 @@ public static final JsBinaryOperator ASG_BIT_XOR = create("^=", 2, INFIX); public static final JsBinaryOperator COMMA = create(",", 1, LEFT_INFIX); - - private JsBinaryOperator(String symbol, int precedence, int mask) { - super(symbol, precedence, mask); - } - + private static JsBinaryOperator create(String symbol, int precedence, int mask) { JsBinaryOperator op = new JsBinaryOperator(symbol, precedence, mask); return op; } + private JsBinaryOperator(String symbol, int precedence, int mask) { + super(symbol, precedence, mask); + } }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsBlock.java b/dev/core/src/com/google/gwt/dev/js/ast/JsBlock.java index 1c597e1..3c721fa 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsBlock.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsBlock.java
@@ -22,16 +22,18 @@ */ public class JsBlock extends JsStatement { + private final JsStatements stmts = new JsStatements(); + public JsBlock() { } + public JsStatements getStatements() { + return stmts; + } + public boolean isGlobalBlock() { return false; } - - public JsStatements getStatements() { - return stmts; - } public void traverse(JsVisitor v) { if (v.visit(this)) { @@ -42,6 +44,4 @@ } v.endVisit(this); } - - private final JsStatements stmts = new JsStatements(); }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsBooleanLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsBooleanLiteral.java index 8cfe297..0f17303 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsBooleanLiteral.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsBooleanLiteral.java
@@ -20,6 +20,8 @@ */ public final class JsBooleanLiteral extends JsExpression { + private final boolean value; + // Should be interned by JsProgram JsBooleanLiteral(boolean value) { this.value = value; @@ -29,14 +31,12 @@ return value; } - public void traverse(JsVisitor v) { - v.visit(this); - v.endVisit(this); - } - public boolean isLeaf() { return true; } - private final boolean value; + public void traverse(JsVisitor v) { + v.visit(this); + v.endVisit(this); + } }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsBreak.java b/dev/core/src/com/google/gwt/dev/js/ast/JsBreak.java index 09e97e3..6ef19d6 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsBreak.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsBreak.java
@@ -20,6 +20,8 @@ */ public final class JsBreak extends JsStatement { + private final JsNameRef label; + public JsBreak() { this(null); } @@ -36,6 +38,4 @@ v.visit(this); v.endVisit(this); } - - private final JsNameRef label; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsCase.java b/dev/core/src/com/google/gwt/dev/js/ast/JsCase.java index 0c8a1fc..6674f51 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsCase.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsCase.java
@@ -20,6 +20,8 @@ */ public final class JsCase extends JsSwitchMember { + private JsExpression caseExpr; + public JsCase() { } @@ -38,6 +40,4 @@ } v.endVisit(this); } - - private JsExpression caseExpr; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsCatch.java b/dev/core/src/com/google/gwt/dev/js/ast/JsCatch.java index 161199b..c519d42 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsCatch.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsCatch.java
@@ -20,6 +20,12 @@ */ public class JsCatch extends JsNode implements HasCondition, HasName { + private JsBlock body; + + private JsExpression condition; + + private final JsName name; + public JsCatch(JsName name) { this.name = name; } @@ -28,10 +34,6 @@ return body; } - public void setBody(JsBlock body) { - this.body = body; - } - public JsExpression getCondition() { return condition; } @@ -40,6 +42,10 @@ return name; } + public void setBody(JsBlock body) { + this.body = body; + } + public void setCondition(JsExpression condition) { this.condition = condition; } @@ -53,8 +59,4 @@ } v.endVisit(this); } - - private JsBlock body; - private JsExpression condition; - private final JsName name; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsCollection.java b/dev/core/src/com/google/gwt/dev/js/ast/JsCollection.java index 6ddc2f7..7d1aac9 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsCollection.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsCollection.java
@@ -24,28 +24,30 @@ */ public class JsCollection extends JsNode { - public void addNode(JsNode o) { - assert (o != null); - list.add(o); - } + private final List/* <JsNode> */list = new ArrayList/* <JsNode> */(); public void addNode(int index, JsNode o) { assert (o != null); list.add(index, o); } + public void addNode(JsNode o) { + assert (o != null); + list.add(o); + } + public JsNode getNode(int index) { return (JsNode) list.get(index); } - public void setNode(int index, JsNode o) { - list.set(index, o); - } - public Iterator iterator() { return list.iterator(); } + public void setNode(int index, JsNode o) { + list.set(index, o); + } + public int size() { return list.size(); } @@ -56,6 +58,4 @@ node.traverse(v); } } - - private final List/* <JsNode> */list = new ArrayList/* <JsNode> */(); }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsConditional.java b/dev/core/src/com/google/gwt/dev/js/ast/JsConditional.java index b9a594a..02920fd 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsConditional.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsConditional.java
@@ -20,15 +20,26 @@ */ public final class JsConditional extends JsExpression { + private JsExpression testExpr; + + private JsExpression thenExpr; + + private JsExpression elseExpr; + public JsConditional() { } - public JsConditional(JsExpression testExpr, JsExpression thenExpr, JsExpression elseExpr) { + public JsConditional(JsExpression testExpr, JsExpression thenExpr, + JsExpression elseExpr) { this.testExpr = testExpr; this.thenExpr = thenExpr; this.elseExpr = elseExpr; } + public JsExpression getElseExpression() { + return elseExpr; + } + public JsExpression getTestExpression() { return testExpr; } @@ -37,22 +48,18 @@ return thenExpr; } - public JsExpression getElseExpression() { - return elseExpr; - } - public void setElseExpression(JsExpression elseExpr) { this.elseExpr = elseExpr; } - public void setThenExpression(JsExpression thenExpr) { - this.thenExpr = thenExpr; - } - public void setTestExpression(JsExpression testExpr) { this.testExpr = testExpr; } + public void setThenExpression(JsExpression thenExpr) { + this.thenExpr = thenExpr; + } + public void traverse(JsVisitor v) { if (v.visit(this)) { testExpr.traverse(v); @@ -61,8 +68,4 @@ } v.endVisit(this); } - - private JsExpression testExpr; - private JsExpression thenExpr; - private JsExpression elseExpr; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsContinue.java b/dev/core/src/com/google/gwt/dev/js/ast/JsContinue.java index 6d8fd24..6d809d7 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsContinue.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsContinue.java
@@ -20,6 +20,8 @@ */ public final class JsContinue extends JsStatement { + private final JsNameRef label; + public JsContinue() { this(null); } @@ -36,6 +38,4 @@ v.visit(this); v.endVisit(this); } - - private final JsNameRef label; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsDecimalLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsDecimalLiteral.java index 702ae69..712c889 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsDecimalLiteral.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsDecimalLiteral.java
@@ -20,6 +20,8 @@ */ public final class JsDecimalLiteral extends JsExpression { + private final String value; + // Should be interned by JsProgram JsDecimalLiteral(String value) { this.value = value; @@ -37,6 +39,4 @@ v.visit(this); v.endVisit(this); } - - private final String value; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsDelete.java b/dev/core/src/com/google/gwt/dev/js/ast/JsDelete.java index a76f8d5..8390295 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsDelete.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsDelete.java
@@ -20,19 +20,21 @@ */ public class JsDelete extends JsExpression { + private JsExpression toDelete; + public JsDelete() { } - public void setExpr(JsNameRef nameRef) { - this.toDelete = nameRef; + public JsExpression getExpr() { + return toDelete; } public void setExpr(JsArrayAccess arrayElem) { this.toDelete = arrayElem; } - public JsExpression getExpr() { - return toDelete; + public void setExpr(JsNameRef nameRef) { + this.toDelete = nameRef; } public void traverse(JsVisitor v) { @@ -41,6 +43,4 @@ } v.endVisit(this); } - - private JsExpression toDelete; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsDoWhile.java b/dev/core/src/com/google/gwt/dev/js/ast/JsDoWhile.java index c24d99b..2579ce9 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsDoWhile.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsDoWhile.java
@@ -20,6 +20,10 @@ */ public class JsDoWhile extends JsStatement { + private JsStatement body; + + private JsExpression condition; + public JsDoWhile() { } @@ -51,7 +55,4 @@ } v.endVisit(this); } - - private JsStatement body; - private JsExpression condition; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsExprStmt.java b/dev/core/src/com/google/gwt/dev/js/ast/JsExprStmt.java index 05b6367..b2cbcd4 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsExprStmt.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsExprStmt.java
@@ -20,20 +20,20 @@ */ public final class JsExprStmt extends JsStatement { + private final JsExpression expr; + public JsExprStmt(JsExpression expr) { this.expr = expr; } + public JsExpression getExpression() { + return expr; + } + public void traverse(JsVisitor v) { if (v.visit(this)) { expr.traverse(v); } v.endVisit(this); } - - public JsExpression getExpression() { - return expr; - } - - private final JsExpression expr; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsExpression.java b/dev/core/src/com/google/gwt/dev/js/ast/JsExpression.java index b910f62..3b9da28 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsExpression.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsExpression.java
@@ -19,10 +19,6 @@ * An abstract base class for all JavaScript expressions. */ public abstract class JsExpression extends JsNode { - public JsExprStmt makeStmt() { - return new JsExprStmt(this); - } - /** * Determines whether or not this expression is a leaf, such as a * {@link JsNameRef}, {@link JsBooleanLiteral}, and so on. Leaf expressions @@ -34,4 +30,8 @@ // return false; } + + public JsExprStmt makeStmt() { + return new JsExprStmt(this); + } }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsFor.java b/dev/core/src/com/google/gwt/dev/js/ast/JsFor.java index 5f24b97..ae50bd0 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsFor.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsFor.java
@@ -28,6 +28,16 @@ */ public class JsFor extends JsStatement { + private JsStatement body; + + private JsExpression condition; + + private JsExpression incrExpr; + + private JsExpression initExpr; + + private JsVars initVars; + public JsFor() { } @@ -47,6 +57,10 @@ return initExpr; } + public JsVars getInitVars() { + return initVars; + } + public void setBody(JsStatement body) { this.body = body; } @@ -67,10 +81,6 @@ this.initVars = initVars; } - public JsVars getInitVars() { - return initVars; - } - public void traverse(JsVisitor v) { if (v.visit(this)) { assert (!(initExpr != null && initVars != null)); @@ -92,10 +102,4 @@ } v.endVisit(this); } - - private JsStatement body; - private JsExpression condition; - private JsExpression incrExpr; - private JsExpression initExpr; - private JsVars initVars; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsForIn.java b/dev/core/src/com/google/gwt/dev/js/ast/JsForIn.java index 7c00e9c..b49e2ff 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsForIn.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsForIn.java
@@ -20,6 +20,15 @@ */ public class JsForIn extends JsStatement { + private JsStatement body; + + private JsExpression iterExpr; + + // Optional: the name of a new iterator variable to introduce + private final JsName iterVarName; + + private JsExpression objExpr; + public JsForIn() { this(null); } @@ -66,10 +75,4 @@ } v.endVisit(this); } - - private JsStatement body; - private JsExpression iterExpr; - // Optional: the name of a new iterator variable to introduce - private final JsName iterVarName; - private JsExpression objExpr; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsFunction.java b/dev/core/src/com/google/gwt/dev/js/ast/JsFunction.java index 8d2efd0..9e2b68b 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsFunction.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsFunction.java
@@ -20,6 +20,14 @@ */ public final class JsFunction extends JsExpression implements HasName, HasScope { + private JsBlock body; + + private JsName name; + + private final JsParameters params = new JsParameters(); + + private final JsScope scope; + /** * Creates an anonymous function. */ @@ -76,9 +84,4 @@ } v.endVisit(this); } - - private JsBlock body; - private JsName name; - private final JsParameters params = new JsParameters(); - private final JsScope scope; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsIf.java b/dev/core/src/com/google/gwt/dev/js/ast/JsIf.java index 92cfcb8..ea85326 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsIf.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsIf.java
@@ -20,6 +20,12 @@ */ public final class JsIf extends JsStatement { + private JsExpression ifExpr; + + private JsStatement thenStmt; + + private JsStatement elseStmt; + public JsIf() { } @@ -27,22 +33,22 @@ return elseStmt; } - public void setElseStmt(JsStatement elseStmt) { - this.elseStmt = elseStmt; - } - public JsExpression getIfExpr() { return ifExpr; } - public void setIfExpr(JsExpression ifExpr) { - this.ifExpr = ifExpr; - } - public JsStatement getThenStmt() { return thenStmt; } + public void setElseStmt(JsStatement elseStmt) { + this.elseStmt = elseStmt; + } + + public void setIfExpr(JsExpression ifExpr) { + this.ifExpr = ifExpr; + } + public void setThenStmt(JsStatement thenStmt) { this.thenStmt = thenStmt; } @@ -57,8 +63,4 @@ } v.endVisit(this); } - - private JsExpression ifExpr; - private JsStatement thenStmt; - private JsStatement elseStmt; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsIntegralLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsIntegralLiteral.java index 3fa957c..3728fa5 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsIntegralLiteral.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsIntegralLiteral.java
@@ -22,11 +22,17 @@ */ public class JsIntegralLiteral extends JsExpression { + private final BigInteger value; + // Should be interned in JsProgram JsIntegralLiteral(BigInteger value) { this.value = value; } - + + public BigInteger getValue() { + return value; + } + public boolean isLeaf() { return true; } @@ -35,10 +41,4 @@ v.visit(this); v.endVisit(this); } - - public BigInteger getValue() { - return value; - } - - private final BigInteger value; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsInvocation.java b/dev/core/src/com/google/gwt/dev/js/ast/JsInvocation.java index 989b544..5178bff 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsInvocation.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsInvocation.java
@@ -20,6 +20,10 @@ */ public final class JsInvocation extends JsExpression implements HasArguments { + private final JsExpressions args = new JsExpressions(); + + private JsExpression qualifier; + public JsInvocation() { } @@ -42,7 +46,4 @@ } v.endVisit(this); } - - private final JsExpressions args = new JsExpressions(); - private JsExpression qualifier; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsLabel.java b/dev/core/src/com/google/gwt/dev/js/ast/JsLabel.java index ec901cb..9cdf235 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsLabel.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsLabel.java
@@ -20,6 +20,10 @@ */ public class JsLabel extends JsStatement implements HasName { + private final JsName label; + + private JsStatement stmt; + public JsLabel(JsName label) { this.label = label; } @@ -28,21 +32,17 @@ return label; } + public JsStatement getStmt() { + return stmt; + } + + public void setStmt(JsStatement stmt) { + this.stmt = stmt; + } public void traverse(JsVisitor v) { if (v.visit(this)) { stmt.traverse(v); } v.endVisit(this); } - - public void setStmt(JsStatement stmt) { - this.stmt = stmt; - } - - public JsStatement getStmt() { - return stmt; - } - - private final JsName label; - private JsStatement stmt; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsName.java b/dev/core/src/com/google/gwt/dev/js/ast/JsName.java index c31c25c..c60bdff 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsName.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsName.java
@@ -20,6 +20,10 @@ */ public abstract class JsName { + private final String ident; + + private final JsScope scope; + /** * @param scope the scope in which this name is defined * @param ident the unmangled ident to use for this name @@ -37,6 +41,8 @@ return scope; } + public abstract boolean isObfuscatable(); + public JsNameRef makeRef() { return new JsNameRef(this); } @@ -44,9 +50,4 @@ public String toString() { return ident; } - - public abstract boolean isObfuscatable(); - - private final String ident; - private final JsScope scope; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java b/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java index 9f96710..09c434a 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java
@@ -20,6 +20,10 @@ */ public final class JsNameRef extends JsExpression implements HasName { + private JsName name; + + private JsExpression qualifier; + public JsNameRef(JsName name) { this.name = name; } @@ -28,8 +32,8 @@ return name; } - public void setName(JsName name) { - this.name = name; + public JsExpression getQualifier() { + return qualifier; } public boolean isLeaf() { @@ -40,8 +44,8 @@ } } - public JsExpression getQualifier() { - return qualifier; + public void setName(JsName name) { + this.name = name; } public void setQualifier(JsExpression qualifier) { @@ -56,7 +60,4 @@ } v.endVisit(this); } - - private JsName name; - private JsExpression qualifier; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsNew.java b/dev/core/src/com/google/gwt/dev/js/ast/JsNew.java index 10a54d0..2e77957 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsNew.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsNew.java
@@ -20,6 +20,10 @@ */ public final class JsNew extends JsExpression implements HasArguments { + private final JsExpressions args = new JsExpressions(); + + private JsExpression ctorExpr; + public JsNew() { } @@ -42,7 +46,4 @@ } v.endVisit(this); } - - private final JsExpressions args = new JsExpressions(); - private JsExpression ctorExpr; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsObjectLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsObjectLiteral.java index 7dc33bb..b5a0880 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsObjectLiteral.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsObjectLiteral.java
@@ -20,19 +20,19 @@ */ public class JsObjectLiteral extends JsExpression { + private final JsPropertyInitializers props = new JsPropertyInitializers(); + public JsObjectLiteral() { } + public JsPropertyInitializers getPropertyInitializers() { + return props; + } + public void traverse(JsVisitor v) { if (v.visit(this)) { props.traverse(v); } v.endVisit(this); } - - public JsPropertyInitializers getPropertyInitializers() { - return props; - } - - private final JsPropertyInitializers props = new JsPropertyInitializers(); }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsOperator.java b/dev/core/src/com/google/gwt/dev/js/ast/JsOperator.java index e16733a..5fd7aac 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsOperator.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsOperator.java
@@ -25,6 +25,12 @@ protected static final int POSTFIX = 0x04; protected static final int PREFIX = 0x08; + private final int mask; + + private final int precedence; + + private final String symbol; + protected JsOperator(String symbol, int precedence, int mask) { this.symbol = symbol; this.precedence = precedence; @@ -39,12 +45,16 @@ return symbol; } + public boolean isLeftAssociative() { + return (mask & LEFT) != 0; + } + public boolean isPrecedenceLessThan(JsOperator other) { return precedence < other.precedence; } - public boolean isLeftAssociative() { - return (mask & LEFT) != 0; + public boolean isValidInfix() { + return (mask & INFIX) != 0; } public boolean isValidPostfix() { @@ -55,15 +65,7 @@ return (mask & PREFIX) != 0; } - public boolean isValidInfix() { - return (mask & INFIX) != 0; - } - public String toString() { return symbol; } - - private final int mask; - private final int precedence; - private final String symbol; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsParameter.java b/dev/core/src/com/google/gwt/dev/js/ast/JsParameter.java index 5ce0355..5286381 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsParameter.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsParameter.java
@@ -20,18 +20,18 @@ */ public final class JsParameter extends JsNode implements HasName { + private final JsName name; + public JsParameter(JsName name) { this.name = name; } - public void traverse(JsVisitor v) { - v.visit(this); - v.endVisit(this); - } - public JsName getName() { return name; } - private final JsName name; + public void traverse(JsVisitor v) { + v.visit(this); + v.endVisit(this); + } }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsPostfixOperation.java b/dev/core/src/com/google/gwt/dev/js/ast/JsPostfixOperation.java index 9a7f007..aa35210 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsPostfixOperation.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsPostfixOperation.java
@@ -20,6 +20,10 @@ */ public final class JsPostfixOperation extends JsExpression { + private JsExpression arg; + + private final JsUnaryOperator op; + public JsPostfixOperation(JsUnaryOperator op) { this(op, null); } @@ -29,13 +33,6 @@ this.arg = arg; } - public void traverse(JsVisitor v) { - if (v.visit(this)) { - arg.traverse(v); - } - v.endVisit(this); - } - public JsExpression getArg() { return arg; } @@ -48,6 +45,10 @@ this.arg = arg; } - private JsExpression arg; - private final JsUnaryOperator op; + public void traverse(JsVisitor v) { + if (v.visit(this)) { + arg.traverse(v); + } + v.endVisit(this); + } }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsPrefixOperation.java b/dev/core/src/com/google/gwt/dev/js/ast/JsPrefixOperation.java index db111e3..0b30e37 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsPrefixOperation.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsPrefixOperation.java
@@ -20,6 +20,10 @@ */ public final class JsPrefixOperation extends JsExpression { + private JsExpression arg; + + private final JsUnaryOperator op; + public JsPrefixOperation(JsUnaryOperator op) { this(op, null); } @@ -28,13 +32,6 @@ this.op = op; this.arg = arg; } - - public void traverse(JsVisitor v) { - if (v.visit(this)) { - arg.traverse(v); - } - v.endVisit(this); - } public JsExpression getArg() { return arg; @@ -48,6 +45,10 @@ this.arg = arg; } - private JsExpression arg; - private final JsUnaryOperator op; + public void traverse(JsVisitor v) { + if (v.visit(this)) { + arg.traverse(v); + } + v.endVisit(this); + } }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsProgram.java b/dev/core/src/com/google/gwt/dev/js/ast/JsProgram.java index a3dcd2d..82cd16b 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsProgram.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsProgram.java
@@ -24,6 +24,26 @@ */ public final class JsProgram extends JsNode implements HasScope { + private final Map decimalLiteralMap = new HashMap(); + + private final JsEmpty emptyStmt = new JsEmpty(); + + private final JsBooleanLiteral falseLiteral = new JsBooleanLiteral(false); + + private final JsGlobalBlock globalBlock; + + private final Map integralLiteralMap = new HashMap(); + + private final JsNullLiteral nullLiteral = new JsNullLiteral(); + + private final JsRootScope rootScope; + + private final Map stringLiteralMap = new HashMap(); + + private final JsBooleanLiteral trueLiteral = new JsBooleanLiteral(true); + + private JsStatement debuggerStmt; + /** * Constructs a JavaScript program object. */ @@ -45,16 +65,6 @@ return debuggerStmt; } - /** - * Specifies a {@link JsStatement} to use whenever parsed source includes a - * <code>debugger</code> statement. - * - * @see #getDebuggerStmt() - */ - public void setDebuggerStmt(JsStatement debuggerStmt) { - this.debuggerStmt = debuggerStmt; - } - public JsDecimalLiteral getDecimalLiteral(String value) { JsDecimalLiteral lit = (JsDecimalLiteral) decimalLiteralMap.get(value); if (lit == null) { @@ -112,21 +122,20 @@ return trueLiteral; } + /** + * Specifies a {@link JsStatement} to use whenever parsed source includes a + * <code>debugger</code> statement. + * + * @see #getDebuggerStmt() + */ + public void setDebuggerStmt(JsStatement debuggerStmt) { + this.debuggerStmt = debuggerStmt; + } + public void traverse(JsVisitor v) { if (v.visit(this)) { globalBlock.traverse(v); } v.endVisit(this); } - - private final Map decimalLiteralMap = new HashMap(); - private final JsEmpty emptyStmt = new JsEmpty(); - private final JsBooleanLiteral falseLiteral = new JsBooleanLiteral(false); - private final JsGlobalBlock globalBlock; - private final Map integralLiteralMap = new HashMap(); - private final JsNullLiteral nullLiteral = new JsNullLiteral(); - private final JsRootScope rootScope; - private final Map stringLiteralMap = new HashMap(); - private final JsBooleanLiteral trueLiteral = new JsBooleanLiteral(true); - private JsStatement debuggerStmt; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsPropertyInitializer.java b/dev/core/src/com/google/gwt/dev/js/ast/JsPropertyInitializer.java index 2063c1a..15583ac 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsPropertyInitializer.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsPropertyInitializer.java
@@ -20,6 +20,10 @@ */ public class JsPropertyInitializer extends JsNode { + private JsExpression labelExpr; + + private JsExpression valueExpr; + public JsPropertyInitializer() { } @@ -51,7 +55,4 @@ } v.endVisit(this); } - - private JsExpression labelExpr; - private JsExpression valueExpr; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsRegExp.java b/dev/core/src/com/google/gwt/dev/js/ast/JsRegExp.java index aa8dc9f..345f65a 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsRegExp.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsRegExp.java
@@ -20,6 +20,10 @@ */ public class JsRegExp extends JsExpression { + private String flags; + + private String pattern; + public JsRegExp() { } @@ -43,7 +47,4 @@ v.visit(this); v.endVisit(this); } - - private String flags; - private String pattern; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsReturn.java b/dev/core/src/com/google/gwt/dev/js/ast/JsReturn.java index 1ac9bb4..3878010 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsReturn.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsReturn.java
@@ -20,6 +20,8 @@ */ public final class JsReturn extends JsStatement { + private JsExpression expr; + public JsReturn() { } @@ -43,6 +45,4 @@ } v.endVisit(this); } - - private JsExpression expr; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java b/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java index 15a0b22..25a6caf 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java
@@ -26,6 +26,10 @@ */ public final class JsRootScope extends JsScope { + private final JsProgram program; + + private final Map/* <String, JsUnobfuscatableName> */unobfuscatableNames = new HashMap(); + public JsRootScope(JsProgram program) { this.program = program; ctorAddKnownGlobalSymbols(); @@ -44,10 +48,9 @@ public JsUnobfuscatableName getOrCreateUnobfuscatableName(String ident) { if (JsKeywords.isKeyword(ident.toCharArray())) { throw new IllegalArgumentException("Cannot create identifier " + ident - + "; that name is a reserved word."); + + "; that name is a reserved word."); } - JsUnobfuscatableName name = (JsUnobfuscatableName) unobfuscatableNames - .get(ident); + JsUnobfuscatableName name = (JsUnobfuscatableName) unobfuscatableNames.get(ident); if (name == null) { name = new JsUnobfuscatableName(this, ident); unobfuscatableNames.put(ident, name); @@ -72,8 +75,7 @@ JsName createSpecialUnobfuscatableName(String ident) { // this is for the debugger statement; ignore keyword restriction - JsUnobfuscatableName name = (JsUnobfuscatableName) unobfuscatableNames - .get(ident); + JsUnobfuscatableName name = (JsUnobfuscatableName) unobfuscatableNames.get(ident); if (name == null) { name = new JsUnobfuscatableName(this, ident); unobfuscatableNames.put(ident, name); @@ -82,11 +84,11 @@ } private void ctorAddKnownGlobalSymbols() { - String[] commonBuiltins = new String[]{ - "ActiveXObject", "Array", "Boolean", "Date", "Debug", "Enumerator", - "Error", "Function", "Global", "Image", "Math", "Number", "Object", - "RegExp", "String", "VBArray", "window", "document", "event", - "arguments", "call", "toString", "$wnd", "$doc", "$moduleName" }; + String[] commonBuiltins = new String[] { + "ActiveXObject", "Array", "Boolean", "Date", "Debug", "Enumerator", + "Error", "Function", "Global", "Image", "Math", "Number", "Object", + "RegExp", "String", "VBArray", "window", "document", "event", + "arguments", "call", "toString", "$wnd", "$doc", "$moduleName"}; for (int i = 0; i < commonBuiltins.length; i++) { String ident = commonBuiltins[i]; @@ -94,7 +96,4 @@ } } - private final JsProgram program; - private final Map/* <String, JsUnobfuscatableName> */unobfuscatableNames = new HashMap(); - }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java b/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java index 1835b12..50e24cb 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java
@@ -22,17 +22,17 @@ /** * A scope is a factory for creating and allocating - * {@link com.google.gwt.compiler.jjs.jsc.JsName}s. A JavaScript AST is built in - * terms of abstract name objects without worrying about obfuscation, + * {@link com.google.gwt.compiler.jjs.jsc.JsName}s. A JavaScript AST is built + * in terms of abstract name objects without worrying about obfuscation, * keyword/identifier blacklisting, and so on. * * <p> * - * Scopes are associated with {@link com.google.gwt.dev.js.ast.JsFunction}s, but - * the two are not equivalent. Functions <i>have</i> scopes, but a scope does - * not necessarily have an associated Function. Examples of this include the - * {@link com.google.gwt.dev.js.ast.JsRootScope} and synthetic scopes that might - * be created by a client. + * Scopes are associated with {@link com.google.gwt.dev.js.ast.JsFunction}s, + * but the two are not equivalent. Functions <i>have</i> scopes, but a scope + * does not necessarily have an associated Function. Examples of this include + * the {@link com.google.gwt.dev.js.ast.JsRootScope} and synthetic scopes that + * might be created by a client. * * <p> * @@ -47,6 +47,14 @@ */ public class JsScope { + private final List/* <JsScope> */children = new ArrayList(); + + private String description; + + private final Map/* <String, JsObfuscatableName> */obfuscatableNames = new HashMap(); + + private final JsScope parent; + /** * Create a scope with parent. */ @@ -149,8 +157,8 @@ } else { if (!name.getShortIdent().equals(shortIdent)) { throw new IllegalArgumentException("Requested short name " + shortIdent - + " conflicts with preexisting short name " + name.getShortIdent() - + " for identifier " + ident); + + " conflicts with preexisting short name " + name.getShortIdent() + + " for identifier " + ident); } } return name; @@ -195,9 +203,4 @@ return description; } - private final List/* <JsScope> */children = new ArrayList(); - private String description; - private final Map/* <String, JsObfuscatableName> */obfuscatableNames = new HashMap(); - private final JsScope parent; - }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java index 1ba46ba..760a48c 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java
@@ -20,23 +20,23 @@ */ public final class JsStringLiteral extends JsExpression { + private final String value; + // These only get created by JsProgram so that they can be interned. JsStringLiteral(String value) { this.value = value; } - - public boolean isLeaf() { - return true; - } public String getValue() { return value; } + public boolean isLeaf() { + return true; + } + public void traverse(JsVisitor v) { v.visit(this); v.endVisit(this); } - - private final String value; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsSwitch.java b/dev/core/src/com/google/gwt/dev/js/ast/JsSwitch.java index f093538..b5f82ed 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsSwitch.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsSwitch.java
@@ -20,17 +20,21 @@ */ public class JsSwitch extends JsStatement { - public JsSwitch() { - } + private final JsSwitchMembers cases = new JsSwitchMembers(); - public JsExpression getExpr() { - return expr; + private JsExpression expr; + + public JsSwitch() { } public JsSwitchMembers getCases() { return cases; } + public JsExpression getExpr() { + return expr; + } + public void setExpr(JsExpression expr) { this.expr = expr; } @@ -42,7 +46,4 @@ } v.endVisit(this); } - - private final JsSwitchMembers cases = new JsSwitchMembers(); - private JsExpression expr; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsSwitchMember.java b/dev/core/src/com/google/gwt/dev/js/ast/JsSwitchMember.java index c7302f7e..b90b51c 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsSwitchMember.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsSwitchMember.java
@@ -20,10 +20,10 @@ */ public abstract class JsSwitchMember extends JsNode { + protected final JsStatements stmts = new JsStatements(); + public JsStatements getStmts() { return stmts; } - protected final JsStatements stmts = new JsStatements(); - }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsThrow.java b/dev/core/src/com/google/gwt/dev/js/ast/JsThrow.java index ad4a205..3ab1b62 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsThrow.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsThrow.java
@@ -20,6 +20,8 @@ */ public class JsThrow extends JsStatement { + private JsExpression expr; + public JsThrow() { } @@ -41,6 +43,4 @@ } v.endVisit(this); } - - private JsExpression expr; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsTry.java b/dev/core/src/com/google/gwt/dev/js/ast/JsTry.java index d0ea653..9fb03e3 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsTry.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsTry.java
@@ -20,27 +20,33 @@ */ public class JsTry extends JsStatement { + private final JsCatches catches = new JsCatches(); + + private JsBlock finallyBlock; + + private JsBlock tryBlock; + public JsTry() { } - public JsBlock getTryBlock() { - return tryBlock; - } - - public void setTryBlock(JsBlock block) { - tryBlock = block; - } - public JsCatches getCatches() { return catches; } + public JsBlock getFinallyBlock() { + return finallyBlock; + } + + public JsBlock getTryBlock() { + return tryBlock; + } + public void setFinallyBlock(JsBlock block) { this.finallyBlock = block; } - public JsBlock getFinallyBlock() { - return finallyBlock; + public void setTryBlock(JsBlock block) { + tryBlock = block; } public void traverse(JsVisitor v) { @@ -53,8 +59,4 @@ } v.endVisit(this); } - - private final JsCatches catches = new JsCatches(); - private JsBlock finallyBlock; - private JsBlock tryBlock; }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsVars.java b/dev/core/src/com/google/gwt/dev/js/ast/JsVars.java index 1743e93..e4c418f 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsVars.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsVars.java
@@ -29,6 +29,10 @@ */ public static class JsVar implements HasName { + private JsExpression initExpr; + + private final JsName name; + public JsVar(JsName name) { this.name = name; } @@ -44,11 +48,10 @@ public void setInitExpr(JsExpression initExpr) { this.initExpr = initExpr; } - - private JsExpression initExpr; - private final JsName name; } + private final List vars = new ArrayList(); + public JsVars() { } @@ -73,6 +76,4 @@ } v.endVisit(this); } - - private final List vars = new ArrayList(); }
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsWhile.java b/dev/core/src/com/google/gwt/dev/js/ast/JsWhile.java index 57256cb..8ed883b 100644 --- a/dev/core/src/com/google/gwt/dev/js/ast/JsWhile.java +++ b/dev/core/src/com/google/gwt/dev/js/ast/JsWhile.java
@@ -20,6 +20,10 @@ */ public class JsWhile extends JsStatement { + private JsStatement body; + + private JsExpression condition; + public JsWhile() { } @@ -51,7 +55,4 @@ } v.endVisit(this); } - - private JsStatement body; - private JsExpression condition; }