<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">ASReturnStatement.java</a></tt> </td><td></td><td align="right" id="added">+5</td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center">603 -> 604</td></tr>
<tr class="alt"><td><tt>main/java/uk/co/badgersinfoil/metaas/impl/<a href="#file2">ASTASReturnStatement.java</a></tt> </td><td></td><td align="right" id="added">+30</td><td align="right" id="removed">-3</td><td nowrap="nowrap" align="center">603 -> 604</td></tr>
<tr><td><tt> /<a href="#file3">ASTUtils.java</a></tt> </td><td></td><td align="right" id="added">+5</td><td></td><td nowrap="nowrap" align="center">603 -> 604</td></tr>
<tr class="alt"><td><tt>test/java/uk/co/badgersinfoil/metaas/<a href="#file4">StatementTests.java</a></tt> </td><td></td><td align="right" id="added">+5</td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center">603 -> 604</td></tr>
<tr><td></td><td></td><td align="right" id="added">+45</td><td align="right" id="removed">-5</td><td></td></tr>
</table>
<small id="info">4 modified files</small><br />
<pre class="comment">
ASExpression support in return-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>ASReturnStatement.java</b></big> <small id="info">603 -> 604</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/ASReturnStatement.java        2008-01-19 00:57:03 UTC (rev 603)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/ASReturnStatement.java        2008-01-19 01:09:29 UTC (rev 604)
@@ -27,7 +27,9 @@
</small></pre><pre class="diff" id="context">          * no such expression.
         */
        public String getExpressionString();
</pre><pre class="diff" id="removed">-        
</pre><pre class="diff" id="added">+
+        public ASExpression getExpression();
+
</pre><pre class="diff" id="context">         /**
         * Changes the expression that this statement would return when
         * executed. If null is given, any expression will be removed.
</pre><pre class="diff"><small id="info">@@ -36,4 +38,6 @@
</small></pre><pre class="diff" id="context">          * a valid ActionScript expression.
         */
        public void setExpression(String expr);
</pre><pre class="diff" id="added">+
+        public void setExpression(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>ASTASReturnStatement.java</b></big> <small id="info">603 -> 604</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASReturnStatement.java        2008-01-19 00:57:03 UTC (rev 603)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASReturnStatement.java        2008-01-19 01:09:29 UTC (rev 604)
@@ -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.ASReturnStatement;
import uk.co.badgersinfoil.metaas.impl.antlr.LinkedListToken;
import uk.co.badgersinfoil.metaas.impl.antlr.LinkedListTree;
</pre><pre class="diff"><small id="info">@@ -20,22 +21,44 @@
</small></pre><pre class="diff" id="context">         }
        public String getExpressionString() {
</pre><pre class="diff" id="removed">-                if (ast.getChildCount() == 0) {
</pre><pre class="diff" id="added">+                if (hasExpr()) {
</pre><pre class="diff" id="context">                         return null;
                }
                return ASTUtils.stringifyNode(ast.getFirstChild());
        }
</pre><pre class="diff" id="added">+        public ASExpression getExpression() {
+                if (hasExpr()) {
+                        return null;
+                }
+                return ExpressionBuilder.build(ast.getFirstChild());
+        }
+
</pre><pre class="diff" id="context">         public void setExpression(String expr) {
                if (expr == null) {
</pre><pre class="diff" id="removed">-                        if (ast.getChildCount() == 0) {
</pre><pre class="diff" id="added">+                        if (hasExpr()) {
</pre><pre class="diff" id="context">                                 return;
                        }
                        ast.deleteChild(0);
                        return;
                }
                LinkedListTree expression = AS3FragmentParser.parseExpr(expr);
</pre><pre class="diff" id="removed">-                if (ast.getChildCount() == 0) {
</pre><pre class="diff" id="added">+                setExpr(expression);
+        }
+
+        public void setExpression(ASExpression expr) {
+                if (expr == null) {
+                        if (hasExpr()) {
+                                return;
+                        }
+                        ast.deleteChild(0);
+                        return;
+                }
+                setExpr(ASTUtils.ast(expr));
+        }
+
+        private void setExpr(LinkedListTree expression) {
+                if (hasExpr()) {
</pre><pre class="diff" id="context">                         LinkedListToken after = ast.getStopToken();
                        LinkedListToken before = after.getPrev();
                        ast.addChild(expression);
</pre><pre class="diff"><small id="info">@@ -46,4 +69,8 @@
</small></pre><pre class="diff" id="context">                         ast.setChildWithTokens(0, expression);
                }
        }
</pre><pre class="diff" id="added">+
+        private boolean hasExpr() {
+                return ast.getChildCount() == 0;
+        }
</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/main/java/uk/co/badgersinfoil/metaas/impl</span><br />
<div class="fileheader"><big><b>ASTUtils.java</b></big> <small id="info">603 -> 604</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTUtils.java        2008-01-19 00:57:03 UTC (rev 603)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTUtils.java        2008-01-19 01:09:29 UTC (rev 604)
@@ -17,6 +17,7 @@
</small></pre><pre class="diff" id="context"> import org.asdt.core.internal.antlr.AS3Parser;
import uk.co.badgersinfoil.metaas.ActionScriptFactory;
import uk.co.badgersinfoil.metaas.SyntaxException;
</pre><pre class="diff" id="added">+import uk.co.badgersinfoil.metaas.dom.ASExpression;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.impl.antlr.BasicListUpdateDelegate;
import uk.co.badgersinfoil.metaas.impl.antlr.LinkedListToken;
import uk.co.badgersinfoil.metaas.impl.antlr.LinkedListTokenSource;
</pre><pre class="diff"><small id="info">@@ -461,4 +462,8 @@
</small></pre><pre class="diff" id="context">                         ast.deleteChild(0);
                }
        }
</pre><pre class="diff" id="added">+
+        public static LinkedListTree ast(ASExpression expr) {
+                return ((ASTASExpression)expr).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="file4" /><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">603 -> 604</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2008-01-19 00:57:03 UTC (rev 603)
+++ trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2008-01-19 01:09:29 UTC (rev 604)
@@ -263,14 +263,18 @@
</small></pre><pre class="diff" id="context">                 assertNull(returnStmt.getExpressionString());
                returnStmt.setExpression("false");
                assertEquals("false", returnStmt.getExpressionString());
</pre><pre class="diff" id="added">+                ExtraAssertions.assertInstanceof(returnStmt.getExpression(), ASBooleanLiteral.class);
+                returnStmt.setExpression(fact.newIntegerLiteral(2));
+                ExtraAssertions.assertInstanceof(returnStmt.getExpression(), ASIntegerLiteral.class);
</pre><pre class="diff" id="context">                 assertFirstReflectedStatementIsA(ASReturnStatement.class);
        }
        public void testReturnRemoveExpr() {
                ASReturnStatement returnStmt = meth.newReturn("true");
                assertEquals("true", returnStmt.getExpressionString());
</pre><pre class="diff" id="removed">-                returnStmt.setExpression(null);
</pre><pre class="diff" id="added">+                returnStmt.setExpression(<span id="addedchars">(String)</span>null);
</pre><pre class="diff" id="context">                 assertNull(returnStmt.getExpressionString());
</pre><pre class="diff" id="added">+                assertNull(returnStmt.getExpression());
</pre><pre class="diff" id="context">         }
        public void testBlockEmpty() {
</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>