<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">ASIfStatement.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">583 -&gt; 584</td></tr>
<tr class="alt"><td><tt>main/java/uk/co/badgersinfoil/metaas/impl/<a href="#file2">ASTASIfStatement.java</a></tt> </td><td></td><td align="right" id="added">+22</td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center">583 -&gt; 584</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">+13</td><td></td><td nowrap="nowrap" align="center">583 -&gt; 584</td></tr>
<tr><td></td><td></td><td align="right" id="added">+40</td><td align="right" id="removed">-2</td><td></td></tr>
</table>
<small id="info">3 modified files</small><br />
<pre class="comment">
Work to resolve issues with if-statement bodies, as noted by R?\195?\169mi Flament.
The API was assuming that the body of an if-statement would always be a block,
and the code would fail at runtime with strange errors when this was not the
case.  The new API allows access to the body of the if-statement no matter if
it's a block-statement or any other kind.  Attempts to treat the if-statement
as a StatementContainer when its body isn't a block-statement will now result
in a descriptive error message.
</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>ASIfStatement.java</b></big> <small id="info">583 -&gt; 584</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/ASIfStatement.java        2008-01-10 22:39:57 UTC (rev 583)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/ASIfStatement.java        2008-01-12 19:06:19 UTC (rev 584)
@@ -66,7 +66,11 @@
</small></pre><pre class="diff" id="context">          */
         public Statement getElseStatement();
 
</pre><pre class="diff" id="removed">-        // TODO: 'Statement' parameter instead
</pre><pre class="diff" id="added">+        public Statement getThenStatement();
+
+        public void setThenStatement(Statement then);
+
+        /** @deprecated Use {@link #setThenStatement(Statement)} */
</pre><pre class="diff" id="context">         public void setThen(ASBlock thenBlock);
 
         /**
</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>ASTASIfStatement.java</b></big> <small id="info">583 -&gt; 584</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASIfStatement.java        2008-01-10 22:39:57 UTC (rev 583)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASIfStatement.java        2008-01-12 19:06:19 UTC (rev 584)
@@ -18,6 +18,7 @@
</small></pre><pre class="diff" id="context"> 
 public class ASTASIfStatement extends ContainerDelegate implements ASIfStatement {
 
</pre><pre class="diff" id="added">+        private static final int THEN_INDEX = 1;
</pre><pre class="diff" id="context">         private static final int ELSE_INDEX = 2;
         private LinkedListTree ast;
 
</pre><pre class="diff"><small id="info">@@ -27,9 +28,20 @@
</small></pre><pre class="diff" id="context">         }
 
         protected StatementContainer getStatementContainer() {
</pre><pre class="diff" id="removed">-                return new ASTStatementList((LinkedListTree)ast.getChild(1));
</pre><pre class="diff" id="added">+                LinkedListTree child = thenClause();
+                if (AS3Parser.BLOCK != child.getType()) {
+                        throw new SyntaxException("statement is not a block");
+                }
+                return new ASTStatementList(child);
</pre><pre class="diff" id="context">         }
 
</pre><pre class="diff" id="added">+        private LinkedListTree thenClause() {
+                return (LinkedListTree)ast.getChild(THEN_INDEX);
+        }
+
+        public Statement getThenStatement() {
+                return StatementBuilder.build(thenClause());
+        }
</pre><pre class="diff" id="context">         
         public ASBlock getElse() {
                 return elseBlock();
</pre><pre class="diff"><small id="info">@@ -78,6 +90,15 @@
</small></pre><pre class="diff" id="context">                 ASTUtils.increaseIndentAfterFirstLine(theBlock, indent);
         }
 
</pre><pre class="diff" id="added">+        public void setThenStatement(Statement then) {
+                LinkedListTree thenAST = ((ASTStatementList)then).getAST();
+                ast.setChildWithTokens(THEN_INDEX, thenAST);
+                if (AS3Parser.BLOCK == thenAST.getType()) {
+                        String indent = ASTUtils.findIndent(ast);
+                        ASTUtils.increaseIndentAfterFirstLine(thenAST, indent);
+                }
+        }
+
</pre><pre class="diff" id="context">         private LinkedListTree condition() {
                 return ast.getFirstChild();
         }
</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">583 -&gt; 584</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2008-01-10 22:39:57 UTC (rev 583)
+++ trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2008-01-12 19:06:19 UTC (rev 584)
@@ -100,6 +100,19 @@
</small></pre><pre class="diff" id="context">         }
         
         public void testParseIf() {
</pre><pre class="diff" id="added">+                ASIfStatement ifStmt = (ASIfStatement)meth.addStmt("if (foo) blah();");
+                assertNotNull(ifStmt.getThenStatement());
+                ExtraAssertions.assertInstanceof(ifStmt.getThenStatement(), ASExpressionStatement.class);
+                try {
+                        // no block in the 'if', so SyntaxException is expected,
+                        ifStmt.getStatementList();
+                        fail();
+                } catch (SyntaxException e) {
+                        // expected
+                }
+        }
+
+        public void testParseIfElseIf() {
</pre><pre class="diff" id="context">                 ASIfStatement ifStmt = (ASIfStatement)meth.addStmt("if (foo) {blah();} else if (bar) {other();}");
                 assertNotNull(ifStmt.getElseStatement());
                 ExtraAssertions.assertInstanceof(ifStmt.getElseStatement(), ASIfStatement.class);
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.12</small></center>
</body></html>