Mercurial > projects > ddmd
diff dmd/BoolExp.d @ 0:10317f0c89a5
Initial commit
author | korDen |
---|---|
date | Sat, 24 Oct 2009 08:42:06 +0400 |
parents | |
children | 3012e829306f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dmd/BoolExp.d Sat Oct 24 08:42:06 2009 +0400 @@ -0,0 +1,54 @@ +module dmd.BoolExp; + +import dmd.Expression; +import dmd.backend.elem; +import dmd.UnaExp; +import dmd.InterState; +import dmd.Type; +import dmd.Loc; +import dmd.Scope; +import dmd.IRState; +import dmd.TOK; + +import dmd.backend.OPER; +import dmd.backend.Util; + +class BoolExp : UnaExp +{ + this(Loc loc, Expression e, Type t) + { + super(loc, TOK.init, 0, e); + type = t; + } + + Expression semantic(Scope sc) + { + UnaExp.semantic(sc); + e1 = resolveProperties(sc, e1); + e1 = e1.checkToBoolean(); + type = Type.tboolean; + return this; + } + + Expression optimize(int result) + { + assert(false); + } + + Expression interpret(InterState* istate) + { + assert(false); + } + + int isBit() + { + return true; + } + + elem* toElem(IRState* irs) + { + elem* e1 = this.e1.toElem(irs); + return el_una(OPbool,type.totym(),e1); + } +} +