Mercurial > projects > ddmd
annotate dmd/TemplateThisParameter.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 |
---|---|
0 | 1 module dmd.TemplateThisParameter; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.TemplateTypeParameter; |
5 import dmd.Type; | |
6 import dmd.Loc; | |
7 import dmd.Identifier; | |
8 import dmd.TemplateParameter; | |
9 import dmd.OutBuffer; | |
10 import dmd.HdrGenState; | |
11 | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
12 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
|
13 |
0 | 14 class TemplateThisParameter : TemplateTypeParameter |
15 { | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
16 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
|
17 |
0 | 18 /* Syntax: |
19 * this ident : specType = defaultType | |
20 */ | |
21 Type specType; // type parameter: if !=NULL, this is the type specialization | |
22 Type defaultType; | |
23 | |
24 this(Loc loc, Identifier ident, Type specType, Type defaultType) | |
25 { | |
178 | 26 register(); |
0 | 27 super(loc, ident, specType, defaultType); |
28 } | |
29 | |
72 | 30 override TemplateThisParameter isTemplateThisParameter() |
0 | 31 { |
162 | 32 return this; |
0 | 33 } |
34 | |
72 | 35 override TemplateParameter syntaxCopy() |
0 | 36 { |
162 | 37 TemplateThisParameter tp = new TemplateThisParameter(loc, ident, specType, defaultType); |
38 if (tp.specType) | |
39 tp.specType = specType.syntaxCopy(); | |
40 if (defaultType) | |
41 tp.defaultType = defaultType.syntaxCopy(); | |
42 return tp; | |
0 | 43 } |
44 | |
72 | 45 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
0 | 46 { |
162 | 47 buf.writestring("this "); |
48 super.toCBuffer(buf, hgs); | |
0 | 49 } |
72 | 50 } |