72
|
1 module dmd.TypeidExp;
|
|
2
|
|
3 import dmd.Expression;
|
|
4 import dmd.Type;
|
|
5 import dmd.OutBuffer;
|
|
6 import dmd.Loc;
|
|
7 import dmd.Scope;
|
|
8 import dmd.HdrGenState;
|
|
9 import dmd.TOK;
|
|
10
|
0
|
11 class TypeidExp : Expression
|
|
12 {
|
|
13 Type typeidType;
|
|
14
|
|
15 this(Loc loc, Type typeidType)
|
|
16 {
|
|
17 super(loc, TOK.TOKtypeid, TypeidExp.sizeof);
|
|
18 this.typeidType = typeidType;
|
|
19 }
|
72
|
20
|
|
21 version (DumbClone) {
|
|
22 } else {
|
|
23 Type clone()
|
|
24 {
|
|
25 assert(false);
|
|
26 }
|
0
|
27 }
|
72
|
28 override Expression syntaxCopy()
|
0
|
29 {
|
|
30 return new TypeidExp(loc, typeidType.syntaxCopy());
|
|
31 }
|
|
32
|
72
|
33 override Expression semantic(Scope sc)
|
0
|
34 {
|
|
35 Expression e;
|
|
36
|
|
37 version (LOGSEMANTIC) {
|
|
38 printf("TypeidExp.semantic()\n");
|
|
39 }
|
|
40 typeidType = typeidType.semantic(loc, sc);
|
|
41 e = typeidType.getTypeInfo(sc);
|
|
42 if (e.loc.linnum == 0)
|
|
43 e.loc = loc; // so there's at least some line number info
|
|
44 return e;
|
|
45 }
|
|
46
|
72
|
47 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
0
|
48 {
|
|
49 assert(false);
|
|
50 }
|
|
51 }
|
|
52
|