about summary refs log tree commit diff stats
path: root/076continuation.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-12-07 15:59:48 -0800
committerKartik K. Agaram <vc@akkartik.com>2017-12-07 16:00:02 -0800
commit07de3e9536fc1f3fc8f8f77f833c4730b6de1b7d (patch)
tree77278540a072945823364e0abf80d134a98ecb57 /076continuation.cc
parentba2729b2011da0c7e644d1c25a5ff75fca6bb848 (diff)
downloadmu-07de3e9536fc1f3fc8f8f77f833c4730b6de1b7d.tar.gz
4151 - specializing calls returning continuations
Diffstat (limited to '076continuation.cc')
-rw-r--r--076continuation.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/076continuation.cc b/076continuation.cc
index df6d0e67..94c3f97a 100644
--- a/076continuation.cc
+++ b/076continuation.cc
@@ -260,6 +260,25 @@ def g [
 # ..even though we never called the continuation
 -app: continuation called
 
+//: Allow shape-shifting recipes to return continuations.
+
+:(scenario call_shape_shifting_recipe_with_continuation_mark)
+def main [
+  1:num <- call-with-continuation-mark f, 34
+]
+def f x:_elem -> y:_elem [
+  local-scope
+  load-ingredients
+  y <- copy x
+]
++mem: storing 34 in location 1
+
+:(before "End resolve_ambiguous_call(r, index, inst, caller_recipe) Special-cases")
+if (inst.name == "call-with-continuation-mark" && first_ingredient_is_recipe_literal(inst)) {
+  resolve_indirect_ambiguous_call(r, index, inst, caller_recipe);
+  return;
+}
+
 //: Ensure that the presence of a continuation keeps its stack frames from being reclaimed.
 
 :(scenario continuations_preserve_local_scopes)