Mercurial > projects > ddmd
view dmd/ComExp.d @ 98:5c859d5fbe27
and more
author | Trass3r |
---|---|
date | Tue, 31 Aug 2010 03:53:49 +0200 |
parents | 2e2a5c3f943a |
children | e28b18c23469 |
line wrap: on
line source
module dmd.ComExp; import dmd.Expression; import dmd.Identifier; import dmd.backend.elem; import dmd.UnaExp; import dmd.InterState; import dmd.OutBuffer; import dmd.Loc; import dmd.Scope; import dmd.IRState; import dmd.ArrayTypes; import dmd.TOK; import dmd.TY; import dmd.backend.Util; import dmd.backend.OPER; import dmd.expression.Util; import dmd.expression.Com; class ComExp : UnaExp { this(Loc loc, Expression e) { super(loc, TOKtilde, ComExp.sizeof, e); } override Expression semantic(Scope sc) { Expression e; if (!type) { UnaExp.semantic(sc); e1 = resolveProperties(sc, e1); e = op_overload(sc); if (e) return e; e1.checkNoBool(); if (e1.op != TOKslice) e1 = e1.checkIntegral(); type = e1.type; } return this; } override Expression optimize(int result) { Expression e; e1 = e1.optimize(result); if (e1.isConst() == 1) { e = Com(type, e1); } else e = this; return e; } override Expression interpret(InterState istate) { assert(false); } override void buildArrayIdent(OutBuffer buf, Expressions arguments) { assert(false); } override Expression buildArrayLoop(Arguments fparams) { assert(false); } override Identifier opId() { assert(false); } override elem* toElem(IRState* irs) { elem *e; elem *e1 = this.e1.toElem(irs); tym_t ty = type.totym(); if (this.e1.type.toBasetype().ty == Tbool) e = el_bin(OPxor, ty, e1, el_long(ty, 1)); else e = el_una(OPcom,ty,e1); el_setLoc(e,loc); return e; } }