about summary refs log tree commit diff stats
path: root/056static_dispatch.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-03-20 00:48:04 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-03-20 00:55:33 -0700
commit2429c65cce16a11841212a71ec2bb50373aa54d4 (patch)
tree97c5f2fff44f80ea1a02d0476b9e31b5d44d1d50 /056static_dispatch.cc
parent3ac523393d15d51b0fd1b042eab4f7cb539f68a9 (diff)
downloadmu-2429c65cce16a11841212a71ec2bb50373aa54d4.tar.gz
2799 - new approach to undoing changes in tests
As outlined at the end of 2797. This worked out surprisingly well. Now
the snapshotting code touches fewer layers, and it's much better
behaved, with less need for special-case logic, particularly inside
run_interactive(). 30% slower, but should hopefully not cause any more
bugs.
Diffstat (limited to '056static_dispatch.cc')
-rw-r--r--056static_dispatch.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/056static_dispatch.cc b/056static_dispatch.cc
index da97ea80..263dc2bf 100644
--- a/056static_dispatch.cc
+++ b/056static_dispatch.cc
@@ -21,13 +21,13 @@ def test a:number, b:number -> z:number [
 map<string, vector<recipe_ordinal> > Recipe_variants;
 :(before "End One-time Setup")
 put(Recipe_variants, "main", vector<recipe_ordinal>());  // since we manually added main to Recipe_ordinal
-:(before "Clear Other State For Recently_added_recipes")
-for (map<string, vector<recipe_ordinal> >::iterator p = Recipe_variants.begin(); p != Recipe_variants.end(); ++p) {
-  for (int i = 0; i < SIZE(p->second); ++i) {
-    if (find(Recently_added_recipes.begin(), Recently_added_recipes.end(), p->second.at(i)) != Recently_added_recipes.end())
-      p->second.at(i) = -1;  // just leave a ghost
-  }
-}
+
+:(before "End Globals")
+map<string, vector<recipe_ordinal> > Recipe_variants_snapshot;
+:(before "End save_snapshots")
+Recipe_variants_snapshot = Recipe_variants;
+:(before "End restore_snapshots")
+Recipe_variants = Recipe_variants_snapshot;
 
 :(before "End Load Recipe Header(result)")
 // there can only ever be one variant for main