<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">ASForStatement.java</a></tt> </td><td></td><td align="right" id="added">+8</td><td></td><td nowrap="nowrap" align="center">602 -> 603</td></tr>
<tr class="alt"><td><tt>main/java/uk/co/badgersinfoil/metaas/impl/<a href="#file2">ASTASForStatement.java</a></tt> </td><td></td><td align="right" id="added">+42</td><td align="right" id="removed">-2</td><td nowrap="nowrap" align="center">602 -> 603</td></tr>
<tr><td><tt>test/java/uk/co/badgersinfoil/metaas/<a href="#file3">StatementTests.java</a></tt> </td><td></td><td align="right" id="added">+8</td><td align="right" id="removed">-2</td><td nowrap="nowrap" align="center">602 -> 603</td></tr>
<tr><td></td><td></td><td align="right" id="added">+58</td><td align="right" id="removed">-4</td><td></td></tr>
</table>
<small id="info">3 modified files</small><br />
<pre class="comment">
ASExpression support for for-statement
</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>ASForStatement.java</b></big> <small id="info">602 -> 603</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/ASForStatement.java        2008-01-18 23:57:17 UTC (rev 602)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/ASForStatement.java        2008-01-19 00:57:03 UTC (rev 603)
@@ -39,6 +39,8 @@
</small></pre><pre class="diff" id="context">          */
        public String getConditionString();
</pre><pre class="diff" id="added">+        public ASExpression getCondition();
+
</pre><pre class="diff" id="context">         /**
         * Returns a string representation of the loop update expression.
         *
</pre><pre class="diff"><small id="info">@@ -47,6 +49,8 @@
</small></pre><pre class="diff" id="context">          */
        public String getUpdateString();
</pre><pre class="diff" id="added">+        public ASExpression getUpdate();
+
</pre><pre class="diff" id="context">         /**
         * Changes the initialisation expression for this loop.
         *
</pre><pre class="diff"><small id="info">@@ -63,6 +67,8 @@
</small></pre><pre class="diff" id="context">          */
        public void setCondition(String expr);
</pre><pre class="diff" id="added">+        public void setCondition(ASExpression expr);
+
</pre><pre class="diff" id="context">         /**
         * Changes the update expression for this loop.
         *
</pre><pre class="diff"><small id="info">@@ -70,4 +76,6 @@
</small></pre><pre class="diff" id="context">          * string is not a valid ActionScript expression.
         */
        public void setUpdate(String expr);
</pre><pre class="diff" id="added">+
+        public void setUpdate(ASExpression expr);
</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="file2" /><div class="file">
<span class="pathname">metaas/trunk/src/main/java/uk/co/badgersinfoil/metaas/impl</span><br />
<div class="fileheader"><big><b>ASTASForStatement.java</b></big> <small id="info">602 -> 603</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASForStatement.java        2008-01-18 23:57:17 UTC (rev 602)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASForStatement.java        2008-01-19 00:57:03 UTC (rev 603)
@@ -6,6 +6,7 @@
</small></pre><pre class="diff" id="context">
package uk.co.badgersinfoil.metaas.impl;
</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.ASForStatement;
import uk.co.badgersinfoil.metaas.dom.StatementContainer;
import uk.co.badgersinfoil.metaas.impl.antlr.LinkedListTree;
</pre><pre class="diff"><small id="info">@@ -34,16 +35,30 @@
</small></pre><pre class="diff" id="context">                 if (!hasCondition()) {
                        return null;
                }
</pre><pre class="diff" id="removed">-                return ASTUtils.stringifyNode(findCondition());
</pre><pre class="diff" id="added">+                return ASTUtils.stringifyNode(findCondition()<span id="addedchars">.getFirstChild()</span>);
</pre><pre class="diff" id="context">         }
</pre><pre class="diff" id="added">+        public ASExpression getCondition() {
+                if (!hasCondition()) {
+                        return null;
+                }
+                return ExpressionBuilder.build(findCondition().getFirstChild());
+        }
+
</pre><pre class="diff" id="context">         public String getUpdateString() {
                if (!hasUpdate()) {
                        return null;
                }
</pre><pre class="diff" id="removed">-                return ASTUtils.stringifyNode(findUpdate());
</pre><pre class="diff" id="added">+                return ASTUtils.stringifyNode(findUpdate()<span id="addedchars">.getFirstChild()</span>);
</pre><pre class="diff" id="context">         }
</pre><pre class="diff" id="added">+        public ASExpression getUpdate() {
+                if (!hasUpdate()) {
+                        return null;
+                }
+                return ExpressionBuilder.build(findUpdate().getFirstChild());
+        }
+
</pre><pre class="diff" id="context">         private boolean hasCondition() {
                return findCondition().getChildCount() > 0;
        }
</pre><pre class="diff"><small id="info">@@ -85,6 +100,15 @@
</small></pre><pre class="diff" id="context">                 }
        }
</pre><pre class="diff" id="added">+        public void setCondition(ASExpression expr) {
+                LinkedListTree cond = findCondition();
+                if (expr == null) {
+                        deleteAnyChild(cond);
+                } else {
+                        setFirstChild(cond, ast(expr));
+                }
+        }
+
</pre><pre class="diff" id="context">         public void setInit(String expr) {
                if (expr == null) {
                        deleteAnyChild(findInit());
</pre><pre class="diff"><small id="info">@@ -103,9 +127,25 @@
</small></pre><pre class="diff" id="context">                 }
        }
</pre><pre class="diff" id="added">+        public void setUpdate(ASExpression expr) {
+                if (expr == null) {
+                        deleteAnyChild(findUpdate());
+                } else {
+                        setFirstChild(findUpdate(), ast(expr));
+                }
+        }
+
</pre><pre class="diff" id="context">         private void deleteAnyChild(LinkedListTree tree) {
                if (tree.getChildCount() > 0) {
                        tree.deleteChild(0);
                }
        }
</pre><pre class="diff" id="added">+
+        private static void setFirstChild(LinkedListTree parent, LinkedListTree child) {
+                if (parent.getChildCount() == 0) {
+                        parent.addChildWithTokens(child);
+                } else {
+                        parent.setChildWithTokens(0, child);
+                }
+        }
</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="file3" /><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">602 -> 603</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2008-01-18 23:57:17 UTC (rev 602)
+++ trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2008-01-19 00:57:03 UTC (rev 603)
@@ -25,6 +25,7 @@
</small></pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASInvocationExpression;
import uk.co.badgersinfoil.metaas.dom.ASLiteral;
import uk.co.badgersinfoil.metaas.dom.ASMethod;
</pre><pre class="diff" id="added">+import uk.co.badgersinfoil.metaas.dom.ASPostfixExpression;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASReturnStatement;
import uk.co.badgersinfoil.metaas.dom.ASSuperStatement;
import uk.co.badgersinfoil.metaas.dom.ASSwitchCase;
</pre><pre class="diff"><small id="info">@@ -141,6 +142,8 @@
</small></pre><pre class="diff" id="context">                 assertEquals("var j", forStmt.getInitString());
                assertEquals("j<10", forStmt.getConditionString());
                assertEquals("j++", forStmt.getUpdateString());
</pre><pre class="diff" id="added">+                ExtraAssertions.assertInstanceof(forStmt.getCondition(), ASBinaryExpression.class);
+                ExtraAssertions.assertInstanceof(forStmt.getUpdate(), ASPostfixExpression.class);
</pre><pre class="diff" id="context">
                forStmt = meth.newFor("var i", "i<10", "i++");
                forStmt.addStmt("trace(i)");
</pre><pre class="diff"><small id="info">@@ -148,14 +151,17 @@
</small></pre><pre class="diff" id="context">                 assertEquals("i<10", forStmt.getConditionString());
                assertEquals("i++", forStmt.getUpdateString());
                forStmt.setInit(null);
</pre><pre class="diff" id="removed">-                forStmt.setCondition(null);
-                forStmt.setUpdate(null);
</pre><pre class="diff" id="added">+                forStmt.setCondition((String)null);
+                forStmt.setUpdate((String)null);
</pre><pre class="diff" id="context">                 assertNull(forStmt.getInitString());
                assertNull(forStmt.getConditionString());
                assertNull(forStmt.getUpdateString());
                forStmt.setInit("var k=0");
                assertEquals("var k=0", forStmt.getInitString());
</pre><pre class="diff" id="added">+                
+                forStmt.setCondition(fact.newBooleanLiteral(true));
+                forStmt.setUpdate(fact.newExpression("++i"));
</pre><pre class="diff" id="context">         }
        public void testForIn() {
</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>