diff gen/CodeGen.d @ 116:0cd8d6ab3f89

Add in the types for float and co.
author Anders Halager <halager@gmail.com>
date Sun, 25 May 2008 18:19:09 +0200
parents 244142a21cbc
children 54955003765b
line wrap: on
line diff
--- a/gen/CodeGen.d	Sun May 25 15:49:25 2008 +0200
+++ b/gen/CodeGen.d	Sun May 25 18:19:09 2008 +0200
@@ -386,7 +386,7 @@
         Value res;
         // TODO: do usual type promotions on a and b
         // TODO: support floats
-        if (t_a.isInteger() && t_b.isInteger())
+        if (t_a.isArithmetic() && t_b.isArithmetic())
         {
             Operation op = t_a.getOperationWith(op2op(e.op), t_b);
             assert(op.isBuiltin(),
@@ -626,11 +626,11 @@
                 auto id = exp.env.find(identifier);
                 return LValue(table.find(id.get));
             case ExpType.Deref:
-                // LValue(*x): x
-                // RValue(*x): load(x)
+                // LValue(*x): load(x)
+                // RValue(*x): load(load(x))
                 // This way *x = *x + 1 will work
-                // We get an i32** rather than i32* because it's alloc'd
-                // so there needs to be a load
+                // We need an ekstra load, because we get an i32** rather than
+                // i32* since stuff is alloc'd
                 auto DE = cast(DerefExp)exp;
                 return LValue(genExpression(DE.exp).value);
             case ExpType.Index: