diff sema/Visitor.d @ 158:57b0b4464a0b

Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
author Anders Johnsen <skabet@gmail.com>
date Tue, 22 Jul 2008 00:33:58 +0200
parents 393a1f47a6d2
children 0f38f1a0f06f
line wrap: on
line diff
--- a/sema/Visitor.d	Mon Jul 21 22:14:06 2008 +0200
+++ b/sema/Visitor.d	Tue Jul 22 00:33:58 2008 +0200
@@ -109,6 +109,8 @@
                 return visitIndexExp(cast(IndexExp)exp);
             case ExpType.MemberReference:
                 return visitMemberReference(cast(MemberReference)exp);
+            case ExpType.NewExp:
+                return visitNewExp(cast(NewExp)exp);
             default:
                 throw new Exception("Unknown expression type");
         }
@@ -423,5 +425,21 @@
         else
             return ExpT.init;
     }
+
+    ExpT visitNewExp(NewExp n)
+    {
+        visitExp(n.newType);
+
+        foreach( a ; n.a_args )
+            visitExp(a);
+
+        foreach( c ; n.c_args )
+            visitExp(c);
+
+        static if (is(ExpT == void))
+            return;
+        else
+            return ExpT.init;
+    }
 }