diff sema/Visitor.d @ 44:495188f9078e new_gen

Big update - Moving towards a better, more seperated parser The parser no loner creates the AST directly, but through callbacks(actions). This means the parser can be run with a different set of actions that do something else. The parser is not back to full strength yet, the main thing missing is the various statements and structs. Also added a SmallArray that uses the stack only until a given size is exceeded, after which the array is copied unto the heap.
author Anders Halager <halager@gmail.com>
date Wed, 23 Apr 2008 00:57:45 +0200
parents 858b9805843d
children 9bc660cbdbec
line wrap: on
line diff
--- a/sema/Visitor.d	Tue Apr 22 22:31:39 2008 +0200
+++ b/sema/Visitor.d	Wed Apr 23 00:57:45 2008 +0200
@@ -43,6 +43,8 @@
         {
             case StmtType.Return:
                 return visitReturnStmt(cast(ReturnStmt)stmt);
+            case StmtType.Compound:
+                return visitCompoundStmt(cast(CompoundStatement)stmt);
             case StmtType.Decl:
                 return visitDeclStmt(cast(DeclStmt)stmt);
             case StmtType.Exp:
@@ -143,6 +145,16 @@
             return StmtT.init;
     }
 
+    StmtT visitCompoundStmt(CompoundStatement c)
+    {
+        foreach (stmt; c.statements)
+            visitStmt(stmt);
+        static if (is(StmtT == void))
+            return;
+        else
+            return StmtT.init;
+    }
+
     StmtT visitIfStmt(IfStmt s)
     {
         visitExp(s.cond);