Mercurial > projects > ddmd
annotate dmd/TypeExp.d @ 192:eb38fdcb3e62 default tip
updated to compile with dmd2.062
author | korDen |
---|---|
date | Sat, 02 Mar 2013 01:25:52 -0800 |
parents | b0d41ff5e0df |
children |
rev | line source |
---|---|
72 | 1 module dmd.TypeExp; |
2 | |
114 | 3 import dmd.common; |
72 | 4 import dmd.Expression; |
104 | 5 import dmd.backend.TYM; |
6 import dmd.backend.Util; | |
72 | 7 import dmd.backend.elem; |
8 import dmd.Type; | |
9 import dmd.OutBuffer; | |
10 import dmd.Loc; | |
11 import dmd.Scope; | |
12 import dmd.IRState; | |
13 import dmd.HdrGenState; | |
14 import dmd.TOK; | |
15 | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
16 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
|
17 |
0 | 18 class TypeExp : Expression |
19 { | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
20 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
|
21 |
0 | 22 this(Loc loc, Type type) |
23 { | |
178 | 24 register(); |
72 | 25 super(loc, TOK.TOKtype, TypeExp.sizeof); |
26 //printf("TypeExp::TypeExp(%s)\n", type->toChars()); | |
0 | 27 this.type = type; |
28 } | |
72 | 29 |
30 override Expression syntaxCopy() | |
0 | 31 { |
32 //printf("TypeExp.syntaxCopy()\n"); | |
33 return new TypeExp(loc, type.syntaxCopy()); | |
34 } | |
35 | |
72 | 36 override Expression semantic(Scope sc) |
0 | 37 { |
72 | 38 //printf("TypeExp::semantic(%s)\n", type->toChars()); |
39 type = type.semantic(loc, sc); | |
0 | 40 return this; |
41 } | |
42 | |
72 | 43 override void rvalue() |
0 | 44 { |
104 | 45 error("type %s has no value", toChars()); |
0 | 46 } |
47 | |
72 | 48 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
0 | 49 { |
72 | 50 type.toCBuffer(buf, null, hgs); |
0 | 51 } |
52 | |
72 | 53 override Expression optimize(int result) |
0 | 54 { |
55 return this; | |
56 } | |
57 | |
72 | 58 override elem* toElem(IRState* irs) |
0 | 59 { |
104 | 60 debug |
61 writef("TypeExp.toElem()\n"); | |
62 | |
63 error("type %s is not an expression", toChars()); | |
64 return el_long(TYint, 0); | |
0 | 65 } |
66 } | |
67 |