diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-10-25 14:07:10 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-10-25 14:07:10 -0400 |
commit | 5a88b41a6655f601c989ae94ce1fc8bb391ca630 (patch) | |
tree | 95685ca6f24d0e3511588ae55bbdd8a121f97994 /lib/js | |
parent | 31da370dd5fae72ddf756aa5ef54241b099fd617 (diff) |
RPC uses VM support for call/cc
Diffstat (limited to 'lib/js')
-rw-r--r-- | lib/js/urweb.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 653f8d2f..6ca4becd 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -632,7 +632,7 @@ function rc(prefix, uri, parse, k, needsSig) { if (isok) { try { - execF(k, parse(xhr.responseText)); + k(parse(xhr.responseText)); } catch (v) { doExn(v); } @@ -854,7 +854,11 @@ function execP(env, p, v) { } function exec0(env, e) { - var stack = null; + return exec1(env, null, e); +} + +function exec1(env, stack, e) { + var stack, usedK = false; var saveEnv = function() { if (stack.next != null && stack.next.data.c != "<") @@ -883,8 +887,9 @@ function exec0(env, e) { case "f": fr.args[fr.pos++] = v; if (fr.a == null) { - e = {c: "c", v: fr.f.apply(null, fr.args)}; stack = stack.next; + e = {c: "c", v: fr.f.apply(null, fr.args)}; + if (usedK) return null; } else { e = fr.a.data; fr.a = fr.a.next; @@ -1014,6 +1019,11 @@ function exec0(env, e) { env = e.env; e = e.body; break; + case "K": + { var savedStack = stack.next, savedEnv = env; + e = {c: "c", v: function(v) { return exec1(savedEnv, savedStack, {c: "c", v: v}); } };} + usedK = true; + break; default: whine("Unknown Ur expression kind " + e.c); } |