about summary refs log tree commit diff stats
path: root/056recipe_header.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-02-21 20:30:02 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-02-21 20:40:06 -0800
commitc4e143d6ea0635cdb164cec1c62afd7461e605ad (patch)
tree06fbb672ce95f1d5152c113cdb40685148b57d0c /056recipe_header.cc
parentf22250a174d5ad5abf8bf99ad140ced52563aee2 (diff)
downloadmu-c4e143d6ea0635cdb164cec1c62afd7461e605ad.tar.gz
2681 - drop reagent types from reagent properties
All my attempts at staging this change failed with this humongous commit
that took all day and involved debugging three monstrous bugs. Two of
the bugs had to do with forgetting to check the type name in the
implementation of shape-shifting recipes. Bug #2 in particular would
cause core tests in layer 59 to fail -- only when I loaded up edit/! It
got me to just hack directly on mu.cc until I figured out the cause
(snapshot saved in mu.cc.modified). The problem turned out to be that I
accidentally saved a type ingredient in the Type table during
specialization. Now I know that that can be very bad.

I've checked the traces for any stray type numbers (rather than names).

I also found what might be a bug from last November (labeled TODO), but
we'll verify after this commit.
Diffstat (limited to '056recipe_header.cc')
-rw-r--r--056recipe_header.cc16
1 files changed, 4 insertions, 12 deletions
diff --git a/056recipe_header.cc b/056recipe_header.cc
index 40952f69..046a607a 100644
--- a/056recipe_header.cc
+++ b/056recipe_header.cc
@@ -363,18 +363,14 @@ void deduce_types_from_header(const recipe_ordinal r) {
   recipe& caller_recipe = get(Recipe, r);
   if (caller_recipe.products.empty()) return;
   trace(9991, "transform") << "--- deduce types from header for " << caller_recipe.name << end();
-//?   cerr << "--- deduce types from header for " << caller_recipe.name << '\n';
   map<string, const type_tree*> header_type;
-  map<string, const string_tree*> header_type_name;
   for (long long int i = 0; i < SIZE(caller_recipe.ingredients); ++i) {
     put(header_type, caller_recipe.ingredients.at(i).name, caller_recipe.ingredients.at(i).type);
-    put(header_type_name, caller_recipe.ingredients.at(i).name, caller_recipe.ingredients.at(i).properties.at(0).second);
-    trace(9993, "transform") << "type of " << caller_recipe.ingredients.at(i).name << " is " << to_string(caller_recipe.ingredients.at(i).type) << end();
+    trace(9993, "transform") << "type of " << caller_recipe.ingredients.at(i).name << " is " << names_to_string(caller_recipe.ingredients.at(i).type) << end();
   }
   for (long long int i = 0; i < SIZE(caller_recipe.products); ++i) {
     put(header_type, caller_recipe.products.at(i).name, caller_recipe.products.at(i).type);
-    put(header_type_name, caller_recipe.products.at(i).name, caller_recipe.products.at(i).properties.at(0).second);
-    trace(9993, "transform") << "type of " << caller_recipe.products.at(i).name << " is " << to_string(caller_recipe.products.at(i).type) << end();
+    trace(9993, "transform") << "type of " << caller_recipe.products.at(i).name << " is " << names_to_string(caller_recipe.products.at(i).type) << end();
   }
   for (long long int i = 0; i < SIZE(caller_recipe.steps); ++i) {
     instruction& inst = caller_recipe.steps.at(i);
@@ -385,9 +381,7 @@ void deduce_types_from_header(const recipe_ordinal r) {
         continue;
       if (!inst.ingredients.at(i).type)
         inst.ingredients.at(i).type = new type_tree(*get(header_type, inst.ingredients.at(i).name));
-      if (!inst.ingredients.at(i).properties.at(0).second)
-        inst.ingredients.at(i).properties.at(0).second = new string_tree(*get(header_type_name, inst.ingredients.at(i).name));
-      trace(9993, "transform") << "type of " << inst.ingredients.at(i).name << " is " << to_string(inst.ingredients.at(i).type) << end();
+      trace(9993, "transform") << "type of " << inst.ingredients.at(i).name << " is " << names_to_string(inst.ingredients.at(i).type) << end();
     }
     for (long long int i = 0; i < SIZE(inst.products); ++i) {
       trace(9993, "transform") << "  product: " << to_string(inst.products.at(i)) << end();
@@ -396,9 +390,7 @@ void deduce_types_from_header(const recipe_ordinal r) {
         continue;
       if (!inst.products.at(i).type)
         inst.products.at(i).type = new type_tree(*get(header_type, inst.products.at(i).name));
-      if (!inst.products.at(i).properties.at(0).second)
-        inst.products.at(i).properties.at(0).second = new string_tree(*get(header_type_name, inst.products.at(i).name));
-      trace(9993, "transform") << "type of " << inst.products.at(i).name << " is " << to_string(inst.products.at(i).type) << end();
+      trace(9993, "transform") << "type of " << inst.products.at(i).name << " is " << names_to_string(inst.products.at(i).type) << end();
     }
   }
 }