diff src/jscomp.sml @ 906:c270fb847dc2

Be careful in Jscomp to avoid interpreting non-boolean/reference types as booleans with ?:
author Adam Chlipala <adamc@hcoop.net>
date Tue, 11 Aug 2009 11:26:37 -0400
parents 7a4b026e45dd
children 8e540df3294d
line wrap: on
line diff
--- a/src/jscomp.sml	Sun Aug 09 16:13:27 2009 -0400
+++ b/src/jscomp.sml	Tue Aug 11 11:26:37 2009 -0400
@@ -585,7 +585,7 @@
                                         succ,
                                         str ")"]
                               | PCon (Option, _, NONE) =>
-                                strcat [str ("(d" ^ Int.toString depth ^ "?"),
+                                strcat [str ("(d" ^ Int.toString depth ^ "!=null?"),
                                         fail,
                                         str ":",
                                         succ,
@@ -594,7 +594,7 @@
                                 (case IM.find (someTs, n) of
                                      NONE => raise Fail "Jscomp: Not in someTs"
                                    | SOME t =>
-                                     strcat [str ("(d" ^ Int.toString depth ^ "?(d"
+                                     strcat [str ("(d" ^ Int.toString depth ^ "!=null?(d"
                                                   ^ Int.toString (depth+1) ^ "=d" ^ Int.toString depth
                                                   ^ (if isNullable t then
                                                          ".v,"
@@ -634,12 +634,12 @@
                                 in
                                     succ
                                 end
-                              | PNone _ => strcat [str ("(d" ^ Int.toString depth ^ "?"),
+                              | PNone _ => strcat [str ("(d" ^ Int.toString depth ^ "!=null?"),
                                                    fail,
                                                    str ":",
                                                    succ,
                                                    str ")"]
-                              | PSome (t, p) => strcat [str ("(d" ^ Int.toString depth ^ "?(d" ^ Int.toString (depth+1)
+                              | PSome (t, p) => strcat [str ("(d" ^ Int.toString depth ^ "!=null?(d" ^ Int.toString (depth+1)
                                                              ^ "=d" ^ Int.toString depth
                                                              ^ (if isNullable t then
                                                                     ".v"