# HG changeset patch # User Adam Chlipala # Date 1250004397 14400 # Node ID c270fb847dc291cf86f70febda9be3003a291133 # Parent 7a4b026e45ddb3e2ecf64bebdf1dee004b5bda82 Be careful in Jscomp to avoid interpreting non-boolean/reference types as booleans with ?: diff -r 7a4b026e45dd -r c270fb847dc2 src/jscomp.sml --- 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" diff -r 7a4b026e45dd -r c270fb847dc2 tests/jsparse.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jsparse.ur Tue Aug 11 11:26:37 2009 -0400 @@ -0,0 +1,8 @@ +fun main () = + s <- source "13"; + return + + None + | Some n => Some {[n]})}/> + diff -r 7a4b026e45dd -r c270fb847dc2 tests/jsparse.urp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jsparse.urp Tue Aug 11 11:26:37 2009 -0400 @@ -0,0 +1,3 @@ +debug + +jsparse diff -r 7a4b026e45dd -r c270fb847dc2 tests/jsparse.urs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/jsparse.urs Tue Aug 11 11:26:37 2009 -0400 @@ -0,0 +1,1 @@ +val main : unit -> transaction page