changeset 66:c62c32e92fde new_gen

Fixed a bug - delegates are problematic
author Anders Halager <halager@gmail.com>
date Tue, 29 Apr 2008 18:30:14 +0200
parents 932bb3c6b80b
children 3fdf20b08a81
files gen/CodeGen.d
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gen/CodeGen.d	Tue Apr 29 18:17:09 2008 +0200
+++ b/gen/CodeGen.d	Tue Apr 29 18:30:14 2008 +0200
@@ -21,7 +21,7 @@
 private char[] genBuildCmp(char[] p)
 {
     return `
-        (Value l, Value r, char[] n)
+        Value build`~p~`(Value l, Value r, char[] n)
         {
             return b.buildICmp(IntPredicate.`~p~`, l, r, n);
         }`;
@@ -29,6 +29,14 @@
 
 class CodeGen
 {
+private:
+    mixin(genBuildCmp("EQ"));
+    mixin(genBuildCmp("NE"));
+    mixin(genBuildCmp("SLT"));
+    mixin(genBuildCmp("SLE"));
+    mixin(genBuildCmp("SGT"));
+    mixin(genBuildCmp("SGE"));
+
 public:
     this()
     {
@@ -40,13 +48,12 @@
             op.Sub      : &b.buildSub,
             op.Mul      : &b.buildMul,
             op.Div      : &b.buildSDiv,
-            op.Mod      : &b.buildSRem,
-            op.Eq       : mixin(genBuildCmp("EQ")),
-            op.Ne       : mixin(genBuildCmp("NE")),
-            op.Lt       : mixin(genBuildCmp("SLT")),
-            op.Le       : mixin(genBuildCmp("SLE")),
-            op.Gt       : mixin(genBuildCmp("SGT")),
-            op.Ge       : mixin(genBuildCmp("SGE"))
+            op.Eq       : &buildEQ,
+            op.Ne       : &buildNE,
+            op.Lt       : &buildSLT,
+            op.Le       : &buildSLE,
+            op.Gt       : &buildSGT,
+            op.Ge       : &buildSGE
         ];
         table = new SimpleSymbolTable();