Mercurial > projects > ddmd
view dmd/type/Util.d @ 182:b64060ab22df
Now compileable with dmd2.050
author | korDen |
---|---|
date | Sat, 30 Oct 2010 05:05:32 +0400 |
parents | b7b61140701d |
children |
line wrap: on
line source
module dmd.type.Util; import dmd.common; import dmd.TY; import dmd.Expression; import dmd.Scope; import dmd.Type; import dmd.TupleDeclaration; import dmd.TypeTuple; import dmd.ScopeDsymbol; import dmd.ArrayScopeSymbol; /************************** * This evaluates exp while setting length to be the number * of elements in the tuple t. */ Expression semanticLength(Scope sc, Type t, Expression exp) { if (t.ty == TY.Ttuple) { ScopeDsymbol sym = new ArrayScopeSymbol(sc, cast(TypeTuple)t); sym.parent = sc.scopesym; sc = sc.push(sym); exp = exp.semantic(sc); sc.pop(); } else exp = exp.semantic(sc); return exp; } //! ditto Expression semanticLength(Scope sc, TupleDeclaration s, Expression exp) { assert(false); ScopeDsymbol sym = new ArrayScopeSymbol(sc, s); sym.parent = sc.scopesym; sc = sc.push(sym); exp = exp.semantic(sc); sc.pop(); return exp; }