Mercurial > projects > ddmd
diff dmd/RealExp.d @ 148:fe2e1b93e88f
phobos compiles now:
* fixed upgrade mistake in interpret.Util
+ implemented missing methods in RealExp,VarExp
author | Trass3r |
---|---|
date | Wed, 15 Sep 2010 03:58:55 +0200 |
parents | ea6325d0edd9 |
children | b7b61140701d |
line wrap: on
line diff
--- a/dmd/RealExp.d Tue Sep 14 23:49:12 2010 +0100 +++ b/dmd/RealExp.d Wed Sep 15 03:58:55 2010 +0200 @@ -24,6 +24,7 @@ import dmd.backend.mTY; import std.stdio; +import std.string; class RealExp : Expression { @@ -52,7 +53,7 @@ } } - return 0; + return false; } override Expression semantic(Scope sc) @@ -66,22 +67,31 @@ override Expression interpret(InterState istate) { - assert(false); +version(LOG) + writef("RealExp::interpret() %s\n", toChars()); + + return this; } override string toChars() { - assert(false); + return format(type.isimaginary() ? "%gi" : "%g", value); } override ulong toInteger() { - assert(false); +version(IN_GCC) + return toReal().toInt(); +else + return cast(ulong) toReal(); } override ulong toUInteger() { - assert(false); +version(IN_GCC) + return cast(ulong) toReal().toInt(); +else + return cast(ulong) toReal(); } override real toReal() @@ -129,7 +139,7 @@ override void toCBuffer(OutBuffer buf, HdrGenState* hgs) { - floatToBuffer(buf, type, value); + floatToBuffer(buf, type, value); } override void toMangleBuffer(OutBuffer buf) @@ -176,7 +186,7 @@ print(); ///type.print(); ///type.toBasetype().print(); - printf("ty = %d, tym = %lx\n", type.ty, ty); + printf("ty = %d, tym = %lx\n", type.ty, ty); assert(0); } return el_const(ty, &c); @@ -221,5 +231,4 @@ } return pdt; } -} - +} \ No newline at end of file