Mercurial > projects > ddmd
annotate dmd/Package.d @ 178:e3afd1303184
Many small bugs fixed
Made all classes derive from TObject to detect memory leaks (functionality is disabled for now)
Began work on overriding backend memory allocations (to avoid memory leaks)
author | korDen |
---|---|
date | Sun, 17 Oct 2010 07:42:00 +0400 |
parents | e7769d53e750 |
children | b0d41ff5e0df |
rev | line source |
---|---|
0 | 1 module dmd.Package; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.ScopeDsymbol; |
5 import dmd.Identifier; | |
128
e6e542f37b94
Some more Array -> Vector conversions
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
6 import dmd.ArrayTypes; |
0 | 7 import dmd.DsymbolTable; |
8 import dmd.Scope; | |
9 import dmd.Dsymbol; | |
10 import dmd.Module; | |
169 | 11 import dmd.Global; |
0 | 12 import dmd.Util; |
13 | |
14 class Package : ScopeDsymbol | |
15 { | |
16 this(Identifier ident) | |
17 { | |
178 | 18 register(); |
0 | 19 super(ident); |
20 } | |
21 | |
72 | 22 override string kind() |
0 | 23 { |
24 assert(false); | |
25 } | |
26 | |
128
e6e542f37b94
Some more Array -> Vector conversions
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
27 static DsymbolTable resolve(Identifiers packages, Dsymbol* pparent, Package* ppkg) |
0 | 28 { |
169 | 29 DsymbolTable dst = global.modules; |
0 | 30 Dsymbol parent = null; |
31 | |
32 //printf("Package::resolve()\n"); | |
33 if (ppkg) | |
34 *ppkg = null; | |
35 | |
36 if (packages) | |
37 { | |
128
e6e542f37b94
Some more Array -> Vector conversions
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
38 foreach (pid; packages) |
0 | 39 { |
40 Dsymbol p = dst.lookup(pid); | |
41 if (!p) | |
42 { | |
43 p = new Package(pid); | |
44 dst.insert(p); | |
45 p.parent = parent; | |
46 (cast(ScopeDsymbol)p).symtab = new DsymbolTable(); | |
47 } | |
48 else | |
49 { | |
50 assert(p.isPackage()); | |
51 version (TARGET_NET) { //dot net needs modules and packages with same name | |
52 } else { | |
53 if (p.isModule()) | |
54 { | |
55 p.error("module and package have the same name"); | |
56 fatal(); | |
57 break; | |
58 } | |
59 } | |
60 } | |
61 parent = p; | |
62 dst = (cast(Package)p).symtab; | |
63 if (ppkg && !*ppkg) | |
64 *ppkg = cast(Package)p; | |
65 } | |
66 if (pparent) | |
67 { | |
68 *pparent = parent; | |
69 } | |
70 } | |
71 return dst; | |
72 } | |
73 | |
72 | 74 override Package isPackage() { return this; } |
0 | 75 |
72 | 76 override void semantic(Scope sc) { } |
77 } |