diff dmd/Expression.d @ 141:7171e6ea651d

+ Expression.toElem + Expression.toDt + Expression.isBit + BoolExp.optimize
author Trass3r
date Tue, 14 Sep 2010 02:38:37 +0200
parents af1bebfd96a4
children e3afd1303184
line wrap: on
line diff
--- a/dmd/Expression.d	Tue Sep 14 01:54:48 2010 +0200
+++ b/dmd/Expression.d	Tue Sep 14 02:38:37 2010 +0200
@@ -53,6 +53,7 @@
 import dmd.Complex;
 
 import dmd.backend.elem;
+import dmd.backend.Util;
 import dmd.backend.dt_t;
 
 import core.memory;
@@ -914,9 +915,12 @@
 		return false;
 	}
     
-    int isBit()
+	/********************************
+	 * Does this expression result in either a 1 or a 0?
+	 */
+	int isBit()
 	{
-		assert(false);
+		return false;
 	}
 
 	/********************************
@@ -960,7 +964,6 @@
 	/****************************************
 	 * Resolve __LINE__ and __FILE__ to loc.
 	 */
-
 	Expression resolveLoc(Loc loc, Scope sc)
 	{
 	    return this;
@@ -1064,12 +1067,21 @@
     // Back end
     elem* toElem(IRState* irs)
 	{
+		print();
 		assert(false);
+		return null;
 	}
     
     dt_t** toDt(dt_t** pdt)
 	{
-		assert(false);
+		debug
+		{
+			writef("Expression::toDt() %d\n", op);
+			dump(0);
+		}
+		error("non-constant expression %s", toChars());
+		pdt = dtnzeros(pdt, 1);
+		return pdt;
 	}
 }