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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.TemplateThisParameter;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 72
diff changeset
3 import dmd.common;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.TemplateTypeParameter;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Identifier;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.TemplateParameter;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.HdrGenState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
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
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 class TemplateThisParameter : TemplateTypeParameter
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
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
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 /* Syntax:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 * this ident : specType = defaultType
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 Type specType; // type parameter: if !=NULL, this is the type specialization
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 Type defaultType;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 this(Loc loc, Identifier ident, Type specType, Type defaultType)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 {
178
e3afd1303184 Many small bugs fixed
korDen
parents: 162
diff changeset
26 register();
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 super(loc, ident, specType, defaultType);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 0
diff changeset
30 override TemplateThisParameter isTemplateThisParameter()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 {
162
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 114
diff changeset
32 return this;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 0
diff changeset
35 override TemplateParameter syntaxCopy()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 {
162
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 114
diff changeset
37 TemplateThisParameter tp = new TemplateThisParameter(loc, ident, specType, defaultType);
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 114
diff changeset
38 if (tp.specType)
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 114
diff changeset
39 tp.specType = specType.syntaxCopy();
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 114
diff changeset
40 if (defaultType)
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 114
diff changeset
41 tp.defaultType = defaultType.syntaxCopy();
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 114
diff changeset
42 return tp;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 0
diff changeset
45 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 {
162
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 114
diff changeset
47 buf.writestring("this ");
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 114
diff changeset
48 super.toCBuffer(buf, hgs);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 0
diff changeset
50 }