1910 - bugfix: unrecognized recipe with result

Thanks Britt Crawford.
This commit is contained in:
Kartik K. Agaram 2015-07-31 18:25:08 -07:00
parent 18e626dfe8
commit 2cb36cd09b
1 changed files with 18 additions and 2 deletions

View File

@ -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")