Mercurial > projects > ddmd
view dmd/type/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 | b7b61140701d |
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; } 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; }