diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-02-15 13:03:09 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-02-15 13:03:09 -0500 |
commit | 4f0987ddef3dc105c3883aa9c1c69c29fbe86a8a (patch) | |
tree | 30c7775fe1755a17af3ea46d0a02ebf077c822ac /src/jscomp.sml | |
parent | f083e82c95ac4a9d3a22e032f81b6dc88a88f499 (diff) |
Parameterized RPC query
Diffstat (limited to 'src/jscomp.sml')
-rw-r--r-- | src/jscomp.sml | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/jscomp.sml b/src/jscomp.sml index 9651f930..383a9f6f 100644 --- a/src/jscomp.sml +++ b/src/jscomp.sml @@ -43,7 +43,10 @@ val funcs = [(("Basis", "alert"), "alert"), (("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 @@ fun varDepth (e, _) = | 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 @@ fun closedUpto d = | 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 @@ fun process file = 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 ")"], |