comparison trunk/src/dil/ast/Declarations.d @ 680:6b3e397229c5

Renamed Statements, Declarations and EnumMember. Statements -> CompoundStatement. Declarations -> CompoundDeclaration. EnumMember -> EnumMemberDeclaration.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Fri, 18 Jan 2008 23:59:41 +0100
parents 64fec49651cf
children 7541c64fc423
comparison
equal deleted inserted replaced
679:ff6971637f88 680:6b3e397229c5
13 import dil.lexer.IdTable; 13 import dil.lexer.IdTable;
14 import dil.semantic.Symbols; 14 import dil.semantic.Symbols;
15 import dil.Enums; 15 import dil.Enums;
16 import common; 16 import common;
17 17
18 class Declarations : Declaration 18 class CompoundDeclaration : Declaration
19 { 19 {
20 this() 20 this()
21 { 21 {
22 hasBody = true; 22 hasBody = true;
23 mixin(set_kind); 23 mixin(set_kind);
26 void opCatAssign(Declaration d) 26 void opCatAssign(Declaration d)
27 { 27 {
28 addChild(d); 28 addChild(d);
29 } 29 }
30 30
31 void opCatAssign(Declarations ds) 31 void opCatAssign(CompoundDeclaration ds)
32 { 32 {
33 addChildren(ds.children); 33 addChildren(ds.children);
34 } 34 }
35 } 35 }
36 36
157 157
158 class EnumDeclaration : Declaration 158 class EnumDeclaration : Declaration
159 { 159 {
160 Identifier* name; 160 Identifier* name;
161 TypeNode baseType; 161 TypeNode baseType;
162 EnumMember[] members; 162 EnumMemberDeclaration[] members;
163 this(Identifier* name, TypeNode baseType, EnumMember[] members, bool hasBody) 163 this(Identifier* name, TypeNode baseType, EnumMemberDeclaration[] members, bool hasBody)
164 { 164 {
165 super.hasBody = hasBody; 165 super.hasBody = hasBody;
166 mixin(set_kind); 166 mixin(set_kind);
167 addOptChild(baseType); 167 addOptChild(baseType);
168 addOptChildren(members); 168 addOptChildren(members);
173 } 173 }
174 174
175 Enum symbol; 175 Enum symbol;
176 } 176 }
177 177
178 class EnumMember : Declaration 178 class EnumMemberDeclaration : Declaration
179 { 179 {
180 Identifier* name; 180 Identifier* name;
181 Expression value; 181 Expression value;
182 this(Identifier* name, Expression value) 182 this(Identifier* name, Expression value)
183 { 183 {
191 191
192 abstract class AggregateDeclaration : Declaration 192 abstract class AggregateDeclaration : Declaration
193 { 193 {
194 Identifier* name; 194 Identifier* name;
195 TemplateParameters tparams; 195 TemplateParameters tparams;
196 Declarations decls; 196 CompoundDeclaration decls;
197 this(Identifier* name, TemplateParameters tparams, Declarations decls) 197 this(Identifier* name, TemplateParameters tparams, CompoundDeclaration decls)
198 { 198 {
199 super.hasBody = decls !is null; 199 super.hasBody = decls !is null;
200 this.name = name; 200 this.name = name;
201 this.tparams = tparams; 201 this.tparams = tparams;
202 this.decls = decls; 202 this.decls = decls;
204 } 204 }
205 205
206 class ClassDeclaration : AggregateDeclaration 206 class ClassDeclaration : AggregateDeclaration
207 { 207 {
208 BaseClassType[] bases; 208 BaseClassType[] bases;
209 this(Identifier* name, TemplateParameters tparams, BaseClassType[] bases, Declarations decls) 209 this(Identifier* name, TemplateParameters tparams, BaseClassType[] bases, CompoundDeclaration decls)
210 { 210 {
211 super(name, tparams, decls); 211 super(name, tparams, decls);
212 mixin(set_kind); 212 mixin(set_kind);
213 addOptChild(tparams); 213 addOptChild(tparams);
214 addOptChildren(bases); 214 addOptChildren(bases);
221 } 221 }
222 222
223 class InterfaceDeclaration : AggregateDeclaration 223 class InterfaceDeclaration : AggregateDeclaration
224 { 224 {
225 BaseClassType[] bases; 225 BaseClassType[] bases;
226 this(Identifier* name, TemplateParameters tparams, BaseClassType[] bases, Declarations decls) 226 this(Identifier* name, TemplateParameters tparams, BaseClassType[] bases, CompoundDeclaration decls)
227 { 227 {
228 super(name, tparams, decls); 228 super(name, tparams, decls);
229 mixin(set_kind); 229 mixin(set_kind);
230 addOptChild(tparams); 230 addOptChild(tparams);
231 addOptChildren(bases); 231 addOptChildren(bases);
240 } 240 }
241 241
242 class StructDeclaration : AggregateDeclaration 242 class StructDeclaration : AggregateDeclaration
243 { 243 {
244 uint alignSize; 244 uint alignSize;
245 this(Identifier* name, TemplateParameters tparams, Declarations decls) 245 this(Identifier* name, TemplateParameters tparams, CompoundDeclaration decls)
246 { 246 {
247 super(name, tparams, decls); 247 super(name, tparams, decls);
248 mixin(set_kind); 248 mixin(set_kind);
249 addOptChild(tparams); 249 addOptChild(tparams);
250 addOptChild(decls); 250 addOptChild(decls);
258 Struct symbol; /// The struct symbol for this declaration. 258 Struct symbol; /// The struct symbol for this declaration.
259 } 259 }
260 260
261 class UnionDeclaration : AggregateDeclaration 261 class UnionDeclaration : AggregateDeclaration
262 { 262 {
263 this(Identifier* name, TemplateParameters tparams, Declarations decls) 263 this(Identifier* name, TemplateParameters tparams, CompoundDeclaration decls)
264 { 264 {
265 super(name, tparams, decls); 265 super(name, tparams, decls);
266 mixin(set_kind); 266 mixin(set_kind);
267 addOptChild(tparams); 267 addOptChild(tparams);
268 addOptChild(decls); 268 addOptChild(decls);
486 486
487 class TemplateDeclaration : Declaration 487 class TemplateDeclaration : Declaration
488 { 488 {
489 Identifier* name; 489 Identifier* name;
490 TemplateParameters tparams; 490 TemplateParameters tparams;
491 Declarations decls; 491 CompoundDeclaration decls;
492 this(Identifier* name, TemplateParameters tparams, Declarations decls) 492 this(Identifier* name, TemplateParameters tparams, CompoundDeclaration decls)
493 { 493 {
494 super.hasBody = true; 494 super.hasBody = true;
495 mixin(set_kind); 495 mixin(set_kind);
496 addOptChild(tparams); 496 addOptChild(tparams);
497 addChild(decls); 497 addChild(decls);