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 {
|
0
|
25 super(loc, TOK.TOKdottype, DotTypeExp.sizeof, e);
|
|
26 this.sym = s;
|
|
27 this.type = s.getType();
|
|
28 }
|
|
29
|
72
|
30 override Expression semantic(Scope sc)
|
0
|
31 {
|
|
32 version (LOGSEMANTIC) {
|
|
33 printf("DotTypeExp.semantic('%s')\n", toChars());
|
|
34 }
|
|
35 UnaExp.semantic(sc);
|
|
36 return this;
|
|
37 }
|
|
38
|
72
|
39 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
0
|
40 {
|
|
41 expToCBuffer(buf, hgs, e1, PREC.PREC_primary);
|
|
42 buf.writeByte('.');
|
|
43 buf.writestring(sym.toChars());
|
|
44 }
|
|
45
|
72
|
46 override elem* toElem(IRState* irs)
|
0
|
47 {
|
129
|
48 // Just a pass-thru to e1
|
|
49 elem *e;
|
|
50
|
|
51 //printf("DotTypeExp.toElem() %s\n", toChars());
|
|
52 e = e1.toElem(irs);
|
|
53 el_setLoc(e,loc);
|
|
54 return e;
|
0
|
55 }
|
|
56 }
|
|
57
|