diff trunk/src/dil/ast/Expressions.d @ 679:ff6971637f88

Renamed Token member type to kind.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Fri, 18 Jan 2008 23:40:12 +0100
parents a1f8d8f2db38
children 6b3e397229c5
line wrap: on
line diff
--- a/trunk/src/dil/ast/Expressions.d	Fri Jan 18 23:11:44 2008 +0100
+++ b/trunk/src/dil/ast/Expressions.d	Fri Jan 18 23:40:12 2008 +0100
@@ -420,13 +420,13 @@
   bool isPos()
   {
     assert(begin !is null);
-    return begin.type == TOK.Plus;
+    return begin.kind == TOK.Plus;
   }
 
   bool isNeg()
   {
     assert(begin !is null);
-    return begin.type == TOK.Minus;
+    return begin.kind == TOK.Minus;
   }
 }
 
@@ -646,6 +646,12 @@
     mixin(set_kind);
   }
 
+  bool toBool()
+  {
+    assert(begin !is null);
+    return begin.kind == TOK.True ? true : false;
+  }
+
   Expression value; /// IntExpression of type int.
 }
 
@@ -663,7 +669,7 @@
   this(Token* token)
   {
     auto type = Types.Int; // Should be most common case.
-    switch (token.type)
+    switch (token.kind)
     {
     // case TOK.Int32:
     //   type = Types.Int; break;
@@ -674,7 +680,7 @@
     case TOK.Uint64:
       type = Types.Ulong; break;
     default:
-      assert(token.type == TOK.Int32);
+      assert(token.kind == TOK.Int32);
     }
     this(token.ulong_, type);
   }
@@ -694,7 +700,7 @@
   this(Token* token)
   {
     auto type = Types.Double; // Most common case?
-    switch (token.type)
+    switch (token.kind)
     {
     case TOK.Float32:
       type = Types.Float; break;
@@ -709,7 +715,7 @@
     case TOK.Imaginary80:
       type = Types.Ireal; break;
     default:
-      assert(token.type == TOK.Float64);
+      assert(token.kind == TOK.Float64);
     }
     this(token.real_, type);
   }