Mercurial > projects > ddmd
view dmd/PostExp.d @ 63:cab4c37afb89
A bunch of implementations
author | korDen |
---|---|
date | Mon, 23 Aug 2010 16:52:24 +0400 |
parents | 10317f0c89a5 |
children | 2e2a5c3f943a |
line wrap: on
line source
module dmd.PostExp; import dmd.Expression; import dmd.Identifier; import dmd.backend.elem; import dmd.InterState; import dmd.OutBuffer; import dmd.Loc; import dmd.Scope; import dmd.IRState; import dmd.BinExp; import dmd.HdrGenState; import dmd.IntegerExp; import dmd.TOK; import dmd.Type; import dmd.TY; import dmd.Id; import dmd.backend.Util; import dmd.backend.OPER; class PostExp : BinExp { this(TOK op, Loc loc, Expression e) { super(loc, op, PostExp.sizeof, e, new IntegerExp(loc, 1, Type.tint32)); } Expression semantic(Scope sc) { Expression e = this; if (!type) { BinExp.semantic(sc); e2 = resolveProperties(sc, e2); e = op_overload(sc); if (e) return e; e = this; e1 = e1.modifiableLvalue(sc, e1); e1.checkScalar(); e1.checkNoBool(); if (e1.type.ty == Tpointer) e = scaleFactor(sc); else e2 = e2.castTo(sc, e1.type); e.type = e1.type; } return e; } Expression interpret(InterState istate) { assert(false); } void toCBuffer(OutBuffer buf, HdrGenState* hgs) { assert(false); } Identifier opId() { return (op == TOKplusplus) ? Id.postinc : Id.postdec; } elem* toElem(IRState* irs) { elem* e; elem* einc; e = e1.toElem(irs); einc = e2.toElem(irs); e = el_bin((op == TOKplusplus) ? OPpostinc : OPpostdec, e.Ety,e,einc); el_setLoc(e,loc); return e; } }