about summary refs log tree commit diff stats
path: root/057static_dispatch.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-15 12:35:59 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-15 12:35:59 -0800
commitc55e49b6374656099566fd22f39328c2da75b044 (patch)
treec5c248b9baff05b5910824884576cccbabf63e98 /057static_dispatch.cc
parent360d45e68edf92e85e3ae7cb198be88182374331 (diff)
downloadmu-c55e49b6374656099566fd22f39328c2da75b044.tar.gz
2445 - dispatch between shape-shifting variants
Starting to leave debug prints around once again, just in case one of
them is worth promoting to the trace..
Diffstat (limited to '057static_dispatch.cc')
-rw-r--r--057static_dispatch.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/057static_dispatch.cc b/057static_dispatch.cc
index 54da5354..6ca6ca7c 100644
--- a/057static_dispatch.cc
+++ b/057static_dispatch.cc
@@ -32,6 +32,7 @@ for (map<string, vector<recipe_ordinal> >::iterator p = Recipe_variants.begin();
 :(before "End Load Recipe Header(result)")
 if (contains_key(Recipe_ordinal, result.name)) {
   const recipe_ordinal r = get(Recipe_ordinal, result.name);
+//?   if (variant_already_exists(result)) cerr << "AAAAAAAAAAAAAAAAAA variant already exists " << result.name << '\n';
   if ((!contains_key(Recipe, r) || get(Recipe, r).has_header)
       && !variant_already_exists(result)) {
     string new_name = next_unused_recipe_name(result.name);
@@ -62,12 +63,16 @@ bool all_reagents_match(const recipe& r1, const recipe& r2) {
   if (SIZE(r1.ingredients) != SIZE(r2.ingredients)) return false;
   if (SIZE(r1.products) != SIZE(r2.products)) return false;
   for (long long int i = 0; i < SIZE(r1.ingredients); ++i) {
-    if (!exact_match(r1.ingredients.at(i).type, r2.ingredients.at(i).type))
+    if (!deeply_equal_types(r1.ingredients.at(i).properties.at(0).second,
+                            r2.ingredients.at(i).properties.at(0).second)) {
       return false;
+    }
   }
   for (long long int i = 0; i < SIZE(r1.products); ++i) {
-    if (!exact_match(r1.products.at(i).type, r2.products.at(i).type))
+    if (!deeply_equal_types(r1.products.at(i).properties.at(0).second,
+                            r2.products.at(i).properties.at(0).second)) {
       return false;
+    }
   }
   return true;
 }
@@ -119,6 +124,7 @@ void resolve_ambiguous_calls(recipe_ordinal r) {
     assert(!get(Recipe_variants, inst.name).empty());
     replace_best_variant(inst, caller_recipe);
   }
+//?   if (caller_recipe.name == "main") cerr << "=============== " << debug_string(caller_recipe) << '\n';
 }
 
 void replace_best_variant(instruction& inst, const recipe& caller_recipe) {