diff sema/Visitor.d @ 149:393a1f47a6d2

For loops in AST and sema. Should have correct scope and such now.
author Anders Johnsen <skabet@gmail.com>
date Mon, 21 Jul 2008 21:00:20 +0200
parents 6e6355fb5f0f
children 57b0b4464a0b
line wrap: on
line diff
--- a/sema/Visitor.d	Mon Jul 21 20:28:11 2008 +0200
+++ b/sema/Visitor.d	Mon Jul 21 21:00:20 2008 +0200
@@ -70,6 +70,8 @@
                 return visitIfStmt(cast(IfStmt)stmt);
             case StmtType.While:
                 return visitWhileStmt(cast(WhileStmt)stmt);
+            case StmtType.For:
+                return visitForStmt(cast(ForStmt)stmt);
             case StmtType.Switch:
                 return visitSwitchStmt(cast(SwitchStmt)stmt);
             default:
@@ -256,6 +258,18 @@
         else
             return StmtT.init;
     }
+    
+    StmtT visitForStmt(ForStmt s)
+    {
+        visitStmt(s.init);
+        visitExp(s.cond);
+        visitExp(s.incre);
+        visitStmt(s.forBody);
+        static if (is(StmtT == void))
+            return;
+        else
+            return StmtT.init;
+    }
 
     StmtT visitSwitchStmt(SwitchStmt s)
     {