<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#copied {background-color:#ccccff;}
tr.alt #copied {background-color:#bbbbf7;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="5">Commit in <b><tt>metaas/trunk/src</tt></b></td></tr>
<tr><td><tt>main/java/uk/co/badgersinfoil/metaas/dom/<a href="#file1">StatementContainer.java</a></tt> </td><td></td><td align="right" id="added">+13</td><td></td><td nowrap="nowrap" align="center">537 -> 538</td></tr>
<tr class="alt"><td><tt>main/java/uk/co/badgersinfoil/metaas/impl/<a href="#file2">ASTASMethod.java</a></tt> </td><td></td><td align="right" id="added">+39</td><td></td><td nowrap="nowrap" align="center">537 -> 538</td></tr>
<tr><td><tt> /<a href="#file3">ASTBuilder.java</a></tt> </td><td></td><td align="right" id="added">+69</td><td align="right" id="removed">-14</td><td nowrap="nowrap" align="center">537 -> 538</td></tr>
<tr class="alt"><td><tt> /<a href="#file4">ASTStatementList.java</a></tt> </td><td></td><td align="right" id="added">+74</td><td></td><td nowrap="nowrap" align="center">537 -> 538</td></tr>
<tr><td><tt> /<a href="#file5">ContainerDelegate.java</a></tt> </td><td></td><td align="right" id="added">+40</td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center">537 -> 538</td></tr>
<tr class="alt"><td><tt>test/java/uk/co/badgersinfoil/metaas/<a href="#file6">StatementTests.java</a></tt> </td><td></td><td align="right" id="added">+11</td><td align="right" id="removed">-2</td><td nowrap="nowrap" align="center">537 -> 538</td></tr>
<tr><td></td><td></td><td align="right" id="added">+246</td><td align="right" id="removed">-17</td><td></td></tr>
</table>
<small id="info">6 modified files</small><br />
<pre class="comment">
Allow the construction of statements using ASExpression instances, as well as using Strings
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">metaas/trunk/src/main/java/uk/co/badgersinfoil/metaas/dom</span><br />
<div class="fileheader"><big><b>StatementContainer.java</b></big> <small id="info">537 -> 538</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/StatementContainer.java        2007-10-06 23:15:46 UTC (rev 537)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/StatementContainer.java        2007-10-06 23:17:58 UTC (rev 538)
@@ -32,6 +32,8 @@
</small></pre><pre class="diff" id="context">          */
        public ASExpressionStatement newExprStmt(String expr);
</pre><pre class="diff" id="added">+        public ASExpressionStatement newExprStmt(ASExpression expr);
+
</pre><pre class="diff" id="context">         /**
         * Adds a single-line comment to list of statements being generated
         *
</pre><pre class="diff"><small id="info">@@ -50,6 +52,7 @@
</small></pre><pre class="diff" id="context">          * }</pre>
         */
        public ASIfStatement newIf(String condition);
</pre><pre class="diff" id="added">+        public ASIfStatement newIf(ASExpression condition);
</pre><pre class="diff" id="context">
        /**
         * Adds a C-style for-loop to the code. e.g.
</pre><pre class="diff"><small id="info">@@ -61,6 +64,7 @@
</small></pre><pre class="diff" id="context">          * }</pre>
         */
        public ASForStatement newFor(String init, String condition, String update);
</pre><pre class="diff" id="added">+        public ASForStatement newFor(ASExpression init, ASExpression condition, ASExpression update);
</pre><pre class="diff" id="context">
        /**
         * Adds a for-in-loop to the code. e.g.
</pre><pre class="diff"><small id="info">@@ -72,8 +76,10 @@
</small></pre><pre class="diff" id="context">          * }</pre>
         */
        public ASForInStatement newForIn(String init, String list);
</pre><pre class="diff" id="added">+        public ASForInStatement newForIn(ASExpression init, ASExpression list);
</pre><pre class="diff" id="context">
        public ASForEachInStatement newForEachIn(String init, String list);
</pre><pre class="diff" id="added">+        public ASForEachInStatement newForEachIn(ASExpression init, ASExpression list);
</pre><pre class="diff" id="context">
        /**
         * Adds a while-loop to the code. e.g.
</pre><pre class="diff"><small id="info">@@ -85,6 +91,7 @@
</small></pre><pre class="diff" id="context">          * }</pre>
         */
        public ASWhileStatement newWhile(String condition);
</pre><pre class="diff" id="added">+        public ASWhileStatement newWhile(ASExpression condition);
</pre><pre class="diff" id="context">
        /**
         * Adds a do-while-loop to the code. e.g.
</pre><pre class="diff"><small id="info">@@ -96,12 +103,14 @@
</small></pre><pre class="diff" id="context">          * } while (test());</pre>
         */
        public ASDoWhileStatement newDoWhile(String condition);
</pre><pre class="diff" id="added">+        public ASDoWhileStatement newDoWhile(ASExpression condition);
</pre><pre class="diff" id="context">
        /**
         * Adds a switch-statement to the code. See {@link ASSwitchStatement}
         * for more information.
         */
        public ASSwitchStatement newSwitch(String condition);
</pre><pre class="diff" id="added">+        public ASSwitchStatement newSwitch(ASExpression condition);
</pre><pre class="diff" id="context">
        /**
         * Adds a new with-statement to the code, and returns a reference to
</pre><pre class="diff"><small id="info">@@ -113,6 +122,7 @@
</small></pre><pre class="diff" id="context">          * }</pre>
         */
        public ASWithStatement newWith(String string);
</pre><pre class="diff" id="added">+        public ASWithStatement newWith(ASExpression string);
</pre><pre class="diff" id="context">
        /**
         * Adds a new variable declaration to the code, and returns a reference
</pre><pre class="diff"><small id="info">@@ -122,6 +132,7 @@
</small></pre><pre class="diff" id="context">          * <pre class="eg">var a=1;</pre>
         */
        public ASDeclarationStatement newDeclaration(String assignment);
</pre><pre class="diff" id="added">+        public ASDeclarationStatement newDeclaration(ASExpression assignment);
</pre><pre class="diff" id="context">
        /**
         * Adds a new return-statement to the code (with optional return
</pre><pre class="diff"><small id="info">@@ -135,6 +146,8 @@
</small></pre><pre class="diff" id="context">          * <pre class="eg">return theVal();</pre>
         */
        public ASReturnStatement newReturn(String expr);
</pre><pre class="diff" id="added">+        public ASReturnStatement newReturn(ASExpression expr);
+        public ASReturnStatement newReturn();
</pre><pre class="diff" id="context">
        /**
         * Returns true if if this container currently contains at
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname">metaas/trunk/src/main/java/uk/co/badgersinfoil/metaas/impl</span><br />
<div class="fileheader"><big><b>ASTASMethod.java</b></big> <small id="info">537 -> 538</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASMethod.java        2007-10-06 23:15:46 UTC (rev 537)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASMethod.java        2007-10-06 23:17:58 UTC (rev 538)
@@ -12,8 +12,10 @@
</small></pre><pre class="diff" id="context"> import org.asdt.core.internal.antlr.AS3Parser;
import uk.co.badgersinfoil.metaas.SyntaxException;
import uk.co.badgersinfoil.metaas.dom.ASArg;
</pre><pre class="diff" id="added">+import uk.co.badgersinfoil.metaas.dom.ASBinaryExpression;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASDeclarationStatement;
import uk.co.badgersinfoil.metaas.dom.ASDoWhileStatement;
</pre><pre class="diff" id="added">+import uk.co.badgersinfoil.metaas.dom.ASExpression;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASExpressionStatement;
import uk.co.badgersinfoil.metaas.dom.ASForEachInStatement;
import uk.co.badgersinfoil.metaas.dom.ASForInStatement;
</pre><pre class="diff"><small id="info">@@ -96,6 +98,9 @@
</small></pre><pre class="diff" id="context">         public ASExpressionStatement newExprStmt(String expr) {
                return stmtList.newExprStmt(expr);
        }
</pre><pre class="diff" id="added">+        public ASExpressionStatement newExprStmt(ASExpression expr) {
+                return stmtList.newExprStmt(expr);
+        }
</pre><pre class="diff" id="context">
        private LinkedListTree findParams() {
                return ASTUtils.findChildByType(ast, AS3Parser.PARAMS);
</pre><pre class="diff"><small id="info">@@ -211,42 +216,76 @@
</small></pre><pre class="diff" id="context">         public ASIfStatement newIf(String condition) {
                return stmtList.newIf(condition);
        }
</pre><pre class="diff" id="added">+        public ASIfStatement newIf(ASExpression condition) {
+                return stmtList.newIf(condition);
+        }
</pre><pre class="diff" id="context">
        public ASForStatement newFor(String init, String condition, String update) {
                return stmtList.newFor(init, condition, update);
        }
</pre><pre class="diff" id="added">+        public ASForStatement newFor(ASExpression init, ASExpression condition, ASExpression update) {
+                return stmtList.newFor(init, condition, update);
+        }
</pre><pre class="diff" id="context">
        public ASForInStatement newForIn(String init, String list) {
                return stmtList.newForIn(init, list);
        }
</pre><pre class="diff" id="added">+        public ASForInStatement newForIn(ASExpression init, ASExpression list) {
+                return stmtList.newForIn(init, list);
+        }
</pre><pre class="diff" id="context">
        public ASForEachInStatement newForEachIn(String init, String list) {
                return stmtList.newForEachIn(init, list);
        }
</pre><pre class="diff" id="added">+        public ASForEachInStatement newForEachIn(ASExpression init, ASExpression list) {
+                return stmtList.newForEachIn(init, list);
+        }
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context">         public ASWhileStatement newWhile(String condition) {
                return stmtList.newWhile(condition);
        }
</pre><pre class="diff" id="added">+        public ASWhileStatement newWhile(ASExpression condition) {
+                return stmtList.newWhile(condition);
+        }
</pre><pre class="diff" id="context">
        public ASDoWhileStatement newDoWhile(String condition) {
                return stmtList.newDoWhile(condition);
        }
</pre><pre class="diff" id="added">+        public ASDoWhileStatement newDoWhile(ASExpression condition) {
+                return stmtList.newDoWhile(condition);
+        }
</pre><pre class="diff" id="context">
        public ASSwitchStatement newSwitch(String condition) {
                return stmtList.newSwitch(condition);
        }
</pre><pre class="diff" id="added">+        public ASSwitchStatement newSwitch(ASExpression condition) {
+                return stmtList.newSwitch(condition);
+        }
</pre><pre class="diff" id="context">
        public ASWithStatement newWith(String expr) {
                return stmtList.newWith(expr);
        }
</pre><pre class="diff" id="added">+        public ASWithStatement newWith(ASExpression expr) {
+                return stmtList.newWith(expr);
+        }
</pre><pre class="diff" id="context">
        public ASDeclarationStatement newDeclaration(String assignment) {
                return stmtList.newDeclaration(assignment);
        }
</pre><pre class="diff" id="added">+        public ASDeclarationStatement newDeclaration(ASExpression assignment) {
+                return stmtList.newDeclaration(assignment);
+        }
</pre><pre class="diff" id="context">
        public ASReturnStatement newReturn(String expr) {
                return stmtList.newReturn(expr);
        }
</pre><pre class="diff" id="added">+        public ASReturnStatement newReturn(ASExpression expr) {
+                return stmtList.newReturn(expr);
+        }
+        public ASReturnStatement newReturn() {
+                return stmtList.newReturn();
+        }
</pre><pre class="diff" id="context">
        public boolean containsCode() {
                return stmtList.containsCode();
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname">metaas/trunk/src/main/java/uk/co/badgersinfoil/metaas/impl</span><br />
<div class="fileheader"><big><b>ASTBuilder.java</b></big> <small id="info">537 -> 538</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTBuilder.java        2007-10-06 23:15:46 UTC (rev 537)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTBuilder.java        2007-10-06 23:17:58 UTC (rev 538)
@@ -26,6 +26,13 @@
</small></pre><pre class="diff" id="context">                 // hide default ctor
        }
</pre><pre class="diff" id="added">+        public static LinkedListTree newExprStmt(LinkedListTree expr) {
+                LinkedListTree exprStmt = ASTUtils.newImaginaryAST(AS3Parser.EXPR_STMNT);
+                exprStmt.addChildWithTokens(expr);
+                exprStmt.appendToken(TokenBuilder.newSemi());
+                return exprStmt;
+        }
+
</pre><pre class="diff" id="context">         public static AS3ASTCompilationUnit synthesizeClass(String qualifiedName) {
                LinkedListTree unit = ASTUtils.newImaginaryAST(AS3Parser.COMPILATION_UNIT);
                LinkedListTree pkg = ASTUtils.newAST(AS3Parser.PACKAGE, "package");
</pre><pre class="diff"><small id="info">@@ -197,22 +204,41 @@
</small></pre><pre class="diff" id="context">                 ast.addChildWithTokens(ASTUtils.newAST(AS3Parser.IDENT, name));
                return ast;
        }
</pre><pre class="diff" id="removed">-        
</pre><pre class="diff" id="added">+
+        /**
+         * returns a CONDITION node with the given expression as its child
+         */
+        private static LinkedListTree condition(LinkedListTree expr) {
+                LinkedListTree cond = ASTUtils.newParentheticAST(AS3Parser.CONDITION,
+                 AS3Parser.LPAREN, "(",
+                 AS3Parser.RPAREN, ")");
+                cond.addChildWithTokens(expr);
+                return cond;
+        }
+
</pre><pre class="diff" id="context">         public static LinkedListTree newIf(String condition) {
</pre><pre class="diff" id="added">+                return newIf(AS3FragmentParser.parseExpr(condition));
+        }
+        public static LinkedListTree newIf(LinkedListTree condition) {
</pre><pre class="diff" id="context">                 LinkedListTree ifStmt = ASTUtils.newAST(AS3Parser.IF, "if");
                ifStmt.appendToken(TokenBuilder.newSpace());
</pre><pre class="diff" id="removed">-                ifStmt.addChildWithTokens(<span id="removedchars">AS3FragmentParser.parseC</span>ondition(condition));
</pre><pre class="diff" id="added">+                ifStmt.addChildWithTokens(<span id="addedchars">c</span>ondition(condition));
</pre><pre class="diff" id="context">                 ifStmt.appendToken(TokenBuilder.newSpace());
                ifStmt.addChildWithTokens(ASTBuilder.newBlock());
                return ifStmt;
        }
        public static LinkedListTree newFor(String init, String condition, String iterate) {
</pre><pre class="diff" id="added">+                return newFor(init==null ? null : AS3FragmentParser.parseForInit(init),
+                 condition==null ? null : AS3FragmentParser.parseForCond(condition),
+                 iterate==null ? null : AS3FragmentParser.parseForIter(iterate));
+        }
+        public static LinkedListTree newFor(LinkedListTree init, LinkedListTree condition, LinkedListTree iterate) {
</pre><pre class="diff" id="context">                 LinkedListTree forStmt = ASTUtils.newAST(AS3Parser.FOR, "for");
                forStmt.appendToken(TokenBuilder.newSpace());
                forStmt.appendToken(TokenBuilder.newLParen());
                if (init != null) {
</pre><pre class="diff" id="removed">-                        forStmt.addChildWithTokens(AS3FragmentParser.parseForInit(init));
</pre><pre class="diff" id="added">+                        forStmt.addChildWithTokens(init);
</pre><pre class="diff" id="context">                 } else {
                        LinkedListTree initStmt = ASTUtils.newPlaceholderAST(AS3Parser.FOR_INIT);
                        forStmt.addChildWithTokens(initStmt);
</pre><pre class="diff"><small id="info">@@ -220,7 +246,7 @@
</small></pre><pre class="diff" id="context">                 forStmt.appendToken(TokenBuilder.newSemi());
                forStmt.appendToken(TokenBuilder.newSpace());
                if (condition != null) {
</pre><pre class="diff" id="removed">-                        forStmt.addChildWithTokens(AS3FragmentParser.parseForCond(condition));
</pre><pre class="diff" id="added">+                        forStmt.addChildWithTokens(condition);
</pre><pre class="diff" id="context">                 } else {
                        LinkedListTree condStmt = ASTUtils.newPlaceholderAST(AS3Parser.FOR_CONDITION);
                        forStmt.addChildWithTokens(condStmt);
</pre><pre class="diff"><small id="info">@@ -228,7 +254,7 @@
</small></pre><pre class="diff" id="context">                 forStmt.appendToken(TokenBuilder.newSemi());
                forStmt.appendToken(TokenBuilder.newSpace());
                if (iterate != null) {
</pre><pre class="diff" id="removed">-                        forStmt.addChildWithTokens(AS3FragmentParser.parseForIter(iterate));
</pre><pre class="diff" id="added">+                        forStmt.addChildWithTokens(iterate);
</pre><pre class="diff" id="context">                 } else {
                        LinkedListTree iterStmt = ASTUtils.newPlaceholderAST(AS3Parser.FOR_ITERATOR);
                        forStmt.addChildWithTokens(iterStmt);
</pre><pre class="diff"><small id="info">@@ -238,6 +264,10 @@
</small></pre><pre class="diff" id="context">         }
        public static LinkedListTree newForIn(String declaration, String expression) {
</pre><pre class="diff" id="added">+                return newForIn(AS3FragmentParser.parseForInVar(declaration),
+                 AS3FragmentParser.parseExpr(expression));
+        }
+        public static LinkedListTree newForIn(LinkedListTree declaration, LinkedListTree expression) {
</pre><pre class="diff" id="context">                 LinkedListTree forStmt = ASTUtils.newAST(AS3Parser.FOR_IN, "for");
                forStmt.appendToken(TokenBuilder.newSpace());
                genForInSetup(forStmt, declaration, expression);
</pre><pre class="diff"><small id="info">@@ -245,6 +275,10 @@
</small></pre><pre class="diff" id="context">         }
        public static LinkedListTree newForEachIn(String declaration, String expression) {
</pre><pre class="diff" id="added">+                return newForEachIn(AS3FragmentParser.parseForInVar(declaration),
+                 AS3FragmentParser.parseExpr(expression));
+        }
+        public static LinkedListTree newForEachIn(LinkedListTree declaration, LinkedListTree expression) {
</pre><pre class="diff" id="context">                 LinkedListTree forStmt = ASTUtils.newAST(AS3Parser.FOR_EACH, "for");
                forStmt.appendToken(TokenBuilder.newSpace());
                forStmt.appendToken(TokenBuilder.newEach());
</pre><pre class="diff"><small id="info">@@ -255,24 +289,33 @@
</small></pre><pre class="diff" id="context">         /**
         * Common code for both for-in and for-each-in loop setup
         */
</pre><pre class="diff" id="removed">-        private static void genForInSetup(LinkedListTree forStmt, String declaration, String expression) {
</pre><pre class="diff" id="added">+        private static void genForInSetup(LinkedListTree forStmt,
+         LinkedListTree declaration,
+         LinkedListTree expression)
+        {
</pre><pre class="diff" id="context">                 forStmt.appendToken(TokenBuilder.newLParen());
</pre><pre class="diff" id="removed">-                forStmt.addChildWithTokens(AS3FragmentParser.parseForInVar(declaration));
</pre><pre class="diff" id="added">+                forStmt.addChildWithTokens(declaration);
</pre><pre class="diff" id="context">                 forStmt.appendToken(TokenBuilder.newSpace());
                forStmt.appendToken(TokenBuilder.newIn());
                forStmt.appendToken(TokenBuilder.newSpace());
</pre><pre class="diff" id="removed">-                forStmt.addChildWithTokens(AS3FragmentParser.parseExpr(expression));
</pre><pre class="diff" id="added">+                forStmt.addChildWithTokens(expression);
</pre><pre class="diff" id="context">                 forStmt.appendToken(TokenBuilder.newRParen());
        }
        public static LinkedListTree newWhile(String condition) {
</pre><pre class="diff" id="added">+                return newWhile(AS3FragmentParser.parseExpr(condition));
+        }
+        public static LinkedListTree newWhile(LinkedListTree condition) {
</pre><pre class="diff" id="context">                 LinkedListTree whileStmt = ASTUtils.newAST(AS3Parser.WHILE, "while");
                whileStmt.appendToken(TokenBuilder.newSpace());
</pre><pre class="diff" id="removed">-                whileStmt.addChildWithTokens(<span id="removedchars">AS3FragmentParser.parseC</span>ondition(condition));
</pre><pre class="diff" id="added">+                whileStmt.addChildWithTokens(<span id="addedchars">c</span>ondition(condition));
</pre><pre class="diff" id="context">                 return whileStmt;
        }
        public static LinkedListTree newDoWhile(String condition) {
</pre><pre class="diff" id="added">+                return newDoWhile(AS3FragmentParser.parseExpr(condition));
+        }
+        public static LinkedListTree newDoWhile(LinkedListTree condition) {
</pre><pre class="diff" id="context">                 LinkedListTree doWhileStmt = ASTUtils.newAST(AS3Parser.DO, "do");
                doWhileStmt.appendToken(TokenBuilder.newSpace());
                LinkedListTree block = ASTBuilder.newBlock();
</pre><pre class="diff"><small id="info">@@ -280,15 +323,18 @@
</small></pre><pre class="diff" id="context">                 doWhileStmt.appendToken(TokenBuilder.newSpace());
                doWhileStmt.appendToken(TokenBuilder.newWhile());
                doWhileStmt.appendToken(TokenBuilder.newSpace());
</pre><pre class="diff" id="removed">-                doWhileStmt.addChildWithTokens(<span id="removedchars">AS3FragmentParser.parseC</span>ondition(condition));
</pre><pre class="diff" id="added">+                doWhileStmt.addChildWithTokens(<span id="addedchars">c</span>ondition(condition));
</pre><pre class="diff" id="context">                 doWhileStmt.appendToken(TokenBuilder.newSemi());
                return doWhileStmt;
        }
        public static LinkedListTree newSwitch(String condition) {
</pre><pre class="diff" id="added">+                return newSwitch(AS3FragmentParser.parseExpr(condition));
+        }
+        public static LinkedListTree newSwitch(LinkedListTree condition) {
</pre><pre class="diff" id="context">                 LinkedListTree switchStmt = ASTUtils.newAST(AS3Parser.SWITCH, "switch");
                switchStmt.appendToken(TokenBuilder.newSpace());
</pre><pre class="diff" id="removed">-                switchStmt.addChildWithTokens(<span id="removedchars">AS3FragmentParser.parseC</span>ondition(condition));
</pre><pre class="diff" id="added">+                switchStmt.addChildWithTokens(<span id="addedchars">c</span>ondition(condition));
</pre><pre class="diff" id="context">                 switchStmt.appendToken(TokenBuilder.newSpace());
                LinkedListTree block = ASTBuilder.newBlock();
                switchStmt.addChildWithTokens(block);
</pre><pre class="diff"><small id="info">@@ -296,25 +342,34 @@
</small></pre><pre class="diff" id="context">         }
        public static LinkedListTree newWith(String expr) {
</pre><pre class="diff" id="added">+                return newWith(AS3FragmentParser.parseExpr(expr));
+        }
+        public static LinkedListTree newWith(LinkedListTree expr) {
</pre><pre class="diff" id="context">                 LinkedListTree withStmt = ASTUtils.newAST(AS3Parser.WITH, "with");
                withStmt.appendToken(TokenBuilder.newSpace());
</pre><pre class="diff" id="removed">-                withStmt.addChildWithTokens(<span id="removedchars">AS3FragmentParser.parseC</span>ondition(expr));
</pre><pre class="diff" id="added">+                withStmt.addChildWithTokens(<span id="addedchars">c</span>ondition(expr));
</pre><pre class="diff" id="context">                 return withStmt;
        }
        public static LinkedListTree newDeclaration(String assignment) {
</pre><pre class="diff" id="added">+                return newDeclaration(AS3FragmentParser.parseVariableDeclarator(assignment));
+        }
+        public static LinkedListTree newDeclaration(LinkedListTree assignment) {
</pre><pre class="diff" id="context">                 LinkedListTree declStmt = ASTUtils.newAST(AS3Parser.VAR, "var");
                declStmt.appendToken(TokenBuilder.newSpace());
</pre><pre class="diff" id="removed">-                declStmt.addChildWithTokens(AS3FragmentParser.parseVariableDeclarator(assignment));
</pre><pre class="diff" id="added">+                declStmt.addChildWithTokens(assignment);
</pre><pre class="diff" id="context">                 declStmt.appendToken(TokenBuilder.newSemi());
                return declStmt;
        }
        public static LinkedListTree newReturn(String expr) {
</pre><pre class="diff" id="added">+                return newReturn(expr==null ? null : AS3FragmentParser.parseExpr(expr));
+        }
+        public static LinkedListTree newReturn(LinkedListTree expr) {
</pre><pre class="diff" id="context">                 LinkedListTree returnStmt = ASTUtils.newAST(AS3Parser.RETURN, "return");
                if (expr != null) {
                        returnStmt.appendToken(TokenBuilder.newSpace());
</pre><pre class="diff" id="removed">-                        returnStmt.addChildWithTokens(AS3FragmentParser.parseExpr(expr));
</pre><pre class="diff" id="added">+                        returnStmt.addChildWithTokens(expr);
</pre><pre class="diff" id="context">                 }
                returnStmt.appendToken(TokenBuilder.newSemi());
                return returnStmt;
</pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname">metaas/trunk/src/main/java/uk/co/badgersinfoil/metaas/impl</span><br />
<div class="fileheader"><big><b>ASTStatementList.java</b></big> <small id="info">537 -> 538</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTStatementList.java        2007-10-06 23:15:46 UTC (rev 537)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTStatementList.java        2007-10-06 23:17:58 UTC (rev 538)
@@ -13,6 +13,7 @@
</small></pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASBlock;
import uk.co.badgersinfoil.metaas.dom.ASDeclarationStatement;
import uk.co.badgersinfoil.metaas.dom.ASDoWhileStatement;
</pre><pre class="diff" id="added">+import uk.co.badgersinfoil.metaas.dom.ASExpression;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASExpressionStatement;
import uk.co.badgersinfoil.metaas.dom.ASForEachInStatement;
import uk.co.badgersinfoil.metaas.dom.ASForInStatement;
</pre><pre class="diff"><small id="info">@@ -50,6 +51,11 @@
</small></pre><pre class="diff" id="context">                 addStatement(stmt);
                return new ASTASExpressionStatement(stmt);
        }
</pre><pre class="diff" id="added">+        public ASExpressionStatement newExprStmt(ASExpression expr) {
+                LinkedListTree stmt = ASTBuilder.newExprStmt(ast(expr));
+                addStatement(stmt);
+                return new ASTASExpressionStatement(stmt);
+        }
</pre><pre class="diff" id="context">
        public void addComment(String text) {
                LinkedListToken comment = TokenBuilder.newSLComment("//" + text);
</pre><pre class="diff"><small id="info">@@ -75,6 +81,11 @@
</small></pre><pre class="diff" id="context">                 addStatement(ifStmt);
                return new ASTASIfStatement(ifStmt);
        }
</pre><pre class="diff" id="added">+        public ASIfStatement newIf(ASExpression condition) {
+                LinkedListTree ifStmt = ASTBuilder.newIf(ast(condition));
+                addStatement(ifStmt);
+                return new ASTASIfStatement(ifStmt);
+        }
</pre><pre class="diff" id="context">
        public ASForStatement newFor(String init, String condition, String iterate) {
                LinkedListTree forStmt = ASTBuilder.newFor(init, condition, iterate);
</pre><pre class="diff"><small id="info">@@ -82,6 +93,14 @@
</small></pre><pre class="diff" id="context">                 addStatement(forStmt);
                return new ASTASForStatement(forStmt);
        }
</pre><pre class="diff" id="added">+        public ASForStatement newFor(ASExpression init, ASExpression condition, ASExpression iterate) {
+                LinkedListTree forStmt = ASTBuilder.newFor(ast(init),
+                 ast(condition),
+                 ast(iterate));
+                appendBlock(forStmt);
+                addStatement(forStmt);
+                return new ASTASForStatement(forStmt);
+        }
</pre><pre class="diff" id="context">
        public ASForInStatement newForIn(String declaration, String expression) {
                LinkedListTree forStmt = ASTBuilder.newForIn(declaration, expression);
</pre><pre class="diff"><small id="info">@@ -89,6 +108,13 @@
</small></pre><pre class="diff" id="context">                 addStatement(forStmt);
                return new ASTASForInStatement(forStmt);
        }
</pre><pre class="diff" id="added">+        public ASForInStatement newForIn(ASExpression declaration, ASExpression expression) {
+                LinkedListTree forStmt = ASTBuilder.newForIn(ast(declaration),
+                 ast(expression));
+                appendBlock(forStmt);
+                addStatement(forStmt);
+                return new ASTASForInStatement(forStmt);
+        }
</pre><pre class="diff" id="context">
        public ASForEachInStatement newForEachIn(String declaration, String expression) {
                LinkedListTree forStmt = ASTBuilder.newForEachIn(declaration, expression);
</pre><pre class="diff"><small id="info">@@ -96,6 +122,13 @@
</small></pre><pre class="diff" id="context">                 addStatement(forStmt);
                return new ASTASForEachInStatement(forStmt);
        }
</pre><pre class="diff" id="added">+        public ASForEachInStatement newForEachIn(ASExpression declaration, ASExpression expression) {
+                LinkedListTree forStmt = ASTBuilder.newForEachIn(ast(declaration),
+                 ast(expression));
+                appendBlock(forStmt);
+                addStatement(forStmt);
+                return new ASTASForEachInStatement(forStmt);
+        }
</pre><pre class="diff" id="context">
        public ASWhileStatement newWhile(String condition) {
                LinkedListTree whileStmt = ASTBuilder.newWhile(condition);
</pre><pre class="diff"><small id="info">@@ -103,18 +136,34 @@
</small></pre><pre class="diff" id="context">                 addStatement(whileStmt);
                return new ASTASWhileStatement(whileStmt);
        }
</pre><pre class="diff" id="added">+        public ASWhileStatement newWhile(ASExpression condition) {
+                LinkedListTree whileStmt = ASTBuilder.newWhile(ast(condition));
+                appendBlock(whileStmt);
+                addStatement(whileStmt);
+                return new ASTASWhileStatement(whileStmt);
+        }
</pre><pre class="diff" id="context">
        public ASDoWhileStatement newDoWhile(String condition) {
                LinkedListTree doWhileStmt = ASTBuilder.newDoWhile(condition);
                addStatement(doWhileStmt);
                return new ASTASDoWhileStatement(doWhileStmt);
        }
</pre><pre class="diff" id="added">+        public ASDoWhileStatement newDoWhile(ASExpression condition) {
+                LinkedListTree doWhileStmt = ASTBuilder.newDoWhile(ast(condition));
+                addStatement(doWhileStmt);
+                return new ASTASDoWhileStatement(doWhileStmt);
+        }
</pre><pre class="diff" id="context">
        public ASSwitchStatement newSwitch(String condition) {
                LinkedListTree switchStmt = ASTBuilder.newSwitch(condition);
                addStatement(switchStmt);
                return new ASTASSwitchStatement(findBlock(switchStmt));
        }
</pre><pre class="diff" id="added">+        public ASSwitchStatement newSwitch(ASExpression condition) {
+                LinkedListTree switchStmt = ASTBuilder.newSwitch(ast(condition));
+                addStatement(switchStmt);
+                return new ASTASSwitchStatement(findBlock(switchStmt));
+        }
</pre><pre class="diff" id="context">
        public ASWithStatement newWith(String expr) {
                LinkedListTree withStmt = ASTBuilder.newWith(expr);
</pre><pre class="diff"><small id="info">@@ -122,18 +171,39 @@
</small></pre><pre class="diff" id="context">                 addStatement(withStmt);
                return new ASTASWithStatement(withStmt);
        }
</pre><pre class="diff" id="added">+        public ASWithStatement newWith(ASExpression expr) {
+                LinkedListTree withStmt = ASTBuilder.newWith(ast(expr));
+                appendBlock(withStmt);
+                addStatement(withStmt);
+                return new ASTASWithStatement(withStmt);
+        }
</pre><pre class="diff" id="context">
        public ASDeclarationStatement newDeclaration(String assignment) {
                LinkedListTree declStmt = ASTBuilder.newDeclaration(assignment);
                addStatement(declStmt);
                return new ASTASDeclarationStatement(declStmt);
        }
</pre><pre class="diff" id="added">+        public ASDeclarationStatement newDeclaration(ASExpression assignment) {
+                LinkedListTree declStmt = ASTBuilder.newDeclaration(ast(assignment));
+                addStatement(declStmt);
+                return new ASTASDeclarationStatement(declStmt);
+        }
</pre><pre class="diff" id="context">
        public ASReturnStatement newReturn(String expr) {
                LinkedListTree returnStmt = ASTBuilder.newReturn(expr);
                addStatement(returnStmt);
                return new ASTASReturnStatement(returnStmt);
        }
</pre><pre class="diff" id="added">+        public ASReturnStatement newReturn(ASExpression expr) {
+                LinkedListTree returnStmt = ASTBuilder.newReturn(ast(expr));
+                addStatement(returnStmt);
+                return new ASTASReturnStatement(returnStmt);
+        }
+        public ASReturnStatement newReturn() {
+                LinkedListTree returnStmt = ASTBuilder.newReturn((String)null);
+                addStatement(returnStmt);
+                return new ASTASReturnStatement(returnStmt);
+        }
</pre><pre class="diff" id="context">
        private void addStatement(LinkedListTree stmt) {
                ASTUtils.addChildWithIndentation(ast, stmt);
</pre><pre class="diff"><small id="info">@@ -176,4 +246,8 @@
</small></pre><pre class="diff" id="context">                 }
                return Collections.unmodifiableList(result);
        }
</pre><pre class="diff" id="added">+
+        private static LinkedListTree ast(ASExpression condition) {
+                return ((ASTASExpression)condition).getAST();
+        }
</pre><pre class="diff" id="context"> }
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file5" /><div class="file">
<span class="pathname">metaas/trunk/src/main/java/uk/co/badgersinfoil/metaas/impl</span><br />
<div class="fileheader"><big><b>ContainerDelegate.java</b></big> <small id="info">537 -> 538</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ContainerDelegate.java        2007-10-06 23:15:46 UTC (rev 537)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ContainerDelegate.java        2007-10-06 23:17:58 UTC (rev 538)
@@ -1,8 +1,10 @@
</small></pre><pre class="diff" id="context"> package uk.co.badgersinfoil.metaas.impl;
import java.util.List;
</pre><pre class="diff" id="added">+import uk.co.badgersinfoil.metaas.dom.ASBinaryExpression;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASDeclarationStatement;
import uk.co.badgersinfoil.metaas.dom.ASDoWhileStatement;
</pre><pre class="diff" id="added">+import uk.co.badgersinfoil.metaas.dom.ASExpression;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASExpressionStatement;
import uk.co.badgersinfoil.metaas.dom.ASForEachInStatement;
import uk.co.badgersinfoil.metaas.dom.ASForInStatement;
</pre><pre class="diff"><small id="info">@@ -25,6 +27,9 @@
</small></pre><pre class="diff" id="context">         public ASExpressionStatement newExprStmt(String expr) {
                return getStatementContainer().newExprStmt(expr);
        }
</pre><pre class="diff" id="added">+        public ASExpressionStatement newExprStmt(ASExpression expr) {
+                return getStatementContainer().newExprStmt(expr);
+        }
</pre><pre class="diff" id="context">
        public void addComment(String text) {
                getStatementContainer().addComment(text);
</pre><pre class="diff"><small id="info">@@ -33,42 +38,76 @@
</small></pre><pre class="diff" id="context">         public ASIfStatement newIf(String condition) {
                return getStatementContainer().newIf(condition);
        }
</pre><pre class="diff" id="added">+        public ASIfStatement newIf(ASExpression condition) {
+                return getStatementContainer().newIf(condition);
+        }
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">-        public ASForStatement newFor(String init, String condition,<span id="removedchars">        </span>String update) {
</pre><pre class="diff" id="added">+        public ASForStatement newFor(String init, String condition,<span id="addedchars"> </span>String update) {
</pre><pre class="diff" id="context">                 return getStatementContainer().newFor(init, condition, update);
        }
</pre><pre class="diff" id="added">+        public ASForStatement newFor(ASExpression init, ASExpression condition, ASExpression update) {
+                return getStatementContainer().newFor(init, condition, update);
+        }
</pre><pre class="diff" id="context">
        public ASForInStatement newForIn(String init, String list) {
                return getStatementContainer().newForIn(init, list);
        }
</pre><pre class="diff" id="added">+        public ASForInStatement newForIn(ASExpression init, ASExpression list) {
+                return getStatementContainer().newForIn(init, list);
+        }
</pre><pre class="diff" id="context">
        public ASForEachInStatement newForEachIn(String init, String list) {
                return getStatementContainer().newForEachIn(init, list);
        }
</pre><pre class="diff" id="added">+        public ASForEachInStatement newForEachIn(ASExpression init, ASExpression list) {
+                return getStatementContainer().newForEachIn(init, list);
+        }
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context">         public ASWhileStatement newWhile(String condition) {
                return getStatementContainer().newWhile(condition);
        }
</pre><pre class="diff" id="added">+        public ASWhileStatement newWhile(ASExpression condition) {
+                return getStatementContainer().newWhile(condition);
+        }
</pre><pre class="diff" id="context">
        public ASDoWhileStatement newDoWhile(String condition) {
                return getStatementContainer().newDoWhile(condition);
        }
</pre><pre class="diff" id="added">+        public ASDoWhileStatement newDoWhile(ASExpression condition) {
+                return getStatementContainer().newDoWhile(condition);
+        }
</pre><pre class="diff" id="context">
        public ASSwitchStatement newSwitch(String condition) {
                return getStatementContainer().newSwitch(condition);
        }
</pre><pre class="diff" id="added">+        public ASSwitchStatement newSwitch(ASExpression condition) {
+                return getStatementContainer().newSwitch(condition);
+        }
</pre><pre class="diff" id="context">
        public ASWithStatement newWith(String expr) {
                return getStatementContainer().newWith(expr);
        }
</pre><pre class="diff" id="added">+        public ASWithStatement newWith(ASExpression expr) {
+                return getStatementContainer().newWith(expr);
+        }
</pre><pre class="diff" id="context">
        public ASDeclarationStatement newDeclaration(String assignment) {
                return getStatementContainer().newDeclaration(assignment);
        }
</pre><pre class="diff" id="added">+        public ASDeclarationStatement newDeclaration(ASExpression assignment) {
+                return getStatementContainer().newDeclaration(assignment);
+        }
</pre><pre class="diff" id="context">
        public ASReturnStatement newReturn(String expr) {
                return getStatementContainer().newReturn(expr);
        }
</pre><pre class="diff" id="added">+        public ASReturnStatement newReturn(ASExpression expr) {
+                return getStatementContainer().newReturn(expr);
+        }
+        public ASReturnStatement newReturn() {
+                return getStatementContainer().newReturn();
+        }
</pre><pre class="diff" id="context">
        public boolean containsCode() {
                return getStatementContainer().containsCode();
</pre></div>
<hr /><a name="file6" /><div class="file">
<span class="pathname">metaas/trunk/src/test/java/uk/co/badgersinfoil/metaas</span><br />
<div class="fileheader"><big><b>StatementTests.java</b></big> <small id="info">537 -> 538</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2007-10-06 23:15:46 UTC (rev 537)
+++ trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2007-10-06 23:17:58 UTC (rev 538)
@@ -8,6 +8,7 @@
</small></pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASCompilationUnit;
import uk.co.badgersinfoil.metaas.dom.ASDeclarationStatement;
import uk.co.badgersinfoil.metaas.dom.ASDoWhileStatement;
</pre><pre class="diff" id="added">+import uk.co.badgersinfoil.metaas.dom.ASExpression;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASExpressionStatement;
import uk.co.badgersinfoil.metaas.dom.ASForEachInStatement;
import uk.co.badgersinfoil.metaas.dom.ASForInStatement;
</pre><pre class="diff"><small id="info">@@ -84,7 +85,7 @@
</small></pre><pre class="diff" id="context">         }
        public void testFor() {
</pre><pre class="diff" id="removed">-                ASForStatement forStmt = meth.newFor(null, null, null);
</pre><pre class="diff" id="added">+                ASForStatement forStmt = meth.newFor(<span id="addedchars">(String)</span>null, null, null);
</pre><pre class="diff" id="context">                 forStmt.addStmt("trace(\"forever\")");
                assertNull(forStmt.getInitString());
                assertNull(forStmt.getConditionString());
</pre><pre class="diff"><small id="info">@@ -146,6 +147,14 @@
</small></pre><pre class="diff" id="context">                 assertEquals("a == b", whileStmt.getConditionString());
        }
</pre><pre class="diff" id="added">+        public void testWhileCondition() {
+                ASExpression left = fact.newExpression("a");
+                ASExpression right = fact.newExpression("b");
+                ASWhileStatement whileStmt = meth.newWhile(fact.newAndExpression(left, right));
+                whileStmt.addStmt("trace(result())");
+                assertEquals("a && b", whileStmt.getConditionString());
+        }
+
</pre><pre class="diff" id="context">         public void testDoWhile() {
                ASDoWhileStatement doWhileStmt = meth.newDoWhile("test()");
                doWhileStmt.addStmt("trace(result())");
</pre><pre class="diff"><small id="info">@@ -187,7 +196,7 @@
</small></pre><pre class="diff" id="context">         }
        
        public void testReturn() throws IOException {
</pre><pre class="diff" id="removed">-                ASReturnStatement returnStmt = meth.newReturn(<span id="removedchars">null</span>);
</pre><pre class="diff" id="added">+                ASReturnStatement returnStmt = meth.newReturn();
</pre><pre class="diff" id="context">                 assertNull(returnStmt.getExpressionString());
                returnStmt.setExpression("false");
                assertEquals("false", returnStmt.getExpressionString());
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.12</small></center>
</body></html>