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
|
|
12 class TemplateThisParameter : TemplateTypeParameter
|
|
13 {
|
|
14 /* Syntax:
|
|
15 * this ident : specType = defaultType
|
|
16 */
|
|
17 Type specType; // type parameter: if !=NULL, this is the type specialization
|
|
18 Type defaultType;
|
|
19
|
|
20 this(Loc loc, Identifier ident, Type specType, Type defaultType)
|
|
21 {
|
178
|
22 register();
|
0
|
23 super(loc, ident, specType, defaultType);
|
|
24 }
|
|
25
|
72
|
26 override TemplateThisParameter isTemplateThisParameter()
|
0
|
27 {
|
162
|
28 return this;
|
0
|
29 }
|
|
30
|
72
|
31 override TemplateParameter syntaxCopy()
|
0
|
32 {
|
162
|
33 TemplateThisParameter tp = new TemplateThisParameter(loc, ident, specType, defaultType);
|
|
34 if (tp.specType)
|
|
35 tp.specType = specType.syntaxCopy();
|
|
36 if (defaultType)
|
|
37 tp.defaultType = defaultType.syntaxCopy();
|
|
38 return tp;
|
0
|
39 }
|
|
40
|
72
|
41 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
0
|
42 {
|
162
|
43 buf.writestring("this ");
|
|
44 super.toCBuffer(buf, hgs);
|
0
|
45 }
|
72
|
46 }
|