From 1782ad42006d1ff37ae3c818dbc25d713dd88e6b Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 22 Sep 2009 14:15:29 -0400 Subject: Compiled an 'option' pattern-match --- src/jscomp.sml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/jscomp.sml b/src/jscomp.sml index 1f5d669a..570a708c 100644 --- a/src/jscomp.sml +++ b/src/jscomp.sml @@ -463,15 +463,16 @@ fun process file = | PCon (Option, PConVar n, SOME p) => (case IM.find (someTs, n) of NONE => raise Fail "Jscomp: Not in someTs" - | SOME t => strcat [str ("{c:\"s\",n:" - ^ (if isNullable t then - "true" - else - "false") - ^ ",p:"), - jsPat p, - str "}"]) - | PCon (_, pc, NONE) => strcat [str "{c:\"0\",n:", + | SOME t => + strcat [str ("{c:\"s\",n:" + ^ (if isNullable t then + "true" + else + "false") + ^ ",p:"), + jsPat p, + str "}"]) + | PCon (_, pc, NONE) => strcat [str "{c:\"c\",v:", patCon pc, str "}"] | PCon (_, pc, SOME p) => strcat [str "{c:\"1\",n:", @@ -560,7 +561,6 @@ fun process file = val old = e val (e, st) = jsExp mode [] (e, st) - val new = e val e = deStrcat 0 e val sc = "urfuncs[" ^ Int.toString n ^ "] = " ^ e ^ ";\n" @@ -791,7 +791,7 @@ fun process file = val (ps, st) = foldr (fn ((p, e), (ps, st)) => let - val (e, st) = jsE inner (e, st) + val (e, st) = jsE (inner + E.patBindsN p) (e, st) in (strcat [str "cons({p:", jsPat p, @@ -805,7 +805,7 @@ fun process file = (str "null", st) pes in (strcat [str "{c:\"m\",e:", - e, + e', str ",p:", ps, str "}"], st) -- cgit v1.2.3