From 2142ccfc37db49b59ff7e4da47a59adb3a043615 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 1 Oct 2015 23:44:17 -0700 Subject: 2233 - basic checks for non-primitive recipes This came last because we had to ensure all primitives are covered. --- 034call.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to '034call.cc') 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; -- cgit 1.4.1-2-gfad0