diff src/jscomp.sml @ 695:500e93aa436f

sleep and better Scriptcheck
author Adam Chlipala <adamc@hcoop.net>
date Sat, 04 Apr 2009 15:56:47 -0400
parents 7ea0df9e56b6
children a5d8b470d7ca
line wrap: on
line diff
--- a/src/jscomp.sml	Sat Apr 04 14:55:36 2009 -0400
+++ b/src/jscomp.sml	Sat Apr 04 15:56:47 2009 -0400
@@ -110,6 +110,7 @@
       | ESignalSource e => varDepth e
       | EServerCall (e, ek, _) => Int.max (varDepth e, varDepth ek)
       | ERecv (e, ek, _) => Int.max (varDepth e, varDepth ek)
+      | ESleep (e, ek) => Int.max (varDepth e, varDepth ek)
 
 fun closedUpto d =
     let
@@ -152,6 +153,7 @@
               | ESignalSource e => cu inner e
               | EServerCall (e, ek, _) => cu inner e andalso cu inner ek
               | ERecv (e, ek, _) => cu inner e andalso cu inner ek
+              | ESleep (e, ek) => cu inner e andalso cu inner ek
     in
         cu 0
     end
@@ -973,6 +975,19 @@
                                          str ")"],
                                  st)
                             end
+
+                          | ESleep (e, ek) =>
+                            let
+                                val (e, st) = jsE inner (e, st)
+                                val (ek, st) = jsE inner (ek, st)
+                            in
+                                (strcat [str "window.setTimeout(",
+                                         ek,
+                                         str ", ",
+                                         e,
+                                         str ")"],
+                                 st)
+                            end
                     end
             in
                 jsE