comparison src/jscomp.sml @ 679:44f23712020d

Chat example working nicely, but without dead channel removal
author Adam Chlipala <adamc@hcoop.net>
date Thu, 26 Mar 2009 18:26:50 -0400
parents f73913d97a40
children 5bbb542243e8
comparison
equal deleted inserted replaced
678:5ff1ff38e2db 679:44f23712020d
46 (("Basis", "set_client_source"), "sv"), 46 (("Basis", "set_client_source"), "sv"),
47 (("Basis", "stringToFloat_error"), "pfl"), 47 (("Basis", "stringToFloat_error"), "pfl"),
48 (("Basis", "stringToInt_error"), "pi"), 48 (("Basis", "stringToInt_error"), "pi"),
49 (("Basis", "urlifyInt"), "ts"), 49 (("Basis", "urlifyInt"), "ts"),
50 (("Basis", "urlifyFloat"), "ts"), 50 (("Basis", "urlifyFloat"), "ts"),
51 (("Basis", "urlifyString"), "escape"), 51 (("Basis", "urlifyString"), "uf"),
52 (("Basis", "urlifyChannel"), "ts"), 52 (("Basis", "urlifyChannel"), "ts"),
53 (("Basis", "recv"), "rv")] 53 (("Basis", "recv"), "rv")]
54 54
55 structure FM = BinaryMapFn(struct 55 structure FM = BinaryMapFn(struct
56 type ord_key = string * string 56 type ord_key = string * string
343 :: e' 343 :: e'
344 :: es 344 :: es
345 @ ["}"]), st) 345 @ ["}"]), st)
346 end 346 end
347 347
348 | TFfi ("Basis", "string") => ("unesc(t[i++])", st) 348 | TFfi ("Basis", "string") => ("uu(t[i++])", st)
349 | TFfi ("Basis", "int") => ("parseInt(t[i++])", st) 349 | TFfi ("Basis", "int") => ("parseInt(t[i++])", st)
350 | TFfi ("Basis", "float") => ("parseFloat(t[i++])", st) 350 | TFfi ("Basis", "float") => ("parseFloat(t[i++])", st)
351 | TFfi ("Basis", "channel") => ("parseInt(t[i++])", st)
351 352
352 | TFfi ("Basis", "bool") => ("t[i++] == \"True\"", st) 353 | TFfi ("Basis", "bool") => ("t[i++] == \"True\"", st)
353 354
354 | TOption t => 355 | TOption t =>
355 let 356 let
804 (strcat [e, 805 (strcat [e,
805 str ("._" ^ x)], st) 806 str ("._" ^ x)], st)
806 end 807 end
807 808
808 | ECase (e', pes, {result, ...}) => 809 | ECase (e', pes, {result, ...}) =>
809 if closedUpto inner e andalso List.all (fn (_, e) => closedUpto inner e) pes then 810 (*if closedUpto inner e andalso List.all (fn (_, e) => closedUpto inner e) pes then
810 let 811 let
811 val (e', st) = quoteExp result ((ERel 0, loc), st) 812 val (e', st) = quoteExp result ((ERel 0, loc), st)
812 in 813 in
813 ((ELet ("js", result, e, e'), loc), 814 ((ELet ("js", result, e, e'), loc),
814 st) 815 st)
815 end 816 end
816 else 817 else*)
817 let 818 let
818 val plen = length pes 819 val plen = length pes
819 820
820 val (cases, st) = ListUtil.foldliMap 821 val (cases, st) = ListUtil.foldliMap
821 (fn (i, (p, e), st) => 822 (fn (i, (p, e), st) =>