Mercurial > urweb
comparison src/mono_reduce.sml @ 765:a28982de5645
Successfully influenced effectful-ness status of FFI func
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 02 May 2009 11:27:26 -0400 |
parents | f7e2026dd5ae |
children | e92cfac1608f |
comparison
equal
deleted
inserted
replaced
764:7f653298dd66 | 765:a28982de5645 |
---|---|
51 | ENamed _ => false | 51 | ENamed _ => false |
52 | ECon (_, _, eo) => (case eo of NONE => false | SOME e => impure e) | 52 | ECon (_, _, eo) => (case eo of NONE => false | SOME e => impure e) |
53 | ENone _ => false | 53 | ENone _ => false |
54 | ESome (_, e) => impure e | 54 | ESome (_, e) => impure e |
55 | EFfi _ => false | 55 | EFfi _ => false |
56 | EFfiApp ("Basis", "set_cookie", _) => true | 56 | EFfiApp (m, x, _) => Settings.isEffectful (m, x) |
57 | EFfiApp ("Basis", "new_client_source", _) => true | |
58 | EFfiApp ("Basis", "get_client_source", _) => true | |
59 | EFfiApp ("Basis", "set_client_source", _) => true | |
60 | EFfiApp ("Basis", "alert", _) => true | |
61 | EFfiApp ("Basis", "new_channel", _) => true | |
62 | EFfiApp ("Basis", "subscribe", _) => true | |
63 | EFfiApp ("Basis", "send", _) => true | |
64 | EFfiApp ("Basis", "onError", _) => true | |
65 | EFfiApp ("Basis", "onFail", _) => true | |
66 | EFfiApp ("Basis", "onConnectFail", _) => true | |
67 | EFfiApp ("Basis", "onDisconnect", _) => true | |
68 | EFfiApp ("Basis", "onServerError", _) => true | |
69 | EFfiApp _ => false | |
70 | EApp ((EFfi _, _), _) => false | 57 | EApp ((EFfi _, _), _) => false |
71 | EApp _ => true | 58 | EApp _ => true |
72 | 59 |
73 | EUnop (_, e) => impure e | 60 | EUnop (_, e) => impure e |
74 | EBinop (_, e1, e2) => impure e1 orelse impure e2 | 61 | EBinop (_, e1, e2) => impure e1 orelse impure e2 |
269 | _ => absCounts) | 256 | _ => absCounts) |
270 IM.empty file | 257 IM.empty file |
271 | 258 |
272 fun summarize d (e, _) = | 259 fun summarize d (e, _) = |
273 let | 260 let |
274 fun ffi es = List.concat (map (summarize d) es) @ [Unsure] | |
275 | |
276 val s = | 261 val s = |
277 case e of | 262 case e of |
278 EPrim _ => [] | 263 EPrim _ => [] |
279 | ERel n => if n = d then [UseRel] else [] | 264 | ERel n => if n = d then [UseRel] else [] |
280 | ENamed _ => [] | 265 | ENamed _ => [] |
281 | ECon (_, _, NONE) => [] | 266 | ECon (_, _, NONE) => [] |
282 | ECon (_, _, SOME e) => summarize d e | 267 | ECon (_, _, SOME e) => summarize d e |
283 | ENone _ => [] | 268 | ENone _ => [] |
284 | ESome (_, e) => summarize d e | 269 | ESome (_, e) => summarize d e |
285 | EFfi _ => [] | 270 | EFfi _ => [] |
286 | EFfiApp ("Basis", "set_cookie", es) => ffi es | 271 | EFfiApp (m, x, es) => |
287 | EFfiApp ("Basis", "new_client_source", es) => ffi es | 272 if Settings.isEffectful (m, x) then |
288 | EFfiApp ("Basis", "get_client_source", es) => ffi es | 273 List.concat (map (summarize d) es) @ [Unsure] |
289 | EFfiApp ("Basis", "set_client_source", es) => ffi es | 274 else |
290 | EFfiApp ("Basis", "alert", es) => ffi es | 275 List.concat (map (summarize d) es) |
291 | EFfiApp ("Basis", "new_channel", es) => ffi es | |
292 | EFfiApp ("Basis", "subscribe", es) => ffi es | |
293 | EFfiApp ("Basis", "send", es) => ffi es | |
294 | EFfiApp ("Basis", "onError", es) => ffi es | |
295 | EFfiApp ("Basis", "onFail", es) => ffi es | |
296 | EFfiApp ("Basis", "onConnectFail", es) => ffi es | |
297 | EFfiApp ("Basis", "onDisconnect", es) => ffi es | |
298 | EFfiApp ("Basis", "onServerError", es) => ffi es | |
299 | EFfiApp (_, _, es) => List.concat (map (summarize d) es) | |
300 | EApp ((EFfi _, _), e) => summarize d e | 276 | EApp ((EFfi _, _), e) => summarize d e |
301 | EApp _ => | 277 | EApp _ => |
302 let | 278 let |
303 fun unravel (e, passed, ls) = | 279 fun unravel (e, passed, ls) = |
304 case e of | 280 case e of |