Mercurial > projects > ddmd
annotate dmd/VoidInitializer.d @ 174:af724d3510d7
lot os toCBuffer methods implemented
moved shared Type.* stuff into Global
author | korDen |
---|---|
date | Sun, 10 Oct 2010 03:47:23 +0400 |
parents | e28b18c23469 |
children | e3afd1303184 |
rev | line source |
---|---|
0 | 1 module dmd.VoidInitializer; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.Initializer; |
5 import dmd.Type; | |
6 import dmd.Loc; | |
7 import dmd.Scope; | |
8 import dmd.Expression; | |
9 import dmd.OutBuffer; | |
10 import dmd.HdrGenState; | |
11 | |
12 import dmd.backend.dt_t; | |
68
ee3a9f34dc48
final bits of codegen implementation to compile Phobos
korDen
parents:
51
diff
changeset
|
13 import dmd.backend.Util; |
0 | 14 |
15 class VoidInitializer : Initializer | |
16 { | |
17 Type type = null; // type that this will initialize to | |
18 | |
19 this(Loc loc) | |
20 { | |
21 super(loc); | |
22 } | |
23 | |
72 | 24 override Initializer syntaxCopy() |
0 | 25 { |
51 | 26 return new VoidInitializer(loc); |
0 | 27 } |
28 | |
72 | 29 override Initializer semantic(Scope sc, Type t) |
0 | 30 { |
31 //printf("VoidInitializer.semantic(t = %p)\n", t); | |
32 type = t; | |
33 return this; | |
34 } | |
35 | |
72 | 36 override Expression toExpression() |
0 | 37 { |
38 assert(false); | |
39 } | |
40 | |
72 | 41 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
0 | 42 { |
174 | 43 buf.writestring("void"); |
0 | 44 } |
45 | |
72 | 46 override dt_t* toDt() |
0 | 47 { |
68
ee3a9f34dc48
final bits of codegen implementation to compile Phobos
korDen
parents:
51
diff
changeset
|
48 /* Void initializers are set to 0, just because we need something |
ee3a9f34dc48
final bits of codegen implementation to compile Phobos
korDen
parents:
51
diff
changeset
|
49 * to set them to in the static data segment. |
ee3a9f34dc48
final bits of codegen implementation to compile Phobos
korDen
parents:
51
diff
changeset
|
50 */ |
ee3a9f34dc48
final bits of codegen implementation to compile Phobos
korDen
parents:
51
diff
changeset
|
51 dt_t *dt = null; |
ee3a9f34dc48
final bits of codegen implementation to compile Phobos
korDen
parents:
51
diff
changeset
|
52 |
ee3a9f34dc48
final bits of codegen implementation to compile Phobos
korDen
parents:
51
diff
changeset
|
53 dtnzeros(&dt, cast(uint)type.size()); |
ee3a9f34dc48
final bits of codegen implementation to compile Phobos
korDen
parents:
51
diff
changeset
|
54 return dt; |
0 | 55 } |
56 | |
72 | 57 override VoidInitializer isVoidInitializer() { return this; } |
58 } |