about summary refs log tree commit diff stats
path: root/048check_type_by_name.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 /048check_type_by_name.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 '048check_type_by_name.cc')
-rw-r--r--048check_type_by_name.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/048check_type_by_name.cc b/048check_type_by_name.cc
index 8a83c5f4..27807103 100644
--- a/048check_type_by_name.cc
+++ b/048check_type_by_name.cc
@@ -36,6 +36,15 @@ void check_types_by_name(const recipe_ordinal r) {
   }
 }
 
+void deduce_missing_type(map<string, type_tree*>& type, map<string, string_tree*>& type_name, reagent& x) {
+  if (x.type) return;
+  if (!contains_key(type, x.name)) return;
+  x.type = new type_tree(*type[x.name]);
+  trace(9992, "transform") << x.name << " <= " << dump_types(x) << end();
+  assert(!x.properties.at(0).second);
+  x.properties.at(0).second = new string_tree(*type_name[x.name]);
+}
+
 void check_type(map<string, type_tree*>& type, map<string, string_tree*>& type_name, const reagent& x, const recipe_ordinal r) {
   if (is_literal(x)) return;
   if (is_raw(x)) return;  // TODO: delete this
@@ -59,16 +68,6 @@ recipe main [
   y:number <- add x, 1
 ]
 
-:(code)
-void deduce_missing_type(map<string, type_tree*>& type, map<string, string_tree*>& type_name, reagent& x) {
-  if (x.type) return;
-  if (!contains_key(type, x.name)) return;
-  x.type = new type_tree(*type[x.name]);
-  trace(9992, "transform") << x.name << " <= " << dump_types(x) << end();
-  assert(!x.properties.at(0).second);
-  x.properties.at(0).second = new string_tree(*type_name[x.name]);
-}
-
 :(scenario transform_fills_in_missing_types_in_product)
 recipe main [
   x:number <- copy 1