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-26 01:01:04 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-26 01:01:04 -0700
commit9cc389ce771636c1350c269ef042c47c427ecd28 (patch)
treeedf83e1683ffee6b73cb73f3c1c147aaebe98f7c /010vm.cc
parent4ea0480806d123a0f97bd2b5a867fea603b63e87 (diff)
downloadmu-9cc389ce771636c1350c269ef042c47c427ecd28.tar.gz
2281
Diffstat (limited to '010vm.cc')
-rw-r--r--010vm.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/010vm.cc b/010vm.cc
index 61e46909..8e3bab59 100644
--- a/010vm.cc
+++ b/010vm.cc
@@ -303,6 +303,30 @@ string reagent::to_string() const {
   return out.str();
 }
 
+string dump_types(const reagent& x) {
+  ostringstream out;
+  dump_types(x.type, out);
+  return out.str();
+}
+
+void dump_types(type_tree* type, ostringstream& out) {
+  if (!type->left && !type->right) {
+    out << Type[type->value].name;
+    return;
+  }
+  out << "<";
+  if (type->left)
+    dump_types(type->left, out);
+  else
+    out << Type[type->value].name;
+  out << " : ";
+  if (type->right)
+    dump_types(type->right, out);
+  else
+    out << " : <>";
+  out << ">";
+}
+
 string instruction::to_string() const {
   if (is_label) return label;
   ostringstream out;