diff sema/DType.d @ 107:189c049cbfcc new_gen

Cleanup of codegen, better support for operators a few bugfixes
author Anders Halager <halager@gmail.com>
date Sun, 25 May 2008 14:40:14 +0200
parents 09b4d74cb3f5
children 0cd8d6ab3f89
line wrap: on
line diff
--- a/sema/DType.d	Thu May 08 10:54:29 2008 +0200
+++ b/sema/DType.d	Sun May 25 14:40:14 2008 +0200
@@ -3,7 +3,8 @@
 import lexer.Token,
        ast.Exp;
 
-import tango.io.Stdout;
+public
+import sema.Operation;
 
 class DType
 {
@@ -86,6 +87,16 @@
     bool hasImplicitConversionTo(DType that) { return false; }
 
     /**
+      Get an Operation describing how to use the supplied operator on the two
+      types given.
+     */
+    Operation getOperationWith(Operator op, DType other)
+    {
+        Operation res;
+        return res;
+    }
+
+    /**
       Get a type representing a pointer to this type (from int to int*)
      */
     DPointer getPointerTo()
@@ -188,6 +199,14 @@
     override bool isInteger() { return true; }
     override DInteger asInteger() { return this; }
 
+    override Operation getOperationWith(Operator op, DType that)
+    {
+        Operation operation;
+        if (this is that)
+            operation = Operation.builtin(op, unsigned, false);
+        return operation;
+    }
+
     override char[] mangle()
     {
         return mangle_types[this];