diff ast/Stmt.d @ 45:9bc660cbdbec new_gen

If statements are back Also fixed a bug in the codegen preventing return in the else branch, now it is optional. Also found an issue with the way we are generating our llvm from ifs - it doesn't mean anything but the code looks ugly. if (cond_1) if (cond_2) statement; return 0; Becomes: br cond_1, then, merge then: br cond_2 then2, merge2 merge: ret 0 then2: statements merge2: br merge This is because we use appendBasicBlock on the function
author Anders Halager <halager@gmail.com>
date Wed, 23 Apr 2008 16:43:42 +0200
parents 495188f9078e
children 90fb4fdfefdd
line wrap: on
line diff
--- a/ast/Stmt.d	Wed Apr 23 00:57:45 2008 +0200
+++ b/ast/Stmt.d	Wed Apr 23 16:43:42 2008 +0200
@@ -77,7 +77,7 @@
 
 class IfStmt : Stmt
 {
-    this(Exp cond, Stmt[] then, Stmt[] el = null)
+    this(Exp cond, Stmt then, Stmt el = null)
     {
         super(StmtType.If);
         this.cond = cond;
@@ -86,8 +86,8 @@
     }
 
     Exp cond;
-    Stmt[] then_body;
-    Stmt[] else_body;
+    Stmt then_body;
+    Stmt else_body;
 }
 
 class WhileStmt : Stmt