Mercurial > projects > ddmd
annotate dmd/TemplateAliasParameter.d @ 13:427f8aa74d28
On the road to make Phobos compilable
author | korDen |
---|---|
date | Mon, 12 Apr 2010 16:29:33 +0400 |
parents | 89cc05dbdae1 |
children | 460959608115 |
rev | line source |
---|---|
0 | 1 module dmd.TemplateAliasParameter; |
2 | |
3 import dmd.TemplateParameter; | |
4 import dmd.Loc; | |
5 import dmd.Identifier; | |
6 import dmd.Type; | |
7 import dmd.ArrayTypes; | |
8 import dmd.Scope; | |
9 import dmd.Declaration; | |
10 import dmd.MATCH; | |
11 import dmd.OutBuffer; | |
12 import dmd.HdrGenState; | |
13 import dmd.Dsymbol; | |
13 | 14 import dmd.TypeIdentifier; |
15 import dmd.AliasDeclaration; | |
16 import dmd.Util; | |
0 | 17 |
7
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
18 import dmd.templates.Util; |
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
19 |
0 | 20 class TemplateAliasParameter : TemplateParameter |
21 { | |
22 /* Syntax: | |
23 * specType ident : specAlias = defaultAlias | |
24 */ | |
25 | |
26 Type specType; | |
27 Object specAlias; | |
28 Object defaultAlias; | |
29 | |
30 static Dsymbol sdummy; | |
31 | |
32 this(Loc loc, Identifier ident, Type specType, Object specAlias, Object defaultAlias) | |
33 { | |
34 super(loc, ident); | |
7
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
35 |
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
36 this.specType = specType; |
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
37 this.specAlias = specAlias; |
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
38 this.defaultAlias = defaultAlias; |
0 | 39 } |
40 | |
41 TemplateAliasParameter isTemplateAliasParameter() | |
42 { | |
7
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
43 return this; |
0 | 44 } |
45 | |
46 TemplateParameter syntaxCopy() | |
47 { | |
7
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
48 TemplateAliasParameter tp = new TemplateAliasParameter(loc, ident, specType, specAlias, defaultAlias); |
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
49 if (tp.specType) |
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
50 tp.specType = specType.syntaxCopy(); |
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
51 tp.specAlias = objectSyntaxCopy(specAlias); |
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
52 tp.defaultAlias = objectSyntaxCopy(defaultAlias); |
89cc05dbdae1
Implementing TemplateAliasParameter and TemplateValueParameter
dkoroskin <>
parents:
0
diff
changeset
|
53 return tp; |
0 | 54 } |
55 | |
56 void declareParameter(Scope sc) | |
57 { | |
13 | 58 TypeIdentifier ti = new TypeIdentifier(loc, ident); |
59 sparam = new AliasDeclaration(loc, ident, ti); | |
60 if (!sc.insert(sparam)) | |
61 error(loc, "parameter '%s' multiply defined", ident.toChars()); | |
0 | 62 } |
63 | |
13 | 64 void semantic(Scope sc) |
0 | 65 { |
13 | 66 if (specType) |
67 { | |
68 specType = specType.semantic(loc, sc); | |
69 } | |
70 specAlias = aliasParameterSemantic(loc, sc, specAlias); | |
71 static if (false) { // Don't do semantic() until instantiation | |
72 if (defaultAlias) | |
73 defaultAlias = defaultAlias.semantic(loc, sc); | |
74 } | |
0 | 75 } |
76 | |
77 void print(Object oarg, Object oded) | |
78 { | |
79 assert(false); | |
80 } | |
81 | |
82 void toCBuffer(OutBuffer buf, HdrGenState* hgs) | |
83 { | |
84 assert(false); | |
85 } | |
86 | |
87 Object specialization() | |
88 { | |
89 assert(false); | |
90 } | |
91 | |
92 Object defaultArg(Loc loc, Scope sc) | |
93 { | |
94 assert(false); | |
95 } | |
96 | |
97 bool overloadMatch(TemplateParameter) | |
98 { | |
99 assert(false); | |
100 } | |
101 | |
102 MATCH matchArg(Scope sc, Objects tiargs, int i, TemplateParameters parameters, Objects dedtypes, Declaration* psparam, int flags) | |
103 { | |
104 assert(false); | |
105 } | |
106 | |
107 void* dummyArg() | |
108 { | |
109 assert(false); | |
110 } | |
111 } |