72
|
1 module dmd.DotTypeExp;
|
|
2
|
114
|
3 import dmd.common;
|
72
|
4 import dmd.Expression;
|
|
5 import dmd.backend.elem;
|
|
6 import dmd.UnaExp;
|
|
7 import dmd.OutBuffer;
|
|
8 import dmd.Loc;
|
|
9 import dmd.Scope;
|
|
10 import dmd.IRState;
|
|
11 import dmd.HdrGenState;
|
|
12 import dmd.Dsymbol;
|
0
|
13 import dmd.TOK;
|
|
14 import dmd.PREC;
|
72
|
15 import dmd.expression.Util;
|
|
16
|
129
|
17 import dmd.backend.Util;
|
|
18
|
0
|
19 class DotTypeExp : UnaExp
|
|
20 {
|
|
21 Dsymbol sym;
|
|
22
|
|
23 this(Loc loc, Expression e, Dsymbol s)
|
72
|
24 {
|
178
|
25 register();
|
0
|
26 super(loc, TOK.TOKdottype, DotTypeExp.sizeof, e);
|
|
27 this.sym = s;
|
|
28 this.type = s.getType();
|
|
29 }
|
|
30
|
72
|
31 override Expression semantic(Scope sc)
|
0
|
32 {
|
|
33 version (LOGSEMANTIC) {
|
|
34 printf("DotTypeExp.semantic('%s')\n", toChars());
|
|
35 }
|
|
36 UnaExp.semantic(sc);
|
|
37 return this;
|
|
38 }
|
|
39
|
72
|
40 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
0
|
41 {
|
|
42 expToCBuffer(buf, hgs, e1, PREC.PREC_primary);
|
|
43 buf.writeByte('.');
|
|
44 buf.writestring(sym.toChars());
|
|
45 }
|
|
46
|
72
|
47 override elem* toElem(IRState* irs)
|
0
|
48 {
|
129
|
49 // Just a pass-thru to e1
|
|
50 elem *e;
|
|
51
|
|
52 //printf("DotTypeExp.toElem() %s\n", toChars());
|
|
53 e = e1.toElem(irs);
|
|
54 el_setLoc(e,loc);
|
|
55 return e;
|
0
|
56 }
|
|
57 }
|
|
58
|