diff options
Diffstat (limited to '076continuation.cc')
-rw-r--r-- | 076continuation.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/076continuation.cc b/076continuation.cc index c08e741a..50e4f637 100644 --- a/076continuation.cc +++ b/076continuation.cc @@ -139,7 +139,7 @@ case CALL_WITH_CONTINUATION_MARK: { } instruction/*copy*/ caller_instruction = current_instruction(); Current_routine->calls.front().continuation_mark_tag = current_instruction().ingredients.at(0).value; - Current_routine->calls.push_front(call(Recipe_ordinal[current_instruction().ingredients.at(1).name])); + Current_routine->calls.push_front(call(ingredients.at(1).at(0))); // drop the mark caller_instruction.ingredients.erase(caller_instruction.ingredients.begin()); ingredients.erase(ingredients.begin()); @@ -159,6 +159,16 @@ recipe f [ ] +mem: storing 1 in location 10 +:(scenario delimited_continuation_out_of_recipe_variable) +recipe main [ + x:recipe <- copy f + call-with-continuation-mark 233/mark, x, 1/true +] +recipe f [ + 10:bool <- next-input +] ++mem: storing 1 in location 10 + //: save the slice of current call stack until the 'call-with-continuation-mark' //: call, and return it as the result. //: todo: implement delimited continuations in Mu's memory @@ -194,7 +204,7 @@ case RETURN_CONTINUATION_UNTIL_MARK: { call_stack::iterator find_base_of_continuation(call_stack&, int); // manual prototype containing '::' call_stack::iterator base = find_base_of_continuation(Current_routine->calls, /*mark tag*/current_instruction().ingredients.at(0).value); if (base == Current_routine->calls.end()) { - raise << maybe(current_recipe_name()) << "couldn't find a 'call-with-continuation-mark' to return to\n" << end(); + raise << maybe(current_recipe_name()) << "couldn't find a 'call-with-continuation-mark' to return to with tag " << current_instruction().ingredients.at(0).original_string << '\n' << end(); raise << maybe(current_recipe_name()) << "call stack:\n" << end(); for (call_stack::iterator p = Current_routine->calls.begin(); p != Current_routine->calls.end(); ++p) raise << maybe(current_recipe_name()) << " " << get(Recipe, p->running_recipe).name << '\n' << end(); |