about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-31 18:25:08 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-31 18:25:08 -0700
commit2cb36cd09ba464fe7e1f20e19e291f442ed9f576 (patch)
treeda0b377b34f38f9487a3e6db45f3edd4502812ac
parent18e626dfe83c21822debc6f5a56eaea2b3102220 (diff)
downloadmu-2cb36cd09ba464fe7e1f20e19e291f442ed9f576.tar.gz
1910 - bugfix: unrecognized recipe with result
Thanks Britt Crawford.
-rw-r--r--034call.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/034call.cc b/034call.cc
index 498dc1a5..08eea8c5 100644
--- a/034call.cc
+++ b/034call.cc
@@ -81,8 +81,10 @@ inline const instruction& current_instruction() {
 default: {
   // not a primitive; try to look up the book of recipes
   if (Recipe.find(current_instruction().operation) == Recipe.end()) {
-    raise << "undefined operation " << current_instruction().operation << ": " << current_instruction().to_string() << '\n' << end();
-    break;
+    raise << current_recipe_name() << ": undefined operation in '" << current_instruction().to_string() << "'\n" << end();
+    // stop running this instruction immediately
+    ++current_step_index();
+    continue;
   }
   Current_routine->calls.push_front(call(current_instruction().operation));
   call_housekeeping:
@@ -91,6 +93,20 @@ default: {
   continue;  // not done with caller; don't increment current_step_index()
 }
 
+:(scenario calling_undefined_recipe_warns)
+% Hide_warnings = true;
+recipe main [
+  foo
+]
++warn: main: undefined operation in 'foo '
+
+:(scenario calling_undefined_recipe_handles_missing_result)
+% Hide_warnings = true;
+recipe main [
+  x:number <- foo
+]
++warn: main: undefined operation in 'x:number <- foo '
+
 //:: finally, we need to fix the termination conditions for the run loop
 
 :(replace{} "inline bool routine::completed() const")