diff sema/DType.d @ 28:69464d465284 new_gen

Now supporting structs - both read and write. Still a few errors though, so watch out.
author Anders Johnsen <skabet@gmail.com>
date Sun, 20 Apr 2008 11:20:28 +0200
parents 9031487e97d7
children 858b9805843d
line wrap: on
line diff
--- a/sema/DType.d	Sun Apr 20 01:08:50 2008 +0200
+++ b/sema/DType.d	Sun Apr 20 11:20:28 2008 +0200
@@ -7,6 +7,8 @@
 import lexer.Token,
        ast.Exp;
 
+import tango.io.Stdout;
+
 class DType
 {
     private char[] id;
@@ -50,6 +52,7 @@
     }
 
     char[] name() { return id; }
+    Location getLoc() { return loc; }
     LLVM.Type llvm() { return llvmType; }
 
     static DInteger
@@ -95,7 +98,20 @@
     {
         super(id, actual);
     }
-    DType[] members;
+
+    void setMembers(DType[char[]] members)
+    {
+        this.members = members;
+
+        LLVM.Type[] types;
+
+        foreach( type ; members)
+            types ~= type.llvm;
+
+        this.llvmType = LLVM.StructType.Get(types);
+
+    }
+    DType[char[]] members;
 }
 
 class DFunction : DType