about summary refs log tree commit diff stats
path: root/010vm.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-08 13:58:40 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-08 14:04:46 -0800
commitebdf923d2dd8c75d1391f3523825ab5cb36a6405 (patch)
treedd1caf38c36efa50d6758284aa92ec21617a4460 /010vm.cc
parentfa8eda45947ca4d4e394441203c0e871251ec121 (diff)
downloadmu-ebdf923d2dd8c75d1391f3523825ab5cb36a6405.tar.gz
2397
Fix that stray issue with a better phase ordering.
Another thing I'm not testing.
Diffstat (limited to '010vm.cc')
-rw-r--r--010vm.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/010vm.cc b/010vm.cc
index 08858594..cade8df8 100644
--- a/010vm.cc
+++ b/010vm.cc
@@ -392,6 +392,10 @@ string dump_types(const reagent& x) {
 
 void dump_types(const type_tree* type, ostream& out) {
   // abbreviate a single-node tree to just its contents
+  if (!type) {
+    out << "NULLNULLNULL";  // should never happen
+    return;
+  }
   if (!type->left && !type->right) {
     dump_type_name(type->value, out);
     return;
@@ -487,6 +491,19 @@ void dump_recipe(const string& recipe_name) {
   cout << "]\n";
 }
 
+//? string debug_string(const recipe& x) {
+//?   for (long long int index = 0; index < SIZE(x.steps); ++index) {
+//?     const instruction& inst = x.steps.at(index);
+//?     cerr << "inst: " << inst.to_string() << '\n';
+//?     for (long long int i = 0; i < SIZE(inst.ingredients); ++i) {
+//?       cerr << "  " << inst.ingredients.at(i).to_string() << " => " << dump_types(inst.ingredients.at(i)) << '\n';
+//?     }
+//?     cerr << "--\n";
+//?     for (long long int i = 0; i < SIZE(inst.products); ++i)
+//?       cerr << "  " << inst.products.at(i).to_string() << " => " << dump_types(inst.products.at(i)) << '\n';
+//?   }
+//? }
+
 void skip_whitespace(istream& in) {
   while (!in.eof() && isspace(in.peek()) && in.peek() != '\n') {
     in.get();