changeset 977:2ecf308772ba

Might have fixed demo/listEdit
author Adam Chlipala <adamc@hcoop.net>
date Thu, 24 Sep 2009 07:52:57 -0400
parents 68eda5b0636d
children e1f3f1ea8cff
files lib/js/urweb.js src/jscomp.sml
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Tue Sep 22 17:12:20 2009 -0400
+++ b/lib/js/urweb.js	Thu Sep 24 07:52:57 2009 -0400
@@ -115,7 +115,7 @@
 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 @@
   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 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 @@
 
       if (isok) {
         try {
-          k(parse(xhr.responseText));
+          execF(k, parse(xhr.responseText));
         } catch (v) {
           doExn(v);
         }
@@ -783,7 +783,7 @@
     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 @@
     return r;
 }
 
+function execF(f, x) {
+  return exec0(cons(x, f.env), f.body);
+}
+
 
 // App-specific code
 
--- a/src/jscomp.sml	Tue Sep 22 17:12:20 2009 -0400
+++ b/src/jscomp.sml	Thu Sep 24 07:52:57 2009 -0400
@@ -910,9 +910,9 @@
                                               ^ "\"},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 @@
                                 (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