about summary refs log tree commit diff stats
path: root/059shape_shifting_recipe.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-19 23:44:11 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-19 23:47:15 -0800
commit9aacd50defdb4c6eb5d860a905af4d572cf7598a (patch)
treeda5bbbfeab5aeb91e2d2e9f8a565279f6dfe3eb4 /059shape_shifting_recipe.cc
parent8a0f55cdffc03ee10b0d7b6740db89e622b4c1c1 (diff)
downloadmu-9aacd50defdb4c6eb5d860a905af4d572cf7598a.tar.gz
2464: edit/: update errors in shape-shifting recipes
Requires carefully deleting specializations so that they can be
reintroduced each time.
Diffstat (limited to '059shape_shifting_recipe.cc')
-rw-r--r--059shape_shifting_recipe.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/059shape_shifting_recipe.cc b/059shape_shifting_recipe.cc
index b3fec956..c34466fe 100644
--- a/059shape_shifting_recipe.cc
+++ b/059shape_shifting_recipe.cc
@@ -41,11 +41,23 @@ if (Current_routine->calls.front().running_step_index == 0
 if (contains_type_ingredient_name(lhs)) return false;
 
 //: We'll be creating recipes without loading them from anywhere by
-//: *specializing* existing recipes, so make sure we don't clear any of those
-//: when we start running tests.
+//: *specializing* existing recipes.
+//:
+//: Keep track of these new recipes in a separate variable in addition to
+//: recently_added_recipes, so that edit/ can clear them before reloading to
+//: regenerate errors.
+:(before "End Globals")
+vector<recipe_ordinal> recently_added_shape_shifting_recipes;
+:(before "End Setup")
+//? cerr << "setup: clearing recently-added shape-shifting recipes\n";
+recently_added_shape_shifting_recipes.clear();
+
+//: make sure we don't clear any of these recipes when we start running tests
 :(before "End Loading .mu Files")
 recently_added_recipes.clear();
 recently_added_types.clear();
+//? cerr << "clearing recently-added shape-shifting recipes\n";
+recently_added_shape_shifting_recipes.clear();
 
 :(before "End Instruction Dispatch(inst, best_score)")
 if (best_score == -1) {
@@ -180,6 +192,7 @@ recipe_ordinal new_variant(recipe_ordinal exemplar, const instruction& inst, con
   assert(contains_key(Recipe, exemplar));
   assert(!contains_key(Recipe, new_recipe_ordinal));
   recently_added_recipes.push_back(new_recipe_ordinal);
+  recently_added_shape_shifting_recipes.push_back(new_recipe_ordinal);
   put(Recipe, new_recipe_ordinal, get(Recipe, exemplar));
   recipe& new_recipe = get(Recipe, new_recipe_ordinal);
   // Since the exemplar never ran any transforms, we have to redo some of the