Mercurial > projects > ddmd
view dmd/templates/Util.d @ 191:52188e7e3fb5
Fixed deprecated features, now compiles with DMD2.058
Also changed Array allocation policy:
Now doesn't reallocate but malloc's, followed by a memcpy (no free).
(this fixes a crash while compiling druntime. Same bug in dmd)
author | korDen@korDen-pc |
---|---|
date | Sun, 25 Mar 2012 03:11:12 +0400 |
parents | e28b18c23469 |
children |
line wrap: on
line source
module dmd.templates.Util; import dmd.common; import dmd.Dsymbol; import dmd.Type; import dmd.Expression; import dmd.Loc; import dmd.Scope; import dmd.WANT; version (DMDV2) { Object objectSyntaxCopy(Object o) { if (!o) return null; Type t = isType(o); if (t) return t.syntaxCopy(); Expression e = isExpression(o); if (e) return e.syntaxCopy(); return o; } } Object aliasParameterSemantic(Loc loc, Scope sc, Object o) { if (o) { Expression ea = isExpression(o); Type ta = isType(o); if (ta) { Dsymbol s = ta.toDsymbol(sc); if (s) o = s; else o = ta.semantic(loc, sc); } else if (ea) { ea = ea.semantic(sc); o = ea.optimize(WANTvalue | WANTinterpret); } } return o; }