diff src/dil/ast/Expressions.d @ 821:09a64d96967a

Started the interpreter. Made a couple changes in other parts -- CharExpression now has an IntExpression of a character type as its value member and its type is set accordingly.
author Jarrett Billingsley <jarrett.billingsley@gmail.com>
date Fri, 14 Mar 2008 11:01:05 -0400
parents bcb74c9b895c
children 451ede0105e0
line wrap: on
line diff
--- a/src/dil/ast/Expressions.d	Thu Mar 13 18:59:54 2008 +0100
+++ b/src/dil/ast/Expressions.d	Fri Mar 14 11:01:05 2008 -0400
@@ -662,6 +662,8 @@
 
 class BoolExpression : Expression
 {
+  IntExpression value; /// IntExpression of type bool.
+  
   this()
   {
     mixin(set_kind);
@@ -673,8 +675,6 @@
     return begin.kind == TOK.True ? true : false;
   }
 
-  Expression value; /// IntExpression of type int.
-
   mixin(copyMethod);
 }
 
@@ -765,11 +765,22 @@
 
 class CharExpression : Expression
 {
-  dchar character;
+  IntExpression value; // IntExpression of type Char/Wchar/Dchar.
+//  dchar character;
   this(dchar character)
   {
     mixin(set_kind);
-    this.character = character;
+//    this.character = character;
+    if(character <= 0xFF)
+      this.value = new IntExpression(character, Types.Char);
+    else if(character <= 0xFFFF)
+      this.value = new IntExpression(character, Types.Wchar);
+    else
+      this.value = new IntExpression(character, Types.Dchar);
+
+    assert(this.value.type !is null);
+
+    this.type = this.value.type;
   }
   mixin(copyMethod);
 }