diff sema/DType.d @ 77:13eea2c4e60d new_gen

Now able of --ast-dump-code with Pointer types and also codeGen int* x;
author Anders Johnsen <skabet@gmail.com>
date Fri, 02 May 2008 16:37:13 +0200
parents 628cb46ab13b
children 682e20aa224f
line wrap: on
line diff
--- a/sema/DType.d	Fri May 02 15:48:57 2008 +0200
+++ b/sema/DType.d	Fri May 02 16:37:13 2008 +0200
@@ -35,6 +35,11 @@
     /// Return a DArray if this is one, otherwise return null
     DArray asArray() { return null; }
 
+    /// Is this type a DPointer
+    bool isPointer() { return false; }
+    /// Return a DPointer if this is one, otherwise return null
+    DPointer asPointer() { return null; }
+
     /// Is this type a DFunction
     bool isFunction() { return false; }
     /// Return a DFunction if this is one, otherwise return null
@@ -198,6 +203,22 @@
     DType arrayOf;
 }
 
+class DPointer : DType
+{
+    this(DType pointerOf, DType actual = null)
+    {
+        super(id, actual);
+        this.pointerOf = pointerOf;
+    }
+
+    override bool isPointer() { return true; }
+    override DPointer asPointer() { return this; }
+
+    int byteSize() { return DType.Int.byteSize; }
+
+    DType pointerOf;
+}
+
 class DFunction : DType
 {
     this(Identifier id, DType actual = null)