diff ast/Stmt.d @ 59:1d6f4ad38a91 new_gen

Make most of the tests pass again Still have two bugs, one is that type conversion has been diabled for return statements, the other is at line ~540 of CodeGen.d, were the following error is emitted: Can't find an implicit conversion between { i32 } and i32
author Anders Halager <halager@gmail.com>
date Tue, 29 Apr 2008 00:31:56 +0200
parents 43bb0a36b869
children 91f10c34cd7b
line wrap: on
line diff
--- a/ast/Stmt.d	Mon Apr 28 21:51:39 2008 +0200
+++ b/ast/Stmt.d	Tue Apr 29 00:31:56 2008 +0200
@@ -65,7 +65,7 @@
     void simplify()
     {
         FuncDecl f = env.parentFunction;
-        if(f.sret)
+        if(f !is null && f.sret)
         {
             auto i = new Identifier("ret.val");
             i.env = f.env;
@@ -139,7 +139,8 @@
     {
         cond.simplify;
         then_body.simplify;
-        else_body.simplify;
+        if (else_body)
+            else_body.simplify;
     }
 
     Exp cond;