diff ast/Exp.d @ 192:fda35d57847e

Fixed String parsing, so that they get created with the right type in AST. Also added so that you can parse options to the test program, that will mirror them to Dang. Eg. ./tests/run --semantic-only will pass --semantic-only to Dang on each run.
author Anders Johnsen <skabet@gmail.com>
date Fri, 25 Jul 2008 15:00:54 +0200
parents 7b274cfdc1dc
children 658178183018
line wrap: on
line diff
--- a/ast/Exp.d	Fri Jul 25 14:44:50 2008 +0200
+++ b/ast/Exp.d	Fri Jul 25 15:00:54 2008 +0200
@@ -532,10 +532,21 @@
         this.str = str;
     }
 
-    override DType type() { return DType.Char.getAsStaticArray(data.length); }
+    override DType type() 
+    {
+        switch (data.type)
+        {
+            case StringType.Char:
+                return DType.Char.getAsStaticArray(data.data.length); 
+            case StringType.WChar:
+                return DType.WChar.getAsStaticArray(data.data.length/2); 
+            case StringType.DChar:
+                return DType.DChar.getAsStaticArray(data.data.length/4); 
+        }
+    }
 
     char[] str;
-    ubyte[] data;
+    String data;
 }
 
 class NewExp : Exp