comparison trunk/src/dil/SyntaxTree.d @ 489:a7291d3ee9d7

Refactored classes that inherit from Node. Added methods addChild(), addOptChild(), addChildren(), addOptChildren() to class Node. Refactored subclasses to use the new methods instead of appending directly to the array Node.children. Moved enums StorageClass and Protection to new module dil.Enums. Added members stc, prot, isStatic() and isPulic() to Declaration.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Mon, 03 Dec 2007 22:44:27 +0100
parents cfb3805768b6
children 47be6bfe39cd
comparison
equal deleted inserted replaced
488:cfb3805768b6 489:a7291d3ee9d7
243 void setTokens(Token* begin, Token* end) 243 void setTokens(Token* begin, Token* end)
244 { 244 {
245 this.begin = begin; 245 this.begin = begin;
246 this.end = end; 246 this.end = end;
247 } 247 }
248 } 248
249 void addChild(Node child)
250 {
251 assert(child !is null, "failed in " ~ this.classinfo.name);
252 this.children ~= child;
253 }
254
255 void addOptChild(Node child)
256 {
257 child is null || addChild(child);
258 }
259
260 void addChildren(Node[] children)
261 {
262 assert(children !is null && delegate{
263 foreach (child; children)
264 if (child is null)
265 return false;
266 return true; }(),
267 "failed in " ~ this.classinfo.name
268 );
269 this.children ~= children;
270 }
271
272 void addOptChildren(Node[] children)
273 {
274 children is null || addChildren(children);
275 }
276 }