about summary refs log tree commit diff stats
path: root/058generic_container.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-07 22:56:06 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-07 22:56:06 -0800
commit91abd257e27bd694bfc59c4cf1439171eef10a09 (patch)
treed1d3b7d8dad4b6461d97da64c9fa1b0fc4e0b1b3 /058generic_container.cc
parent82c886d71c12ad902ea8b9c81c7993af7ddf2d2b (diff)
downloadmu-91abd257e27bd694bfc59c4cf1439171eef10a09.tar.gz
2393 - redo 2391
Got that idea to work with a special-case for 'new'. Requires parsing
new's first ingredient, performing the replacement, and then turning it
back into a string. I didn't want to replace NEW with ALLOCATE right
here, because then it messes with my invariant that transform should
never see a naked ALLOCATE.

Layer 11 still not working, but everything else is. Let's clean up
before we diagnose the new breakage.
Diffstat (limited to '058generic_container.cc')
-rw-r--r--058generic_container.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/058generic_container.cc b/058generic_container.cc
index 44762f00..df9b63bc 100644
--- a/058generic_container.cc
+++ b/058generic_container.cc
@@ -60,15 +60,15 @@ void read_type_ingredients(string& name) {
       raise_error << "can't repeat type ingredient names in a single container definition\n" << end();
       return;
     }
-    info.type_ingredient_names[curr] = next_type_ordinal++;
+    put(info.type_ingredient_names, curr, next_type_ordinal++);
   }
 }
 
 :(before "End insert_container Special Uses(type_name)")
 // check for use of type ingredients
 if (type_name.at(0) == '_') {
-  *curr_type = new type_tree(info.type_ingredient_names[type_name]);
-  trace(9999, "parse") << "  type: " << info.type_ingredient_names[type_name] << end();
+  *curr_type = new type_tree(get(info.type_ingredient_names, type_name));
+  trace(9999, "parse") << "  type: " << get(info.type_ingredient_names, type_name) << end();
   continue;
 }
 
@@ -86,7 +86,7 @@ if (t.elements.at(i)->value >= START_TYPE_INGREDIENTS) {
     dump_types(type, out);
     raise_error << "illegal type '" << out.str() << "' seems to be missing a type ingredient or three\n" << end();
   }
-  result += size_of_type_ingredient(t.elements.at(i), type->right);
+  result += size;
   continue;
 }
 
@@ -103,6 +103,7 @@ long long int size_of_type_ingredient(const type_tree* element_template, const t
   }
   assert(curr);
   assert(!curr->left);  // unimplemented
+  assert(contains_key(Type, curr->value));
   trace(9999, "type") << "type deduced to be " << get(Type, curr->value).name << "$" << end();
   type_tree tmp(curr->value);
   if (curr->right)