Mercurial > projects > ddmd
view dmd/Package.d @ 84:be2ab491772e
Expressions -> Vector!Expression
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 16:12:19 +0100 |
parents | 2e2a5c3f943a |
children | e28b18c23469 |
line wrap: on
line source
module dmd.Package; import dmd.ScopeDsymbol; import dmd.Identifier; import dmd.Array; import dmd.DsymbolTable; import dmd.Scope; import dmd.Dsymbol; import dmd.Module; import dmd.Util; class Package : ScopeDsymbol { this(Identifier ident) { super(ident); } override string kind() { assert(false); } static DsymbolTable resolve(Array packages, Dsymbol* pparent, Package* ppkg) { DsymbolTable dst = Module.modules; Dsymbol parent = null; //printf("Package::resolve()\n"); if (ppkg) *ppkg = null; if (packages) { for (int i = 0; i < packages.dim; i++) { Identifier pid = cast(Identifier)packages.data[i]; Dsymbol p = dst.lookup(pid); if (!p) { p = new Package(pid); dst.insert(p); p.parent = parent; (cast(ScopeDsymbol)p).symtab = new DsymbolTable(); } else { assert(p.isPackage()); version (TARGET_NET) { //dot net needs modules and packages with same name } else { if (p.isModule()) { p.error("module and package have the same name"); fatal(); break; } } } parent = p; dst = (cast(Package)p).symtab; if (ppkg && !*ppkg) *ppkg = cast(Package)p; } if (pparent) { *pparent = parent; } } return dst; } override Package isPackage() { return this; } override void semantic(Scope sc) { } }