comparison trunk/src/dil/ast/Parameter.d @ 605:9daa6c34c45a

Moved template parameter classes to dil.ast.Parameter.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 06 Jan 2008 01:09:54 +0100
parents 87f09469d337
children
comparison
equal deleted inserted replaced
604:87f09469d337 605:9daa6c34c45a
67 { return cast(Parameter[])children; } 67 { return cast(Parameter[])children; }
68 68
69 size_t length() 69 size_t length()
70 { return children.length; } 70 { return children.length; }
71 } 71 }
72
73 /*********************
74 Template parameters:
75 */
76
77 abstract class TemplateParameter : Node
78 {
79 Identifier* ident;
80 this(Identifier* ident)
81 {
82 super(NodeCategory.Other);
83 this.ident = ident;
84 }
85 }
86
87 class TemplateAliasParameter : TemplateParameter
88 {
89 TypeNode specType, defType;
90 this(Identifier* ident, TypeNode specType, TypeNode defType)
91 {
92 super(ident);
93 mixin(set_kind);
94 addOptChild(specType);
95 addOptChild(defType);
96 this.ident = ident;
97 this.specType = specType;
98 this.defType = defType;
99 }
100 }
101
102 class TemplateTypeParameter : TemplateParameter
103 {
104 TypeNode specType, defType;
105 this(Identifier* ident, TypeNode specType, TypeNode defType)
106 {
107 super(ident);
108 mixin(set_kind);
109 addOptChild(specType);
110 addOptChild(defType);
111 this.ident = ident;
112 this.specType = specType;
113 this.defType = defType;
114 }
115 }
116
117 version(D2)
118 {
119 class TemplateThisParameter : TemplateParameter
120 {
121 TypeNode specType, defType;
122 this(Identifier* ident, TypeNode specType, TypeNode defType)
123 {
124 super(ident);
125 mixin(set_kind);
126 addOptChild(specType);
127 addOptChild(defType);
128 this.ident = ident;
129 this.specType = specType;
130 this.defType = defType;
131 }
132 }
133 }
134
135 class TemplateValueParameter : TemplateParameter
136 {
137 TypeNode valueType;
138 Expression specValue, defValue;
139 this(TypeNode valueType, Identifier* ident, Expression specValue, Expression defValue)
140 {
141 super(ident);
142 mixin(set_kind);
143 addChild(valueType);
144 addOptChild(specValue);
145 addOptChild(defValue);
146 this.valueType = valueType;
147 this.ident = ident;
148 this.specValue = specValue;
149 this.defValue = defValue;
150 }
151 }
152
153 class TemplateTupleParameter : TemplateParameter
154 {
155 this(Identifier* ident)
156 {
157 super(ident);
158 mixin(set_kind);
159 this.ident = ident;
160 }
161 }
162
163 class TemplateParameters : Node
164 {
165 this()
166 {
167 super(NodeCategory.Other);
168 mixin(set_kind);
169 }
170
171 void opCatAssign(TemplateParameter parameter)
172 {
173 addChild(parameter);
174 }
175
176 TemplateParameter[] items()
177 {
178 return cast(TemplateParameter[])children;
179 }
180 }
181
182 class TemplateArguments : Node
183 {
184 this()
185 {
186 super(NodeCategory.Other);
187 mixin(set_kind);
188 }
189
190 void opCatAssign(Node argument)
191 {
192 addChild(argument);
193 }
194 }