Mercurial > projects > ddmd
annotate dmd/DtorDeclaration.d @ 79:43073c7c7769
updated to 2.035
also implemented a few missing functions
still crashes in Import.importAll though
author | Trass3r |
---|---|
date | Mon, 30 Aug 2010 03:57:51 +0200 |
parents | 7e0d548de9e6 |
children | 5c859d5fbe27 |
rev | line source |
---|---|
0 | 1 module dmd.DtorDeclaration; |
2 | |
3 import dmd.FuncDeclaration; | |
4 import dmd.Loc; | |
5 import dmd.Global; | |
6 import dmd.Identifier; | |
7 import dmd.Dsymbol; | |
8 import dmd.Scope; | |
9 import dmd.LINK; | |
10 import dmd.AggregateDeclaration; | |
11 import dmd.TypeFunction; | |
12 import dmd.Type; | |
13 import dmd.OutBuffer; | |
14 import dmd.HdrGenState; | |
15 import dmd.STC; | |
16 import dmd.Id; | |
17 | |
18 class DtorDeclaration : FuncDeclaration | |
19 { | |
20 this(Loc loc, Loc endloc) | |
21 { | |
22 super(loc, endloc, Id.dtor, STCundefined, null); | |
23 } | |
24 | |
25 this(Loc loc, Loc endloc, Identifier id) | |
26 { | |
27 assert(false); | |
28 super(loc, endloc, null, STC.init, null); | |
29 } | |
30 | |
72 | 31 override Dsymbol syntaxCopy(Dsymbol) |
0 | 32 { |
33 assert(false); | |
34 } | |
35 | |
72 | 36 override void semantic(Scope sc) |
0 | 37 { |
38 //printf("DtorDeclaration::semantic() %s\n", toChars()); | |
39 //printf("ident: %s, %s, %p, %p\n", ident.toChars(), Id::dtor.toChars(), ident, Id::dtor); | |
40 parent = sc.parent; | |
41 Dsymbol parent = toParent(); | |
42 AggregateDeclaration ad = parent.isAggregateDeclaration(); | |
43 if (!ad) | |
44 { | |
45 error("destructors are only for class/struct/union definitions, not %s %s", parent.kind(), parent.toChars()); | |
46 } | |
47 else if (ident == Id.dtor) | |
74
7e0d548de9e6
Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
72
diff
changeset
|
48 ad.dtors.push(this); |
0 | 49 |
50 type = new TypeFunction(null, Type.tvoid, false, LINK.LINKd); | |
51 | |
52 sc = sc.push(); | |
53 sc.stc &= ~STCstatic; // not a static destructor | |
54 sc.linkage = LINK.LINKd; | |
55 | |
56 FuncDeclaration.semantic(sc); | |
57 | |
58 sc.pop(); | |
59 } | |
60 | |
72 | 61 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
0 | 62 { |
63 assert(false); | |
64 } | |
79 | 65 |
66 override void toJsonBuffer(OutBuffer buf) | |
67 { | |
68 } | |
0 | 69 |
72 | 70 override string kind() |
0 | 71 { |
72 assert(false); | |
73 } | |
74 | |
72 | 75 override string toChars() |
0 | 76 { |
77 return "~this"; | |
78 } | |
79 | |
72 | 80 override bool isVirtual() |
0 | 81 { |
82 /* This should be FALSE so that dtor's don't get put into the vtbl[], | |
83 * but doing so will require recompiling everything. | |
84 */ | |
85 version (BREAKABI) { | |
86 return false; | |
87 } else { | |
88 return FuncDeclaration.isVirtual(); | |
89 } | |
90 } | |
91 | |
72 | 92 override bool addPreInvariant() |
0 | 93 { |
94 return (isThis() && vthis && global.params.useInvariants); | |
95 } | |
96 | |
72 | 97 override bool addPostInvariant() |
0 | 98 { |
99 return false; | |
100 } | |
101 | |
72 | 102 override bool overloadInsert(Dsymbol s) |
0 | 103 { |
104 assert(false); | |
105 } | |
106 | |
72 | 107 override void emitComment(Scope sc) |
0 | 108 { |
109 assert(false); | |
110 } | |
111 | |
72 | 112 override DtorDeclaration isDtorDeclaration() { return this; } |
113 } |