comparison 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
comparison
equal deleted inserted replaced
694:7ea0df9e56b6 695:500e93aa436f
108 | ESignalReturn e => varDepth e 108 | ESignalReturn e => varDepth e
109 | ESignalBind (e1, e2) => Int.max (varDepth e1, varDepth e2) 109 | ESignalBind (e1, e2) => Int.max (varDepth e1, varDepth e2)
110 | ESignalSource e => varDepth e 110 | ESignalSource e => varDepth e
111 | EServerCall (e, ek, _) => Int.max (varDepth e, varDepth ek) 111 | EServerCall (e, ek, _) => Int.max (varDepth e, varDepth ek)
112 | ERecv (e, ek, _) => Int.max (varDepth e, varDepth ek) 112 | ERecv (e, ek, _) => Int.max (varDepth e, varDepth ek)
113 | ESleep (e, ek) => Int.max (varDepth e, varDepth ek)
113 114
114 fun closedUpto d = 115 fun closedUpto d =
115 let 116 let
116 fun cu inner (e, _) = 117 fun cu inner (e, _) =
117 case e of 118 case e of
150 | ESignalReturn e => cu inner e 151 | ESignalReturn e => cu inner e
151 | ESignalBind (e1, e2) => cu inner e1 andalso cu inner e2 152 | ESignalBind (e1, e2) => cu inner e1 andalso cu inner e2
152 | ESignalSource e => cu inner e 153 | ESignalSource e => cu inner e
153 | EServerCall (e, ek, _) => cu inner e andalso cu inner ek 154 | EServerCall (e, ek, _) => cu inner e andalso cu inner ek
154 | ERecv (e, ek, _) => cu inner e andalso cu inner ek 155 | ERecv (e, ek, _) => cu inner e andalso cu inner ek
156 | ESleep (e, ek) => cu inner e andalso cu inner ek
155 in 157 in
156 cu 0 158 cu 0
157 end 159 end
158 160
159 fun strcat loc es = 161 fun strcat loc es =
971 ^ unurl ^ "},"), 973 ^ unurl ^ "},"),
972 ek, 974 ek,
973 str ")"], 975 str ")"],
974 st) 976 st)
975 end 977 end
978
979 | ESleep (e, ek) =>
980 let
981 val (e, st) = jsE inner (e, st)
982 val (ek, st) = jsE inner (ek, st)
983 in
984 (strcat [str "window.setTimeout(",
985 ek,
986 str ", ",
987 e,
988 str ")"],
989 st)
990 end
976 end 991 end
977 in 992 in
978 jsE 993 jsE
979 end 994 end
980 995