about summary refs log tree commit diff stats
path: root/010vm.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-27 16:34:58 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-27 16:37:57 -0700
commit6808ff7d6df42aa8a8abe63041254b40b76ba8db (patch)
tree1c5db69f17e3da1fb1241c24a3a288a42b3fc35c /010vm.cc
parent9e30dba08d6475e9c26f95630b9595bea73fb705 (diff)
downloadmu-6808ff7d6df42aa8a8abe63041254b40b76ba8db.tar.gz
2293
Diffstat (limited to '010vm.cc')
-rw-r--r--010vm.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/010vm.cc b/010vm.cc
index da5725fe..47a2d01c 100644
--- a/010vm.cc
+++ b/010vm.cc
@@ -353,18 +353,23 @@ void dump_property(const string_tree* property, ostream& out) {
     out << "<>";
     return;
   }
+  // abbreviate a single-node tree to just its contents
   if (!property->left && !property->right) {
     out << '"' << property->value << '"';
     return;
   }
+  dump_property_tree(property, out);
+}
+
+void dump_property_tree(const string_tree* property, ostream& out) {
   out << "<";
   if (property->left)
-    dump_property(property->left, out);
+    dump_property_tree(property->left, out);
   else
     out << '"' << property->value << '"';
   out << " : ";
   if (property->right)
-    dump_property(property->right, out);
+    dump_property_tree(property->right, out);
   else
     out << "<>";
   out << ">";
@@ -377,20 +382,25 @@ string dump_types(const reagent& x) {
 }
 
 void dump_types(type_tree* type, ostream& out) {
+  // abbreviate a single-node tree to just its contents
   if (!type->left && !type->right) {
     out << Type[type->value].name;
     return;
   }
+  dump_types_tree(type, out);
+}
+
+void dump_types_tree(type_tree* type, ostream& out) {
   out << "<";
   if (type->left)
-    dump_types(type->left, out);
+    dump_types_tree(type->left, out);
   else
     out << Type[type->value].name;
   out << " : ";
   if (type->right)
-    dump_types(type->right, out);
+    dump_types_tree(type->right, out);
   else
-    out << " : <>";
+    out << "<>";
   out << ">";
 }