<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/impl/<a href="#file1">ASTASMethod.java</a></tt> </td><td></td><td align="right" id="added">+43</td><td align="right" id="removed">-32</td><td nowrap="nowrap" align="center">612 -> 613</td></tr>
<tr class="alt"><td><tt>test/java/uk/co/badgersinfoil/metaas/<a href="#file2">ASInterfaceTypeTests.java</a></tt> </td><td></td><td align="right" id="added">+7</td><td></td><td nowrap="nowrap" align="center">612 -> 613</td></tr>
<tr><td></td><td></td><td align="right" id="added">+50</td><td align="right" id="removed">-32</td><td></td></tr>
</table>
<small id="info">2 modified files</small><br />
<pre class="comment">
fail with useful message on abuse of ASMethod in an interface
</pre>
<hr /><a name="file1" /><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">612 -> 613</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASMethod.java        2008-01-19 18:18:27 UTC (rev 612)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASMethod.java        2008-01-19 23:45:12 UTC (rev 613)
@@ -42,7 +42,11 @@
</small></pre><pre class="diff" id="context">
        public ASTASMethod(LinkedListTree ast) {
                super(ast);
</pre><pre class="diff" id="removed">-                stmtList = new ASTStatementList(ASTUtils.findChildByType(ast, AS3Parser.BLOCK));
</pre><pre class="diff" id="added">+                LinkedListTree block = ASTUtils.findChildByType(ast, AS3Parser.BLOCK);
+                if (block != null) {
+                        // class methods have BLOCK, interface methods don't,
+                        stmtList = new ASTStatementList(block);
+                }
</pre><pre class="diff" id="context">         }
        public String getName() {
</pre><pre class="diff"><small id="info">@@ -96,14 +100,14 @@
</small></pre><pre class="diff" id="context">         }
        public Statement addStmt(String statement) {
</pre><pre class="diff" id="removed">-                return stmtList.addStmt(statement);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.addStmt(statement);
</pre><pre class="diff" id="context">         }
        public ASExpressionStatement newExprStmt(String expr) {
</pre><pre class="diff" id="removed">-                return stmtList.newExprStmt(expr);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newExprStmt(expr);
</pre><pre class="diff" id="context">         }
        public ASExpressionStatement newExprStmt(ASExpression expr) {
</pre><pre class="diff" id="removed">-                return stmtList.newExprStmt(expr);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newExprStmt(expr);
</pre><pre class="diff" id="context">         }
        private LinkedListTree findParams() {
</pre><pre class="diff"><small id="info">@@ -170,7 +174,7 @@
</small></pre><pre class="diff" id="context">         }
        public void addComment(String text) {
</pre><pre class="diff" id="removed">-                stmtList.addComment(text);
</pre><pre class="diff" id="added">+                stmtList<span id="addedchars">()</span>.addComment(text);
</pre><pre class="diff" id="context">         }
        public AccessorRole getAccessorRole() {
</pre><pre class="diff"><small id="info">@@ -218,101 +222,101 @@
</small></pre><pre class="diff" id="context">         }
        public ASIfStatement newIf(String condition) {
</pre><pre class="diff" id="removed">-                return stmtList.newIf(condition);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newIf(condition);
</pre><pre class="diff" id="context">         }
        public ASIfStatement newIf(ASExpression condition) {
</pre><pre class="diff" id="removed">-                return stmtList.newIf(condition);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newIf(condition);
</pre><pre class="diff" id="context">         }
        public ASForStatement newFor(String init, String condition, String update) {
</pre><pre class="diff" id="removed">-                return stmtList.newFor(init, condition, update);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newFor(init, condition, update);
</pre><pre class="diff" id="context">         }
        public ASForStatement newFor(ASExpression init, ASExpression condition, ASExpression update) {
</pre><pre class="diff" id="removed">-                return stmtList.newFor(init, condition, update);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newFor(init, condition, update);
</pre><pre class="diff" id="context">         }
        public ASForInStatement newForIn(String init, String list) {
</pre><pre class="diff" id="removed">-                return stmtList.newForIn(init, list);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newForIn(init, list);
</pre><pre class="diff" id="context">         }
        public ASForInStatement newForIn(ASExpression init, ASExpression list) {
</pre><pre class="diff" id="removed">-                return stmtList.newForIn(init, list);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newForIn(init, list);
</pre><pre class="diff" id="context">         }
        public ASForEachInStatement newForEachIn(String init, String list) {
</pre><pre class="diff" id="removed">-                return stmtList.newForEachIn(init, list);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newForEachIn(init, list);
</pre><pre class="diff" id="context">         }
        public ASForEachInStatement newForEachIn(ASExpression init, ASExpression list) {
</pre><pre class="diff" id="removed">-                return stmtList.newForEachIn(init, list);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newForEachIn(init, list);
</pre><pre class="diff" id="context">         }
        public ASWhileStatement newWhile(String condition) {
</pre><pre class="diff" id="removed">-                return stmtList.newWhile(condition);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newWhile(condition);
</pre><pre class="diff" id="context">         }
        public ASWhileStatement newWhile(ASExpression condition) {
</pre><pre class="diff" id="removed">-                return stmtList.newWhile(condition);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newWhile(condition);
</pre><pre class="diff" id="context">         }
        public ASDoWhileStatement newDoWhile(String condition) {
</pre><pre class="diff" id="removed">-                return stmtList.newDoWhile(condition);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newDoWhile(condition);
</pre><pre class="diff" id="context">         }
        public ASDoWhileStatement newDoWhile(ASExpression condition) {
</pre><pre class="diff" id="removed">-                return stmtList.newDoWhile(condition);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newDoWhile(condition);
</pre><pre class="diff" id="context">         }
        public ASSwitchStatement newSwitch(String condition) {
</pre><pre class="diff" id="removed">-                return stmtList.newSwitch(condition);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newSwitch(condition);
</pre><pre class="diff" id="context">         }
        public ASSwitchStatement newSwitch(ASExpression condition) {
</pre><pre class="diff" id="removed">-                return stmtList.newSwitch(condition);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newSwitch(condition);
</pre><pre class="diff" id="context">         }
        public ASWithStatement newWith(String expr) {
</pre><pre class="diff" id="removed">-                return stmtList.newWith(expr);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newWith(expr);
</pre><pre class="diff" id="context">         }
        public ASWithStatement newWith(ASExpression expr) {
</pre><pre class="diff" id="removed">-                return stmtList.newWith(expr);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newWith(expr);
</pre><pre class="diff" id="context">         }
        public ASDeclarationStatement newDeclaration(String assignment) {
</pre><pre class="diff" id="removed">-                return stmtList.newDeclaration(assignment);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newDeclaration(assignment);
</pre><pre class="diff" id="context">         }
        public ASDeclarationStatement newDeclaration(ASExpression assignment) {
</pre><pre class="diff" id="removed">-                return stmtList.newDeclaration(assignment);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newDeclaration(assignment);
</pre><pre class="diff" id="context">         }
        public ASReturnStatement newReturn(String expr) {
</pre><pre class="diff" id="removed">-                return stmtList.newReturn(expr);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newReturn(expr);
</pre><pre class="diff" id="context">         }
        public ASReturnStatement newReturn(ASExpression expr) {
</pre><pre class="diff" id="removed">-                return stmtList.newReturn(expr);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newReturn(expr);
</pre><pre class="diff" id="context">         }
        public ASReturnStatement newReturn() {
</pre><pre class="diff" id="removed">-                return stmtList.newReturn();
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newReturn();
</pre><pre class="diff" id="context">         }
        public ASSuperStatement newSuper(List args) {
</pre><pre class="diff" id="removed">-                return stmtList.newSuper(args);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newSuper(args);
</pre><pre class="diff" id="context">         }
        public ASBreakStatement newBreak() {
</pre><pre class="diff" id="removed">-                return stmtList.newBreak();
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newBreak();
</pre><pre class="diff" id="context">         }
        public ASTryStatement newTryCatch(String var, String type) {
</pre><pre class="diff" id="removed">-                return stmtList.newTryCatch(var, type);
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newTryCatch(var, type);
</pre><pre class="diff" id="context">         }
        public ASTryStatement newTryFinally() {
</pre><pre class="diff" id="removed">-                return stmtList.newTryFinally();
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.newTryFinally();
</pre><pre class="diff" id="context">         }
        public boolean containsCode() {
</pre><pre class="diff" id="removed">-                return stmtList.containsCode();
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.containsCode();
</pre><pre class="diff" id="context">         }
        public List getStatementList() {
</pre><pre class="diff" id="removed">-                return stmtList.getStatementList();
</pre><pre class="diff" id="added">+                return stmtList<span id="addedchars">()</span>.getStatementList();
</pre><pre class="diff" id="context">         }
        public String getReturnDescriptionString() {
</pre><pre class="diff"><small id="info">@@ -339,4 +343,11 @@
</small></pre><pre class="diff" id="context">                         }
                }
        }
</pre><pre class="diff" id="added">+
+        private ASTStatementList stmtList() {
+                if (stmtList == null) {
+                        throw new SyntaxException("Interface methods don't have a body");
+                }
+                return stmtList;
+        }
</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/test/java/uk/co/badgersinfoil/metaas</span><br />
<div class="fileheader"><big><b>ASInterfaceTypeTests.java</b></big> <small id="info">612 -> 613</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/java/uk/co/badgersinfoil/metaas/ASInterfaceTypeTests.java        2008-01-19 18:18:27 UTC (rev 612)
+++ trunk/src/test/java/uk/co/badgersinfoil/metaas/ASInterfaceTypeTests.java        2008-01-19 23:45:12 UTC (rev 613)
@@ -78,6 +78,13 @@
</small></pre><pre class="diff" id="context">                 assertEquals("bar", meth1.getName());
                assertEquals(foo.getName(), iface.getMethod("foo").getName());
</pre><pre class="diff" id="added">+                
+                try {
+                        meth1.addStmt("helloWorld()");
+                        fail("adding code to interface method should fail");
+                } catch (SyntaxException e) {
+                        // expected
+                }
</pre><pre class="diff" id="context">         }
        public void testSuper() {
</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>