Mercurial > projects > ddmd
view dmd/ShlExp.d @ 0:10317f0c89a5
Initial commit
author | korDen |
---|---|
date | Sat, 24 Oct 2009 08:42:06 +0400 |
parents | |
children | cab4c37afb89 |
line wrap: on
line source
module dmd.ShlExp; import dmd.Expression; import dmd.Identifier; import dmd.backend.elem; import dmd.InterState; import dmd.Loc; import dmd.Scope; import dmd.IntRange; import dmd.IRState; import dmd.BinExp; import dmd.TOK; import dmd.Id; import dmd.Type; import dmd.expression.shift_optimize; import dmd.expression.Shl; import dmd.backend.OPER; class ShlExp : BinExp { this(Loc loc, Expression e1, Expression e2) { super(loc, TOK.TOKshl, ShlExp.sizeof, e1, e2); } Expression semantic(Scope sc) { Expression e; //printf("ShlExp.semantic(), type = %p\n", type); if (!type) { BinExp.semanticp(sc); e = op_overload(sc); if (e) return e; e1 = e1.checkIntegral(); e2 = e2.checkIntegral(); e1 = e1.integralPromotions(sc); e2 = e2.castTo(sc, Type.tshiftcnt); type = e1.type; } return this; } Expression optimize(int result) { //printf("ShlExp::optimize(result = %d) %s\n", result, toChars()); return shift_optimize(result, this, &Shl); } Expression interpret(InterState* istate) { assert(false); } IntRange getIntRange() { assert(false); } Identifier opId() { return Id.shl; } Identifier opId_r() { return Id.shl_r; } elem* toElem(IRState* irs) { return toElemBin(irs, OPER.OPshl); } }