Mercurial > projects > dil
comparison trunk/src/cmd/Generate.d @ 396:0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Added asserts to cmd.Generate.syntaxToDoc().
Added if-statements to Declaration, Expression and Statement classes
to check for null variables.
Fixed octal number scanner in Lexer.scanNumber().
Fixes in Parser: skip comma in parseBaseClasses(); changed || to &&;
added 'qword' to list of asm type prefixes.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Fri, 21 Sep 2007 12:47:47 +0200 |
parents | 6440da4adb07 |
children | ad7977fe315a |
comparison
equal
deleted
inserted
replaced
395:ac9cd48151b6 | 396:0a4619735ce9 |
---|---|
295 | 295 |
296 void populateAAs(Node[] nodes) | 296 void populateAAs(Node[] nodes) |
297 { | 297 { |
298 foreach (node; nodes) | 298 foreach (node; nodes) |
299 { | 299 { |
300 assert(node !is null); | 300 assert(delegate bool(){ |
301 foreach (child; node.children) | |
302 if (child is null) | |
303 return false; | |
304 return true; | |
305 }() == true, Format("Node '{0}' has a null child", node.classinfo.name) | |
306 ); | |
301 auto begin = node.begin; | 307 auto begin = node.begin; |
302 if (begin) | 308 if (begin) |
303 { | 309 { |
304 auto end = node.end; | 310 auto end = node.end; |
305 assert(end); | 311 assert(end); |
306 beginNodes[begin] ~= node; | 312 beginNodes[begin] ~= node; |
307 endNodes[end] ~= node; | 313 endNodes[end] ~= node; |
308 } | 314 } |
315 | |
309 if (node.children.length) | 316 if (node.children.length) |
310 populateAAs(node.children); | 317 populateAAs(node.children); |
311 } | 318 } |
312 } | 319 } |
320 assert(delegate bool(){ | |
321 foreach (child; root.children) | |
322 if (child is null) | |
323 return false; | |
324 return true; | |
325 }() == true, Format("Root node has a null child") | |
326 ); | |
313 populateAAs(root.children); | 327 populateAAs(root.children); |
314 | 328 |
315 char[] getTag(NodeCategory nc) | 329 char[] getTag(NodeCategory nc) |
316 { | 330 { |
317 char[] tag; | 331 char[] tag; |