about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-09 00:47:36 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-09 00:47:36 -0700
commit80608f987dda07f79d605c913753a2432c0fa73b (patch)
tree3e1c736f128ae23758e6426fcac685f7d3f6c3cf
parent4652465547b25b4beb56e3ae61e8c3f9bcdeda4c (diff)
downloadmu-80608f987dda07f79d605c913753a2432c0fa73b.tar.gz
1736 - stop refusing to reload code in the editor
All tests passing, but early layers are broken.
-rw-r--r--011load.cc2
-rw-r--r--081run_interactive.cc6
2 files changed, 7 insertions, 1 deletions
diff --git a/011load.cc b/011load.cc
index 6216c7be..e1977383 100644
--- a/011load.cc
+++ b/011load.cc
@@ -34,7 +34,7 @@ vector<recipe_ordinal> load(istream& in) {
         Recipe_ordinal[recipe_name] = Next_recipe_ordinal++;
       }
       if (Recipe.find(Recipe_ordinal[recipe_name]) != Recipe.end()) {
-        raise << "redefining recipe " << Recipe[Recipe_ordinal[recipe_name]].name << "\n";
+        if (!Loading_interactive) raise << "redefining recipe " << Recipe[Recipe_ordinal[recipe_name]].name << "\n";
         Recipe.erase(Recipe_ordinal[recipe_name]);
       }
       // todo: save user-defined recipes to mu's memory
diff --git a/081run_interactive.cc b/081run_interactive.cc
index e9f42041..76a7e2f4 100644
--- a/081run_interactive.cc
+++ b/081run_interactive.cc
@@ -218,6 +218,10 @@ long long int warnings_from_trace() {
 
 //: simpler version of run-interactive: doesn't do any running, just loads
 //: recipes and reports warnings.
+:(before "End Globals")
+bool Loading_interactive = false;
+:(before "End Setup")
+Loading_interactive = false;
 :(before "End Primitive Recipe Declarations")
 RELOAD,
 :(before "End Primitive Recipe Numbers")
@@ -225,10 +229,12 @@ Recipe_ordinal["reload"] = RELOAD;
 :(before "End Primitive Recipe Implementations")
 case RELOAD: {
   assert(scalar(ingredients.at(0)));
+  Loading_interactive = true;
   Hide_warnings = true;
   load(to_string(ingredients.at(0).at(0)));
   transform_all();
   Hide_warnings = false;
+  Loading_interactive = false;
   products.resize(1);
   products.at(0).push_back(warnings_from_trace());
   break;