Mercurial > projects > ddmd
view dmd/templates/Util.d @ 132:c494af1dba80
Fixes for dmd 2.037
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Fri, 10 Sep 2010 19:14:09 +0100 |
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; }