about summary refs log tree commit diff stats
path: root/034call.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-01 23:44:17 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-01 23:44:17 -0700
commit2142ccfc37db49b59ff7e4da47a59adb3a043615 (patch)
tree0c040e37d5cb7df69851f5eef0a5bfe611753363 /034call.cc
parent166e3c0d407a967d25d793b6a9db56ffd7a03727 (diff)
downloadmu-2142ccfc37db49b59ff7e4da47a59adb3a043615.tar.gz
2233 - basic checks for non-primitive recipes
This came last because we had to ensure all primitives are covered.
Diffstat (limited to '034call.cc')
-rw-r--r--034call.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/034call.cc b/034call.cc
index f1c82f7f..43c9061f 100644
--- a/034call.cc
+++ b/034call.cc
@@ -77,15 +77,16 @@ inline const instruction& current_instruction() {
   return Recipe[Current_routine->calls.front().running_recipe].steps.at(Current_routine->calls.front().running_step_index);
 }
 
+:(after "Defined Recipe Checks")
+// not a primitive; check that it's present in the book of recipes
+if (Recipe.find(inst.operation) == Recipe.end()) {
+  raise << maybe(Recipe[r].name) << "undefined operation in '" << inst.to_string() << "'\n" << end();
+  break;
+}
 :(replace{} "default:" following "End Primitive Recipe Implementations")
 default: {
-  // not a primitive; try to look up the book of recipes
-  if (Recipe.find(current_instruction().operation) == Recipe.end()) {
-    raise << maybe(current_recipe_name()) << "undefined operation in '" << current_instruction().to_string() << "'\n" << end();
-    // stop running this instruction immediately
-    ++current_step_index();
-    continue;
-  }
+  if (Recipe.find(current_instruction().operation) == Recipe.end()) break;  // duplicate from Checks
+  // not a primitive; look up the book of recipes
   Current_routine->calls.push_front(call(current_instruction().operation));
   call_housekeeping:
   ++Callstack_depth;