diff 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
line wrap: on
line diff
--- a/trunk/src/cmd/Generate.d	Wed Sep 19 23:12:20 2007 +0300
+++ b/trunk/src/cmd/Generate.d	Fri Sep 21 12:47:47 2007 +0200
@@ -297,7 +297,13 @@
   {
     foreach (node; nodes)
     {
-      assert(node !is null);
+      assert(delegate bool(){
+          foreach (child; node.children)
+            if (child is null)
+              return false;
+          return true;
+        }() == true, Format("Node '{0}' has a null child", node.classinfo.name)
+      );
       auto begin = node.begin;
       if (begin)
       {
@@ -306,10 +312,18 @@
         beginNodes[begin] ~= node;
         endNodes[end] ~= node;
       }
+
       if (node.children.length)
         populateAAs(node.children);
     }
   }
+  assert(delegate bool(){
+      foreach (child; root.children)
+        if (child is null)
+          return false;
+      return true;
+    }() == true, Format("Root node has a null child")
+  );
   populateAAs(root.children);
 
   char[] getTag(NodeCategory nc)