diff sema/DType.d @ 64:91f10c34cd7b new_gen

Fixed some bugs, removed the function gathering pass in codegen and types are created when first referenced
author Anders Halager <halager@gmail.com>
date Tue, 29 Apr 2008 17:56:52 +0200
parents 9f8131676242
children 381975d76baf
line wrap: on
line diff
--- a/sema/DType.d	Tue Apr 29 15:13:38 2008 +0200
+++ b/sema/DType.d	Tue Apr 29 17:56:52 2008 +0200
@@ -25,6 +25,25 @@
         this.actual = actual is null? this : actual;
     }
 
+    /// Is this type a DStruct
+    bool isStruct() { return false; }
+    /// Return a DStruct if this is one, otherwise return null
+    DStruct asStruct() { return null; }
+
+    /// Is this type a DFunction
+    bool isFunction() { return false; }
+    /// Return a DFunction if this is one, otherwise return null
+    DFunction asFunction() { return null; }
+
+    /// Is this type a DInteger
+    bool isInteger() { return false; }
+    /// Return a DInteger if this is one, otherwise return null
+    DInteger asInteger() { return null; }
+
+    // Is this type a DPointer
+    //bool isPointer() { return false; }
+    // DPointer asPointer() { return null; }
+
     int opEquals(Object o)
     {
         if (auto t = cast(DType)o)
@@ -105,6 +124,9 @@
         return false;
     }
 
+    override bool isInteger() { return true; }
+    override DInteger asInteger() { return this; }
+
     int bits;
     bool unsigned;
 }
@@ -118,6 +140,9 @@
 
     int byteSize() { return bytes_total; }
 
+    override bool isStruct() { return true; }
+    override DStruct asStruct() { return this; }
+
     void addMember(DType type, char[] name)
     {
         auto s = DStructMember(type, members.length);
@@ -158,7 +183,11 @@
         super(id, actual);
     }
 
+    override bool isFunction() { return true; }
+    override DFunction asFunction() { return this; }
+
     DType[] params;
     DType returnType;
+    bool firstParamIsReturnValue = false;
 }