Mercurial > projects > ddmd
diff dmd/DeleteExp.d @ 174:af724d3510d7
lot os toCBuffer methods implemented
moved shared Type.* stuff into Global
author | korDen |
---|---|
date | Sun, 10 Oct 2010 03:47:23 +0400 |
parents | e28b18c23469 |
children | e3afd1303184 |
line wrap: on
line diff
--- a/dmd/DeleteExp.d Sun Oct 10 01:55:35 2010 +0400 +++ b/dmd/DeleteExp.d Sun Oct 10 03:47:23 2010 +0400 @@ -11,6 +11,7 @@ import dmd.HdrGenState; import dmd.Type; import dmd.IndexExp; +import dmd.PREC; import dmd.Global; import dmd.VarExp; import dmd.Identifier; @@ -31,6 +32,7 @@ import dmd.TypeAArray; import dmd.TypeSArray; +import dmd.expression.Util; import dmd.codegen.Util; import dmd.backend.Util; import dmd.backend.OPER; @@ -57,9 +59,9 @@ tb = e1.type.toBasetype(); switch (tb.ty) - { + { case Tclass: - { + { TypeClass tc = cast(TypeClass)tb; ClassDeclaration cd = tc.sym; @@ -93,7 +95,7 @@ VarDeclaration v; if (fd && f) - { + { Identifier id = Lexer.idPool("__tmp"); v = new VarDeclaration(loc, e1.type, id, new ExpInitializer(loc, e1)); v.semantic(sc); @@ -103,7 +105,7 @@ } if (fd) - { + { Expression e = ea ? new VarExp(loc, v) : e1; e = new DotVarExp(Loc(0), e, fd, 0); eb = new CallExp(loc, e); @@ -140,13 +142,13 @@ error("cannot delete type %s", e1.type.toChars()); break; } - + if (e1.op == TOKindex) { IndexExp ae = cast(IndexExp)e1; Type tb1 = ae.e1.type.toBasetype(); if (tb1.ty == Taarray) - { + { if (!global.params.useDeprecated) error("delete aa[key] deprecated, use aa.remove(key)"); } @@ -167,7 +169,8 @@ override void toCBuffer(OutBuffer buf, HdrGenState* hgs) { - assert(false); + buf.writestring("delete "); + expToCBuffer(buf, hgs, e1, precedence[op]); } override elem* toElem(IRState* irs) @@ -209,7 +212,7 @@ switch (tb.ty) { case Tarray: - { + { e = addressElem(e, e1.type); rtl = RTLSYM_DELARRAYT; @@ -218,12 +221,12 @@ elem *et = null; Type tv = tb.nextOf().toBasetype(); while (tv.ty == Tsarray) - { + { TypeSArray ta = cast(TypeSArray)tv; tv = tv.nextOf().toBasetype(); } if (tv.ty == Tstruct) - { + { TypeStruct ts = cast(TypeStruct)tv; StructDeclaration sd = ts.sym; if (sd.dtor) @@ -238,7 +241,7 @@ } case Tclass: if (e1.op == TOKvar) - { + { VarExp ve = cast(VarExp)e1; if (ve.var.isVarDeclaration() && ve.var.isVarDeclaration().onstack)