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
|
0
|
16 class TypeExp : Expression
|
|
17 {
|
|
18 this(Loc loc, Type type)
|
|
19 {
|
72
|
20 super(loc, TOK.TOKtype, TypeExp.sizeof);
|
|
21 //printf("TypeExp::TypeExp(%s)\n", type->toChars());
|
0
|
22 this.type = type;
|
|
23 }
|
72
|
24
|
|
25 version (DumbClone) {
|
|
26 } else {
|
|
27 Type clone()
|
|
28 {
|
|
29 assert(false);
|
|
30 }
|
0
|
31 }
|
72
|
32 override Expression syntaxCopy()
|
0
|
33 {
|
|
34 //printf("TypeExp.syntaxCopy()\n");
|
|
35 return new TypeExp(loc, type.syntaxCopy());
|
|
36 }
|
|
37
|
72
|
38 override Expression semantic(Scope sc)
|
0
|
39 {
|
72
|
40 //printf("TypeExp::semantic(%s)\n", type->toChars());
|
|
41 type = type.semantic(loc, sc);
|
0
|
42 return this;
|
|
43 }
|
|
44
|
72
|
45 override void rvalue()
|
0
|
46 {
|
104
|
47 error("type %s has no value", toChars());
|
0
|
48 }
|
|
49
|
72
|
50 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
0
|
51 {
|
72
|
52 type.toCBuffer(buf, null, hgs);
|
0
|
53 }
|
|
54
|
72
|
55 override Expression optimize(int result)
|
0
|
56 {
|
|
57 return this;
|
|
58 }
|
|
59
|
72
|
60 override elem* toElem(IRState* irs)
|
0
|
61 {
|
104
|
62 debug
|
|
63 writef("TypeExp.toElem()\n");
|
|
64
|
|
65 error("type %s is not an expression", toChars());
|
|
66 return el_long(TYint, 0);
|
0
|
67 }
|
|
68 }
|
|
69
|