diff options
Diffstat (limited to '053continuation.cc')
-rw-r--r-- | 053continuation.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/053continuation.cc b/053continuation.cc index c9a6a5cb..9ccd6311 100644 --- a/053continuation.cc +++ b/053continuation.cc @@ -44,8 +44,8 @@ CONTINUE_FROM, Recipe_ordinal["continue-from"] = CONTINUE_FROM; :(before "End Primitive Recipe Checks") case CONTINUE_FROM: { - if (!is_mu_scalar(inst.ingredients.at(0))) { - raise_error << maybe(Recipe[r].name) << "first ingredient of 'continue-from' should be a continuation id generated by 'current-continuation', but got " << inst.ingredients.at(0).original_string << '\n' << end(); + if (!is_mu_continuation(inst.ingredients.at(0))) { + raise_error << maybe(Recipe[r].name) << "first ingredient of 'continue-from' should be a continuation generated by 'current-continuation', but got " << inst.ingredients.at(0).original_string << '\n' << end(); break; } break; @@ -57,6 +57,12 @@ case CONTINUE_FROM: { continue; // skip rest of this instruction } +:(code) +bool is_mu_continuation(const reagent& x) { + if (x.types.empty()) return false; + return x.types.at(0) == Type_ordinal["continuation"]; +} + :(scenario continuation) # simulate a loop using continuations recipe main [ @@ -253,3 +259,6 @@ call_stack::iterator find_reset(call_stack& c) { ingredients.erase(ingredients.begin()); // drop the callee goto call_housekeeping; } + +:(before "End is_mu_recipe Cases") +if (r.types.at(0) == Type_ordinal["continuation"]) return true; |