diff src/jscomp.sml @ 609:56aaa1941dad

First gimpy RPC
author Adam Chlipala <adamc@hcoop.net>
date Sun, 15 Feb 2009 10:32:50 -0500
parents 330a7de47914
children c5991cdb0c4b
line wrap: on
line diff
--- a/src/jscomp.sml	Sun Feb 15 09:27:36 2009 -0500
+++ b/src/jscomp.sml	Sun Feb 15 10:32:50 2009 -0500
@@ -98,7 +98,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 (_, es, ek, _) => foldl Int.max (varDepth ek) (map varDepth es)
 
 fun closedUpto d =
     let
@@ -139,7 +139,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 (_, es, ek, _) => List.all (cu inner) es andalso cu inner ek
     in
         cu 0
     end
@@ -812,7 +812,15 @@
                                  st)
                             end
 
-                          | EServerCall _ => raise Fail "Jscomp EServerCall"
+                          | EServerCall (x, es, ek, _) =>
+                            let
+                                val (ek, st) = jsE inner (ek, st)
+                            in
+                                (strcat [str ("rc(\"" ^ !Monoize.urlPrefix ^ x ^ "\","),
+                                         ek,
+                                         str ")"],
+                                 st)
+                            end
                     end
             in
                 jsE