diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-09-22 14:15:29 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-09-22 14:15:29 -0400 |
commit | 5053cc1cc65d193cc4d3298a9d2485c0139a9bf9 (patch) | |
tree | 4f6af43d27894091ed79d61f3202eacffd17fcfd /src/jscomp.sml | |
parent | c328bb9c8bf1c3ac70b9e7e14157ecd2b6ba0b1d (diff) |
Compiled an 'option' pattern-match
Diffstat (limited to 'src/jscomp.sml')
-rw-r--r-- | src/jscomp.sml | 24 |
1 files changed, 12 insertions, 12 deletions
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) |