Mercurial > projects > ddmd
diff dmd/IfStatement.d @ 154:14feb7ae01a6
* changed the build system to build a release version if the debug one compiles
and enabled warnings
+ reduced warnings by adding appriopriate overrides
+ IfStatement.interpret()
+ ScopeStatement.interpret()
+ TypeSArray.constConv()
+ TypedefDeclaration.syntaxCopy()
* fixed a bug in StringExp
author | trass3r |
---|---|
date | Wed, 15 Sep 2010 15:32:31 +0200 |
parents | 60bb0fe4563e |
children | af724d3510d7 |
line wrap: on
line diff
--- a/dmd/IfStatement.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/IfStatement.d Wed Sep 15 15:32:31 2010 +0200 @@ -9,6 +9,7 @@ import dmd.Scope; import dmd.InterState; import dmd.OutBuffer; +import dmd.GlobalExpressions; import dmd.HdrGenState; import dmd.InlineCostState; import dmd.InlineDoState; @@ -122,7 +123,36 @@ override Expression interpret(InterState istate) { - assert(false); +version(LOG) + writef("IfStatement::interpret(%s)\n", condition.toChars()); + + if (istate.start is this) + istate.start = null; + if (istate.start) + { + Expression e = null; + if (ifbody) + e = ifbody.interpret(istate); + if (istate.start && elsebody) + e = elsebody.interpret(istate); + return e; + } + + Expression e = condition.interpret(istate); + assert(e); + //if (e is EXP_CANT_INTERPRET) writef("cannot interpret\n"); + if (e !is EXP_CANT_INTERPRET) + { + if (e.isBool(true)) + e = ifbody ? ifbody.interpret(istate) : null; + else if (e.isBool(false)) + e = elsebody ? elsebody.interpret(istate) : null; + else + { + e = EXP_CANT_INTERPRET; + } + } + return e; } override void toCBuffer(OutBuffer buf, HdrGenState* hgs)