tracking down issues in sym tree destructor still
[feisty_meow.git] / nucleus / library / nodes / symbol_tree.cpp
index 947d4530463ea09978255639f9d77bf124db8b4f..bd985a27a1c883f6790849ff8b2ab9c65b5c5a2b 100644 (file)
@@ -19,7 +19,7 @@
 #include <textual/parser_bits.h>
 #include <textual/string_manipulation.h>
 
-#define DEBUG_SYMBOL_TREE
+//#define DEBUG_SYMBOL_TREE
   // uncomment for totally noisy version.
 
 #include <loggers/program_wide_logger.h>
@@ -33,12 +33,14 @@ using namespace textual;
 
 namespace nodes {
 
+//hmmm: used for... explain please.
 class symbol_tree_associations : public symbol_table<symbol_tree *>
 {
 public:
   symbol_tree_associations(int estimated_elements)
       :  symbol_table<symbol_tree *>(estimated_elements) {}
   virtual ~symbol_tree_associations() {
+//hmmm: why was this here?  was it ever needed?
 //    for (int i = 0; i < symbols(); i++) {
 //      WHACK(use(i));
 //    }
@@ -91,8 +93,12 @@ outcome symbol_tree::prune(tree *to_zap_in)
   FUNCDEF("prune");
 #endif
   symbol_tree *to_zap = dynamic_cast<symbol_tree *>(to_zap_in);
-  if (!to_zap)
+  if (!to_zap) {
+#ifdef DEBUG_SYMBOL_TREE
+    LOG("about to barf due to null symtree after dynamic cast.");
+#endif
     throw("error: symbol_tree::prune: wrong type of node in prune");
+  }
 #ifdef DEBUG_SYMBOL_TREE
   LOG(astring("zapping node for ") + to_zap->name());
 #endif