<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">ASSwitchStatement.java</a></tt> </td><td></td><td align="right" id="added">+3</td><td></td><td nowrap="nowrap" align="center">566 -> 567</td></tr>
<tr class="alt"><td><tt>main/java/uk/co/badgersinfoil/metaas/impl/<a href="#file2">ASTASSwitchStatement.java</a></tt> </td><td></td><td align="right" id="added">+21</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">566 -> 567</td></tr>
<tr><td><tt> /<a href="#file3">ASTStatementList.java</a></tt> </td><td></td><td align="right" id="added">+2</td><td align="right" id="removed">-2</td><td nowrap="nowrap" align="center">566 -> 567</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">+6</td><td></td><td nowrap="nowrap" align="center">566 -> 567</td></tr>
<tr><td></td><td></td><td align="right" id="added">+32</td><td align="right" id="removed">-6</td><td></td></tr>
</table>
<small id="info">4 modified files</small><br />
<pre class="comment">
provide access to the condition-expr in a switch-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>ASSwitchStatement.java</b></big> <small id="info">566 -> 567</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/ASSwitchStatement.java        2007-12-04 23:23:19 UTC (rev 566)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/ASSwitchStatement.java        2007-12-05 08:58:55 UTC (rev 567)
@@ -47,4 +47,7 @@
</small></pre><pre class="diff" id="context">          * which other statements can be added.
         */
        ASSwitchDefault newDefault();
</pre><pre class="diff" id="added">+        
+        ASExpression getCondition();
+        public void setCondition(ASExpression expr);
</pre><pre class="diff" id="context"> }
</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>ASTASSwitchStatement.java</b></big> <small id="info">566 -> 567</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASSwitchStatement.java        2007-12-04 23:23:19 UTC (rev 566)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASSwitchStatement.java        2007-12-05 08:58:55 UTC (rev 567)
@@ -7,6 +7,7 @@
</small></pre><pre class="diff" id="context"> package uk.co.badgersinfoil.metaas.impl;
import org.asdt.core.internal.antlr.AS3Parser;
</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.ASSwitchCase;
import uk.co.badgersinfoil.metaas.dom.ASSwitchDefault;
import uk.co.badgersinfoil.metaas.dom.ASSwitchStatement;
</pre><pre class="diff"><small id="info">@@ -18,9 +19,13 @@
</small></pre><pre class="diff" id="context">
        private LinkedListTree ast;
</pre><pre class="diff" id="removed">-        public ASTASSwitchStatement(LinkedListTree block) {
-                ast = block;
</pre><pre class="diff" id="added">+        public ASTASSwitchStatement(LinkedListTree ast) {
+                this.ast = ast;
</pre><pre class="diff" id="context">         }
</pre><pre class="diff" id="added">+        
+        private LinkedListTree block() {
+                return ast.getLastChild();
+        }
</pre><pre class="diff" id="context">
        public ASSwitchCase newCase(String expr) {
                LinkedListTree caseStmt = ASTUtils.newAST(AS3Parser.CASE, "case");
</pre><pre class="diff"><small id="info">@@ -29,7 +34,7 @@
</small></pre><pre class="diff" id="context">                 caseStmt.appendToken(TokenBuilder.newColon());
                LinkedListTree stmtList = ASTUtils.newPlaceholderAST(AS3Parser.SWITCH_STATEMENT_LIST);
                caseStmt.addChildWithTokens(stmtList);
</pre><pre class="diff" id="removed">-                ASTUtils.addChildWithIndentation(<span id="removedchars">ast</span>, caseStmt);
</pre><pre class="diff" id="added">+                ASTUtils.addChildWithIndentation(<span id="addedchars">block()</span>, caseStmt);
</pre><pre class="diff" id="context">                 return new ASTASSwitchCase(caseStmt);
        }
</pre><pre class="diff"><small id="info">@@ -38,7 +43,19 @@
</small></pre><pre class="diff" id="context">                 defaultStmt.appendToken(TokenBuilder.newColon());
                LinkedListTree stmtList = ASTUtils.newPlaceholderAST(AS3Parser.SWITCH_STATEMENT_LIST);
                defaultStmt.addChildWithTokens(stmtList);
</pre><pre class="diff" id="removed">-                ASTUtils.addChildWithIndentation(<span id="removedchars">ast</span>, defaultStmt);
</pre><pre class="diff" id="added">+                ASTUtils.addChildWithIndentation(<span id="addedchars">block()</span>, defaultStmt);
</pre><pre class="diff" id="context">                 return new ASTASSwitchDefault(defaultStmt);
        }
</pre><pre class="diff" id="added">+        
+        private LinkedListTree cond() {
+                return ast.getFirstChild();
+        }
+
+        public ASExpression getCondition() {
+                return ExpressionBuilder.build(cond().getFirstChild());
+        }
+
+        public void setCondition(ASExpression expr) {
+                cond().setChildWithTokens(0, ((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="file3" /><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">566 -> 567</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTStatementList.java        2007-12-04 23:23:19 UTC (rev 566)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTStatementList.java        2007-12-05 08:58:55 UTC (rev 567)
@@ -160,12 +160,12 @@
</small></pre><pre class="diff" id="context">         public ASSwitchStatement newSwitch(String condition) {
                LinkedListTree switchStmt = ASTBuilder.newSwitch(condition);
                addStatement(switchStmt);
</pre><pre class="diff" id="removed">-                return new ASTASSwitchStatement(findBlock(switchStmt));
</pre><pre class="diff" id="added">+                return new ASTASSwitchStatement(switchStmt);
</pre><pre class="diff" id="context">         }
        public ASSwitchStatement newSwitch(ASExpression condition) {
                LinkedListTree switchStmt = ASTBuilder.newSwitch(ast(condition));
                addStatement(switchStmt);
</pre><pre class="diff" id="removed">-                return new ASTASSwitchStatement(findBlock(switchStmt));
</pre><pre class="diff" id="added">+                return new ASTASSwitchStatement(switchStmt);
</pre><pre class="diff" id="context">         }
        public ASWithStatement newWith(String expr) {
</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">566 -> 567</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2007-12-04 23:23:19 UTC (rev 566)
+++ trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2007-12-05 08:58:55 UTC (rev 567)
@@ -176,6 +176,12 @@
</small></pre><pre class="diff" id="context">                 assertEquals("2", cas.getLabelValueString());
                ASSwitchDefault def= swtch.newDefault();
                def.addStmt("trace('default')");
</pre><pre class="diff" id="added">+                
+                // condition tests,
+                assertNotNull(swtch.getCondition());
+                swtch.setCondition(fact.newIntegerLiteral(333));
+                assertTrue(swtch.getCondition() instanceof ASIntegerLiteral);
+                assertEquals(333, ((ASIntegerLiteral)swtch.getCondition()).getValue());
</pre><pre class="diff" id="context">         }
        public void testWith() {
</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>