annotate dmd/VoidInitializer.d @ 187:b0d41ff5e0df

Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
author Abscissa
date Tue, 07 Jun 2011 23:37:34 -0400
parents e3afd1303184
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.VoidInitializer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 72
diff changeset
3 import dmd.common;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.Initializer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.Expression;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.HdrGenState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
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
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14
187
b0d41ff5e0df Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents: 178
diff changeset
15 import dmd.DDMDExtensions;
b0d41ff5e0df Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents: 178
diff changeset
16
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 class VoidInitializer : Initializer
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 {
187
b0d41ff5e0df Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents: 178
diff changeset
19 mixin insertMemberExtension!(typeof(this));
b0d41ff5e0df Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents: 178
diff changeset
20
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 Type type = null; // type that this will initialize to
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 this(Loc loc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 {
178
e3afd1303184 Many small bugs fixed
korDen
parents: 174
diff changeset
25 register();
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 super(loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
29 override Initializer syntaxCopy()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 {
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 0
diff changeset
31 return new VoidInitializer(loc);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
34 override Initializer semantic(Scope sc, Type t)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 //printf("VoidInitializer.semantic(t = %p)\n", t);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37 type = t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
41 override Expression toExpression()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
46 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 {
174
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 114
diff changeset
48 buf.writestring("void");
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
51 override dt_t* toDt()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 {
68
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
53 /* 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
54 * to set them to in the static data segment.
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
55 */
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
56 dt_t *dt = null;
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
57
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
58 dtnzeros(&dt, cast(uint)type.size());
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
59 return dt;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
62 override VoidInitializer isVoidInitializer() { return this; }
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
63 }