From 80608f987dda07f79d605c913753a2432c0fa73b Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 9 Jul 2015 00:47:36 -0700 Subject: 1736 - stop refusing to reload code in the editor All tests passing, but early layers are broken. --- 011load.cc | 2 +- 081run_interactive.cc | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/011load.cc b/011load.cc index 6216c7be..e1977383 100644 --- a/011load.cc +++ b/011load.cc @@ -34,7 +34,7 @@ vector 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; -- cgit 1.4.1-2-gfad0