From 56e6c33264e848592b74b936bdf89fdfd8c874a4 Mon Sep 17 00:00:00 2001 From: Ian Price Date: Tue, 16 Jun 2015 23:06:47 +0100 Subject: [PATCH] Primitives create multiple argument continuations. --- module/language/js-il/runtime.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/module/language/js-il/runtime.js b/module/language/js-il/runtime.js index 319c432ea..5b4089e8b 100644 --- a/module/language/js-il/runtime.js +++ b/module/language/js-il/runtime.js @@ -305,10 +305,9 @@ var abort_to_prompt = function(self, k, prompt, arg) { var kont = undefined; // actual value doesn't matter if (!scheme.is_true(spec[1])) { - // TODO: handle multivalue continations - // compare with callcc - var f = function (self, k2, val) { - return k(val); + var f = function (self, k2) { + var args = Array.prototype.slice.call(arguments, 2); + return k.apply(k,args); }; kont = new scheme.Closure(f, 0); }; @@ -323,8 +322,9 @@ var abort_to_prompt = function(self, k, prompt, arg) { var call_with_values = not_implemented_yet; var callcc = function (self, k, closure) { - var f = function (self, k2, val) { - return k(val); + var f = function (self, k2) { + var args = Array.prototype.slice.call(arguments, 2); + return k.apply(k,args); }; return closure.fun(closure, k, new scheme.Closure(f, 0)); };