summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/js/urweb.js16
-rw-r--r--src/jscomp.sml8
2 files changed, 14 insertions, 10 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index d4c0f9b7..8170249b 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -115,7 +115,7 @@ function doExn(v) {
var disconnectHandlers = null;
function flift(f) {
- return {c:"l", b:f};
+ return {env:cons(f,null), body:{c:"v", n:1}};
}
function onDisconnect(f) {
@@ -217,7 +217,7 @@ function populate(node) {
var s = node.signal;
var oldSources = node.sources;
try {
- var sr = exec0(s.env, s.body);
+ var sr = execF(s, null);
var newSources = sr._sources;
for (var sp = oldSources; sp; sp = sp.next)
@@ -260,10 +260,10 @@ function sr(v) {
function sb(x,y) {
return {env:cons(y,cons(x,null)),
body:{c:"=",
- e1:{c:"a", f:{c:"v", n:1}, x:{c:"c", v:null}},
+ e1:{c:"a", f:{c:"v", n:2}, x:{c:"c", v:null}},
e2:{c:"=",
e1:{c:"a",
- f:{c:"a", f:{c:"v", n:1}, x:{c:".", r:{c:"v", n:0}, f:"data"}},
+ f:{c:"a", f:{c:"v", n:2}, x:{c:".", r:{c:"v", n:0}, f:"data"}},
x:{c:"c", v:null}},
e2:{c:"r", l:cons(
{n:"sources", v:{c:"f", f:union, a:cons({c:".", r:{c:"v", n:1}, f:"sources"},
@@ -633,7 +633,7 @@ function rc(uri, parse, k, needsSig) {
if (isok) {
try {
- k(parse(xhr.responseText));
+ execF(k, parse(xhr.responseText));
} catch (v) {
doExn(v);
}
@@ -783,7 +783,7 @@ function rv(chn, parse, k) {
enqueue(ch.listeners, function(msg) { k(parse(msg))(null); });
} else {
try {
- k(parse(msg))(null);
+ execF(execF(k, parse(msg)), null);
} catch (v) {
doExn(v);
}
@@ -1025,6 +1025,10 @@ function exec(e) {
return r;
}
+function execF(f, x) {
+ return exec0(cons(x, f.env), f.body);
+}
+
// App-specific code
diff --git a/src/jscomp.sml b/src/jscomp.sml
index 8e0297c3..b968ce79 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -910,9 +910,9 @@ fun process file =
^ "\"},cons("),
e,
str (",cons({c:\"c\",v:function(s){var t=s.split(\"/\");var i=0;return "
- ^ unurl ^ "}},cons({c:\"!\",e:"),
+ ^ unurl ^ "}},cons("),
ek,
- str ("},cons("
+ str (",cons("
^ (case eff of
ReadCookieWrite => "true"
| _ => "false")
@@ -929,9 +929,9 @@ fun process file =
(strcat [str ("{c:\"f\",f:rv,a:cons("),
e,
str (",cons({c:\"c\",v:function(s){var t=s.split(\"/\");var i=0;return "
- ^ unurl ^ "}},cons({c:\"!\",e:"),
+ ^ unurl ^ "}},cons("),
ek,
- str ("},null)))}")],
+ str (",null)))}")],
st)
end