comparison src/jscomp.sml @ 1360:02fc16faecf3

[De]serialization of times in JavaScript; proper integer division in JavaScript; Basis.crypt; Top.mkRead'; more aggressive Mono-level inlining, for values of function-y types
author Adam Chlipala <adam@chlipala.net>
date Thu, 23 Dec 2010 17:46:40 -0500
parents 0d8bd8ae8417
children 449a12b82db7
comparison
equal deleted inserted replaced
1359:e525ad571e15 1360:02fc16faecf3
124 | TFfi ("Basis", "string") => ((EFfiApp ("Basis", "jsifyString", [e]), loc), st) 124 | TFfi ("Basis", "string") => ((EFfiApp ("Basis", "jsifyString", [e]), loc), st)
125 | TFfi ("Basis", "char") => ((EFfiApp ("Basis", "jsifyChar", [e]), loc), st) 125 | TFfi ("Basis", "char") => ((EFfiApp ("Basis", "jsifyChar", [e]), loc), st)
126 | TFfi ("Basis", "int") => ((EFfiApp ("Basis", "htmlifyInt", [e]), loc), st) 126 | TFfi ("Basis", "int") => ((EFfiApp ("Basis", "htmlifyInt", [e]), loc), st)
127 | TFfi ("Basis", "float") => ((EFfiApp ("Basis", "htmlifyFloat", [e]), loc), st) 127 | TFfi ("Basis", "float") => ((EFfiApp ("Basis", "htmlifyFloat", [e]), loc), st)
128 | TFfi ("Basis", "channel") => ((EFfiApp ("Basis", "jsifyChannel", [e]), loc), st) 128 | TFfi ("Basis", "channel") => ((EFfiApp ("Basis", "jsifyChannel", [e]), loc), st)
129 | TFfi ("Basis", "time") => ((EFfiApp ("Basis", "jsifyTime", [e]), loc), st)
129 130
130 | TFfi ("Basis", "bool") => ((ECase (e, 131 | TFfi ("Basis", "bool") => ((ECase (e,
131 [((PCon (Enum, PConFfi {mod = "Basis", 132 [((PCon (Enum, PConFfi {mod = "Basis",
132 datatyp = "bool", 133 datatyp = "bool",
133 con = "True", 134 con = "True",
699 (strcat [str ("{c:\"f\",f:\"" ^ name ^ "\",a:cons("), 700 (strcat [str ("{c:\"f\",f:\"" ^ name ^ "\",a:cons("),
700 e, 701 e,
701 str ",null)}"], 702 str ",null)}"],
702 st) 703 st)
703 end 704 end
704 | EBinop (s, e1, e2) => 705 | EBinop (bi, s, e1, e2) =>
705 let 706 let
706 val name = case s of 707 val name = case s of
707 "==" => "eq" 708 "==" => "eq"
708 | "!strcmp" => "eq" 709 | "!strcmp" => "eq"
709 | "+" => "plus" 710 | "+" => "plus"
710 | "-" => "minus" 711 | "-" => "minus"
711 | "*" => "times" 712 | "*" => "times"
712 | "/" => "div" 713 | "/" => (case bi of Int => "divInt" | NotInt => "div")
713 | "%" => "mod" 714 | "%" => (case bi of Int => "modInt" | NotInt => "mod")
714 | "<" => "lt" 715 | "<" => "lt"
715 | "<=" => "le" 716 | "<=" => "le"
716 | "strcmp" => "strcmp" 717 | "strcmp" => "strcmp"
717 | _ => raise Fail ("Jscomp: Unknown binary operator " ^ s) 718 | _ => raise Fail ("Jscomp: Unknown binary operator " ^ s)
718 719
1037 let 1038 let
1038 val (e, st) = exp outer (e, st) 1039 val (e, st) = exp outer (e, st)
1039 in 1040 in
1040 ((EUnop (s, e), loc), st) 1041 ((EUnop (s, e), loc), st)
1041 end 1042 end
1042 | EBinop (s, e1, e2) => 1043 | EBinop (bi, s, e1, e2) =>
1043 let 1044 let
1044 val (e1, st) = exp outer (e1, st) 1045 val (e1, st) = exp outer (e1, st)
1045 val (e2, st) = exp outer (e2, st) 1046 val (e2, st) = exp outer (e2, st)
1046 in 1047 in
1047 ((EBinop (s, e1, e2), loc), st) 1048 ((EBinop (bi, s, e1, e2), loc), st)
1048 end 1049 end
1049 1050
1050 | ERecord xets => 1051 | ERecord xets =>
1051 let 1052 let
1052 val (xets, st) = ListUtil.foldlMap (fn ((x, e, t), st) => 1053 val (xets, st) = ListUtil.foldlMap (fn ((x, e, t), st) =>