diff src/jscomp.sml @ 614:5891f47d7cff

Parameterized RPC query
author Adam Chlipala <adamc@hcoop.net>
date Sun, 15 Feb 2009 13:03:09 -0500
parents c5991cdb0c4b
children 3ee6bb48f6e8
line wrap: on
line diff
--- a/src/jscomp.sml	Sun Feb 15 12:33:41 2009 -0500
+++ b/src/jscomp.sml	Sun Feb 15 13:03:09 2009 -0500
@@ -43,7 +43,10 @@
              (("Basis", "htmlifyInt"), "ts"),
              (("Basis", "htmlifyString"), "eh"),
              (("Basis", "new_client_source"), "sc"),
-             (("Basis", "set_client_source"), "sv")]
+             (("Basis", "set_client_source"), "sv"),
+             (("Basis", "urlifyInt"), "ts"),
+             (("Basis", "urlifyFloat"), "ts"),
+             (("Basis", "urlifyString"), "escape")]
 
 structure FM = BinaryMapFn(struct
                            type ord_key = string * string
@@ -98,7 +101,7 @@
       | ESignalReturn e => varDepth e
       | ESignalBind (e1, e2) => Int.max (varDepth e1, varDepth e2)
       | ESignalSource e => varDepth e
-      | EServerCall (_, es, ek, _) => foldl Int.max (varDepth ek) (map varDepth es)
+      | EServerCall (e, ek, _) => Int.max (varDepth e, varDepth ek)
 
 fun closedUpto d =
     let
@@ -139,7 +142,7 @@
               | ESignalReturn e => cu inner e
               | ESignalBind (e1, e2) => cu inner e1 andalso cu inner e2
               | ESignalSource e => cu inner e
-              | EServerCall (_, es, ek, _) => List.all (cu inner) es andalso cu inner ek
+              | EServerCall (e, ek, _) => cu inner e andalso cu inner ek
     in
         cu 0
     end
@@ -926,12 +929,15 @@
                                  st)
                             end
 
-                          | EServerCall (x, es, ek, t) =>
+                          | EServerCall (e, ek, t) =>
                             let
+                                val (e, st) = jsE inner (e, st)
                                 val (ek, st) = jsE inner (ek, st)
                                 val (unurl, st) = unurlifyExp loc (t, st)
                             in
-                                (strcat [str ("rc(\"" ^ !Monoize.urlPrefix ^ x ^ "\", function(s){var t=s.split(\"/\");var i=0;return "
+                                (strcat [str ("rc(\"" ^ !Monoize.urlPrefix ^ "\"+"),
+                                         e,
+                                         str (", function(s){var t=s.split(\"/\");var i=0;return "
                                               ^ unurl ^ "},"),
                                          ek,
                                          str ")"],