diff ast/Stmt.d @ 11:642c6a998fd9

Support for while statements and fixed scope for if
author Anders Halager <halager@gmail.com>
date Fri, 18 Apr 2008 13:45:39 +0200
parents 2c5a8f4c254a
children ce17bea8e9bd
line wrap: on
line diff
--- a/ast/Stmt.d	Fri Apr 18 13:01:11 2008 +0200
+++ b/ast/Stmt.d	Fri Apr 18 13:45:39 2008 +0200
@@ -12,6 +12,7 @@
     Exp,
     Return,
     If,
+    While,
 }
 
 class Stmt
@@ -59,14 +60,29 @@
 
 class IfStmt : Stmt
 {
-    this(Exp cond, Stmt[] then)
+    this(Exp cond, Stmt[] then, Stmt[] el = null)
     {
         super(StmtType.If);
         this.cond = cond;
-        this.then = then;
+        this.then_body = then;
+        this.else_body = el;
     }
 
     Exp cond;
-    Stmt[] then;
+    Stmt[] then_body;
+    Stmt[] else_body;
 }
 
+class WhileStmt : Stmt
+{
+    this(Exp cond, Stmt[] stmts)
+    {
+        super(StmtType.While);
+        this.cond = cond;
+        this.stmts = stmts;
+    }
+
+    Exp cond;
+    Stmt[] stmts;
+}
+