Mercurial > projects > ddmd
annotate dmd/DotTypeExp.d @ 187:b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
author | Abscissa |
---|---|
date | Tue, 07 Jun 2011 23:37:34 -0400 |
parents | e3afd1303184 |
children |
rev | line source |
---|---|
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 | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
19 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
|
20 |
0 | 21 class DotTypeExp : UnaExp |
22 { | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
23 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
|
24 |
0 | 25 Dsymbol sym; |
26 | |
27 this(Loc loc, Expression e, Dsymbol s) | |
72 | 28 { |
178 | 29 register(); |
0 | 30 super(loc, TOK.TOKdottype, DotTypeExp.sizeof, e); |
31 this.sym = s; | |
32 this.type = s.getType(); | |
33 } | |
34 | |
72 | 35 override Expression semantic(Scope sc) |
0 | 36 { |
37 version (LOGSEMANTIC) { | |
38 printf("DotTypeExp.semantic('%s')\n", toChars()); | |
39 } | |
40 UnaExp.semantic(sc); | |
41 return this; | |
42 } | |
43 | |
72 | 44 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
0 | 45 { |
46 expToCBuffer(buf, hgs, e1, PREC.PREC_primary); | |
47 buf.writeByte('.'); | |
48 buf.writestring(sym.toChars()); | |
49 } | |
50 | |
72 | 51 override elem* toElem(IRState* irs) |
0 | 52 { |
129 | 53 // Just a pass-thru to e1 |
54 elem *e; | |
55 | |
56 //printf("DotTypeExp.toElem() %s\n", toChars()); | |
57 e = e1.toElem(irs); | |
58 el_setLoc(e,loc); | |
59 return e; | |
0 | 60 } |
61 } | |
62 |