about summary refs log tree commit diff stats
path: root/076continuation.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2018-03-16 00:53:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2018-03-16 00:53:33 -0700
commitd82d903507b98a126c2540e5d5677cbd3c8bee18 (patch)
tree56dd8894285122c3d0079f58df69b8a446a5aa85 /076continuation.cc
parent7452d0525ecfc12c11fe005c31b089a5b4d7a102 (diff)
downloadmu-d82d903507b98a126c2540e5d5677cbd3c8bee18.tar.gz
4229
Another bugfix, another improved error message.
Diffstat (limited to '076continuation.cc')
-rw-r--r--076continuation.cc14
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();