Mercurial > projects > ddmd
annotate dmd/EnumDeclaration.d @ 138:90821c10b6a7
2.039
author | Trass3r |
---|---|
date | Tue, 14 Sep 2010 00:00:24 +0200 |
parents | e28b18c23469 |
children | e3afd1303184 |
rev | line source |
---|---|
0 | 1 module dmd.EnumDeclaration; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.ScopeDsymbol; |
5 import dmd.AddExp; | |
6 import dmd.Type; | |
7 import dmd.CmpExp; | |
8 import dmd.IntegerExp; | |
9 import dmd.EqualExp; | |
10 import dmd.TOK; | |
11 import dmd.Id; | |
12 import dmd.TY; | |
13 import dmd.DsymbolTable; | |
14 import dmd.STC; | |
15 import dmd.Expression; | |
16 import dmd.Identifier; | |
17 import dmd.Dsymbol; | |
18 import dmd.Scope; | |
19 import dmd.OutBuffer; | |
20 import dmd.HdrGenState; | |
21 import dmd.Global; | |
22 import dmd.Loc; | |
22
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
20
diff
changeset
|
23 import dmd.Module; |
0 | 24 import dmd.TypeEnum; |
25 import dmd.EnumMember; | |
26 import dmd.DYNCAST; | |
27 import dmd.WANT; | |
28 import dmd.Id; | |
79 | 29 import dmd.Json; |
0 | 30 import dmd.Lexer; |
31 | |
32 import dmd.backend.SC; | |
33 import dmd.backend.FL; | |
34 import dmd.backend.Util; | |
35 import dmd.backend.Symbol; | |
36 import dmd.backend.Classsym; | |
37 import dmd.backend.SFL; | |
38 import dmd.backend.LIST; | |
39 import dmd.codegen.Util; | |
40 | |
41 import std.stdio : writef; | |
42 | |
43 class EnumDeclaration : ScopeDsymbol | |
44 { /* enum ident : memtype { ... } | |
45 */ | |
46 Type type; // the TypeEnum | |
47 Type memtype; // type of the members | |
48 | |
79 | 49 version (DMDV1) |
50 { | |
0 | 51 ulong maxval; |
52 ulong minval; | |
53 ulong defaultval; // default initializer | |
79 | 54 } |
55 else | |
56 { | |
0 | 57 Expression maxval; |
58 Expression minval; | |
59 Expression defaultval; // default initializer | |
60 } | |
138 | 61 bool isdeprecated = false; |
62 bool isdone = false; // 0: not done | |
63 // 1: semantic() successfully completed | |
64 | |
0 | 65 this(Loc loc, Identifier id, Type memtype) |
66 { | |
67 super(id); | |
68 this.loc = loc; | |
69 type = new TypeEnum(this); | |
70 this.memtype = memtype; | |
71 } | |
72 | |
72 | 73 override Dsymbol syntaxCopy(Dsymbol s) |
0 | 74 { |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
75 Type t = null; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
76 if (memtype) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
77 t = memtype.syntaxCopy(); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
78 |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
79 EnumDeclaration ed; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
80 if (s) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
81 { ed = cast(EnumDeclaration)s; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
82 ed.memtype = t; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
83 } |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
84 else |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
85 ed = new EnumDeclaration(loc, ident, t); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
86 ScopeDsymbol.syntaxCopy(ed); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
87 return ed; |
0 | 88 } |
89 | |
72 | 90 override void semantic(Scope sc) |
0 | 91 { |
92 Type t; | |
93 Scope sce; | |
94 | |
95 //writef("EnumDeclaration.semantic(sd = %p, '%s') %s\n", sc.scopesym, sc.scopesym.toChars(), toChars()); | |
96 //writef("EnumDeclaration.semantic() %s\n", toChars()); | |
97 if (!members) // enum ident; | |
98 return; | |
99 | |
100 if (!memtype && !isAnonymous()) | |
101 { | |
102 // Set memtype if we can to reduce fwd reference errors | |
103 memtype = Type.tint32; // case 1) enum ident { ... } | |
104 } | |
105 | |
106 if (symtab) // if already done | |
107 { | |
138 | 108 if (isdone || !scope_) |
0 | 109 return; // semantic() already completed |
110 } | |
111 else | |
112 symtab = new DsymbolTable(); | |
113 | |
114 Scope scx = null; | |
115 if (scope_) | |
116 { sc = scope_; | |
117 scx = scope_; // save so we don't make redundant copies | |
118 scope_ = null; | |
119 } | |
120 | |
121 if (sc.stc & STC.STCdeprecated) | |
122 isdeprecated = true; | |
123 | |
124 parent = sc.parent; | |
125 | |
126 /* The separate, and distinct, cases are: | |
127 * 1. enum { ... } | |
128 * 2. enum : memtype { ... } | |
129 * 3. enum ident { ... } | |
130 * 4. enum ident : memtype { ... } | |
131 */ | |
132 | |
133 if (memtype) | |
134 { | |
135 memtype = memtype.semantic(loc, sc); | |
136 | |
137 /* Check to see if memtype is forward referenced | |
138 */ | |
139 if (memtype.ty == TY.Tenum) | |
140 { EnumDeclaration sym = cast(EnumDeclaration)memtype.toDsymbol(sc); | |
141 if (!sym.memtype || !sym.members || !sym.symtab || sym.scope_) | |
142 { | |
143 // memtype is forward referenced, so try again later | |
87
b17640f0e4e8
Fixed a bug with a Scope.this(Scope enclosing) being called instead of Scope.clone() method (as a copy ctor replacement)
korDen
parents:
79
diff
changeset
|
144 scope_ = scx ? scx : sc.clone(); |
0 | 145 scope_.setNoFree(); |
146 scope_.module_.addDeferredSemantic(this); | |
147 writef("\tdeferring %s\n", toChars()); | |
148 return; | |
149 } | |
150 } | |
138 | 151 static if (false) |
152 { | |
0 | 153 // Decided to abandon this restriction for D 2.0 |
154 if (!memtype.isintegral()) | |
155 { error("base type must be of integral type, not %s", memtype.toChars()); | |
156 memtype = Type.tint32; | |
157 } | |
158 } | |
159 } | |
160 | |
138 | 161 isdone = true; |
162 | |
0 | 163 type = type.semantic(loc, sc); |
164 if (isAnonymous()) | |
165 sce = sc; | |
166 else | |
167 { sce = sc.push(this); | |
168 sce.parent = this; | |
169 } | |
170 if (members.dim == 0) | |
171 error("enum %s must have at least one member", toChars()); | |
172 int first = 1; | |
173 Expression elast = null; | |
77
ad4792a1cfd6
more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
72
diff
changeset
|
174 foreach (Dsymbol s; members) |
0 | 175 { |
77
ad4792a1cfd6
more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
72
diff
changeset
|
176 EnumMember em = s.isEnumMember(); |
0 | 177 Expression e; |
178 | |
179 if (!em) | |
180 /* The e.semantic(sce) can insert other symbols, such as | |
181 * template instances and function literals. | |
182 */ | |
183 continue; | |
184 | |
185 //printf(" Enum member '%s'\n",em.toChars()); | |
186 if (em.type) | |
187 em.type = em.type.semantic(em.loc, sce); | |
188 e = em.value; | |
189 if (e) | |
190 { | |
191 assert(e.dyncast() == DYNCAST.DYNCAST_EXPRESSION); | |
192 e = e.semantic(sce); | |
193 e = e.optimize(WANT.WANTvalue | WANT.WANTinterpret); | |
194 if (memtype) | |
195 { | |
196 e = e.implicitCastTo(sce, memtype); | |
197 e = e.optimize(WANT.WANTvalue | WANT.WANTinterpret); | |
198 if (!isAnonymous()) | |
199 e = e.castTo(sce, type); | |
200 t = memtype; | |
201 } | |
202 else if (em.type) | |
203 { | |
204 e = e.implicitCastTo(sce, em.type); | |
205 e = e.optimize(WANT.WANTvalue | WANT.WANTinterpret); | |
206 assert(isAnonymous()); | |
207 t = e.type; | |
208 } | |
209 else | |
210 t = e.type; | |
211 } | |
212 else if (first) | |
213 { | |
214 if (memtype) | |
215 t = memtype; | |
216 else if (em.type) | |
217 t = em.type; | |
218 else | |
219 t = Type.tint32; | |
220 e = new IntegerExp(em.loc, 0, Type.tint32); | |
221 e = e.implicitCastTo(sce, t); | |
222 e = e.optimize(WANT.WANTvalue | WANT.WANTinterpret); | |
223 if (!isAnonymous()) | |
224 e = e.castTo(sce, type); | |
225 } | |
226 else | |
227 { | |
228 // Set value to (elast + 1). | |
229 // But first check that (elast != t.max) | |
230 assert(elast); | |
231 e = new EqualExp(TOK.TOKequal, em.loc, elast, t.getProperty(Loc(0), Id.max)); | |
232 e = e.semantic(sce); | |
233 e = e.optimize(WANT.WANTvalue | WANT.WANTinterpret); | |
234 if (e.toInteger()) | |
235 error("overflow of enum value %s", elast.toChars()); | |
236 | |
237 // Now set e to (elast + 1) | |
238 e = new AddExp(em.loc, elast, new IntegerExp(em.loc, 1, Type.tint32)); | |
239 e = e.semantic(sce); | |
240 e = e.castTo(sce, elast.type); | |
241 e = e.optimize(WANT.WANTvalue | WANT.WANTinterpret); | |
242 } | |
243 elast = e; | |
244 em.value = e; | |
245 | |
246 // Add to symbol table only after evaluating 'value' | |
247 if (isAnonymous()) | |
248 { | |
249 /* Anonymous enum members get added to enclosing scope. | |
250 */ | |
251 for (Scope scxx = sce; scxx; scxx = scxx.enclosing) | |
252 { | |
253 if (scxx.scopesym) | |
254 { | |
255 if (!scxx.scopesym.symtab) | |
256 scxx.scopesym.symtab = new DsymbolTable(); | |
13 | 257 em.addMember(sce, scxx.scopesym, true); |
0 | 258 break; |
259 } | |
260 } | |
261 } | |
262 else | |
13 | 263 em.addMember(sc, this, true); |
0 | 264 |
265 /* Compute .min, .max and .default values. | |
266 * If enum doesn't have a name, we can never identify the enum type, | |
267 * so there is no purpose for a .min, .max or .default | |
268 */ | |
269 if (!isAnonymous()) | |
270 { | |
271 if (first) | |
272 { defaultval = e; | |
273 minval = e; | |
274 maxval = e; | |
275 } | |
276 else | |
277 { Expression ec; | |
278 | |
279 /* In order to work successfully with UDTs, | |
280 * build expressions to do the comparisons, | |
281 * and let the semantic analyzer and constant | |
282 * folder give us the result. | |
283 */ | |
284 | |
285 // Compute if(e < minval) | |
286 ec = new CmpExp(TOK.TOKlt, em.loc, e, minval); | |
287 ec = ec.semantic(sce); | |
288 ec = ec.optimize(WANT.WANTvalue | WANT.WANTinterpret); | |
289 if (ec.toInteger()) | |
290 minval = e; | |
291 | |
292 ec = new CmpExp(TOK.TOKgt, em.loc, e, maxval); | |
293 ec = ec.semantic(sce); | |
294 ec = ec.optimize(WANT.WANTvalue | WANT.WANTinterpret); | |
295 if (ec.toInteger()) | |
296 maxval = e; | |
297 } | |
298 } | |
299 first = 0; | |
300 } | |
301 //printf("defaultval = %lld\n", defaultval); | |
302 | |
303 //if (defaultval) printf("defaultval: %s %s\n", defaultval.toChars(), defaultval.type.toChars()); | |
304 if (sc != sce) | |
305 sce.pop(); | |
306 //members.print(); | |
307 } | |
308 | |
72 | 309 override bool oneMember(Dsymbol* ps) |
0 | 310 { |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
311 if (isAnonymous()) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
312 return Dsymbol.oneMembers(members, ps); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
313 return Dsymbol.oneMember(ps); |
0 | 314 } |
315 | |
72 | 316 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
0 | 317 { |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
318 buf.writestring("enum "); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
319 if (ident) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
320 { buf.writestring(ident.toChars()); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
321 buf.writeByte(' '); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
322 } |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
323 if (memtype) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
324 { |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
325 buf.writestring(": "); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
326 memtype.toCBuffer(buf, null, hgs); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
327 } |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
328 if (!members) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
329 { |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
330 buf.writeByte(';'); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
331 buf.writenl(); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
332 return; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
333 } |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
334 buf.writenl(); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
335 buf.writeByte('{'); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
336 buf.writenl(); |
77
ad4792a1cfd6
more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
72
diff
changeset
|
337 foreach(Dsymbol s; members) |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
338 { |
77
ad4792a1cfd6
more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
72
diff
changeset
|
339 EnumMember em = s.isEnumMember(); |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
340 if (!em) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
341 continue; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
342 //buf.writestring(" "); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
343 em.toCBuffer(buf, hgs); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
344 buf.writeByte(','); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
345 buf.writenl(); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
346 } |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
347 buf.writeByte('}'); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
348 buf.writenl(); |
0 | 349 } |
350 | |
72 | 351 override Type getType() |
0 | 352 { |
353 return type; | |
354 } | |
355 | |
72 | 356 override string kind() |
0 | 357 { |
358 return "enum"; | |
359 } | |
360 | |
361 version (DMDV2) { | |
72 | 362 override Dsymbol search(Loc, Identifier ident, int flags) |
0 | 363 { |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
364 //printf("%s.EnumDeclaration.search('%s')\n", toChars(), ident.toChars()); |
0 | 365 if (scope_) |
366 // Try one last time to resolve this enum | |
367 semantic(scope_); | |
368 | |
369 if (!members || !symtab || scope_) | |
370 { | |
371 error("is forward referenced when looking for '%s'", ident.toChars()); | |
372 //*(char*)0=0; | |
373 return null; | |
374 } | |
375 | |
376 return ScopeDsymbol.search(loc, ident, flags); | |
377 } | |
378 } | |
72 | 379 override bool isDeprecated() // is Dsymbol deprecated? |
0 | 380 { |
381 return isdeprecated; | |
382 } | |
383 | |
72 | 384 override void emitComment(Scope sc) |
0 | 385 { |
386 assert(false); | |
387 } | |
79 | 388 |
389 override void toJsonBuffer(OutBuffer buf) | |
390 { | |
391 //writef("EnumDeclaration.toJsonBuffer()\n"); | |
392 if (isAnonymous()) | |
393 { | |
394 if (members) | |
395 { | |
396 foreach (Dsymbol s; members) | |
397 { | |
398 s.toJsonBuffer(buf); | |
399 buf.writestring(",\n"); | |
400 } | |
401 JsonRemoveComma(buf); | |
402 } | |
403 return; | |
404 } | |
0 | 405 |
79 | 406 buf.writestring("{\n"); |
407 | |
408 JsonProperty(buf, Pname, toChars()); | |
409 JsonProperty(buf, Pkind, kind()); | |
410 if (comment) | |
411 JsonProperty(buf, Pcomment, comment); | |
412 | |
413 if (loc.linnum) | |
414 JsonProperty(buf, Pline, loc.linnum); | |
415 | |
416 if (memtype) | |
417 JsonProperty(buf, "base", memtype.toChars()); | |
418 | |
419 JsonString(buf, Pmembers); | |
420 buf.writestring(" : [\n"); | |
421 size_t offset = buf.offset; | |
422 foreach (Dsymbol s; members) | |
423 { | |
424 if (offset != buf.offset) | |
425 { | |
96 | 426 buf.writestring(",\n"); |
79 | 427 offset = buf.offset; |
428 } | |
429 s.toJsonBuffer(buf); | |
430 } | |
96 | 431 JsonRemoveComma(buf); |
79 | 432 buf.writestring("]\n"); |
433 | |
434 buf.writestring("}\n"); | |
435 } | |
436 | |
72 | 437 override void toDocBuffer(OutBuffer buf) |
0 | 438 { |
439 assert(false); | |
440 } | |
441 | |
72 | 442 override EnumDeclaration isEnumDeclaration() { return this; } |
0 | 443 |
72 | 444 override void toObjFile(int multiobj) // compile to .obj file |
0 | 445 { |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
446 //printf("EnumDeclaration.toObjFile('%s')\n", toChars()); |
0 | 447 version (DMDV2) { |
448 if (isAnonymous()) | |
449 return; | |
450 } | |
451 | |
452 if (global.params.symdebug) | |
453 toDebug(); | |
454 | |
455 type.getTypeInfo(null); // generate TypeInfo | |
456 | |
457 TypeEnum tc = cast(TypeEnum)type; | |
458 if (!tc.sym.defaultval || type.isZeroInit(Loc(0))) { | |
459 ; | |
460 } else { | |
461 SC scclass = SCglobal; | |
462 if (inTemplateInstance()) | |
463 scclass = SCcomdat; | |
464 | |
465 // Generate static initializer | |
466 toInitializer(); | |
467 sinit.Sclass = scclass; | |
468 sinit.Sfl = FLdata; | |
469 version (ELFOBJ) { // Burton | |
470 sinit.Sseg = Segment.CDATA; | |
471 } | |
472 version (MACHOBJ) { | |
473 sinit.Sseg = Segment.DATA; | |
474 } | |
475 version (DMDV1) { | |
476 dtnbytes(&sinit.Sdt, tc.size(0), cast(char*)&tc.sym.defaultval); | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
477 //sinit.Sdt = tc.sym.init.toDt(); |
0 | 478 } |
479 version (DMDV2) { | |
480 tc.sym.defaultval.toDt(&sinit.Sdt); | |
481 } | |
482 outdata(sinit); | |
483 } | |
484 } | |
485 | |
486 void toDebug() | |
487 { | |
488 assert(false); | |
489 } | |
490 | |
72 | 491 override int cvMember(ubyte* p) |
0 | 492 { |
493 assert(false); | |
494 } | |
495 | |
496 Symbol* sinit; | |
497 | |
498 Symbol* toInitializer() | |
499 { | |
500 Symbol* s; | |
501 Classsym* stag; | |
502 | |
503 if (!sinit) | |
504 { | |
505 stag = fake_classsym(Id.ClassInfo); | |
506 Identifier ident_save = ident; | |
507 if (!ident) | |
508 ident = Lexer.uniqueId("__enum"); | |
509 s = toSymbolX("__init", SCextern, stag.Stype, "Z"); | |
510 ident = ident_save; | |
511 s.Sfl = FLextern; | |
512 s.Sflags |= SFLnodebug; | |
513 slist_add(s); | |
514 sinit = s; | |
515 } | |
516 | |
517 return sinit; | |
518 } | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
519 }; |