diff src/jscomp.sml @ 829:20fe00fd81da

Substring functions; fix a nasty MonoReduce pattern match substitution bug
author Adam Chlipala <adamc@hcoop.net>
date Sat, 30 May 2009 13:29:00 -0400
parents 497c7dbcc695
children 74e9e7642f08
line wrap: on
line diff
--- a/src/jscomp.sml	Sat May 30 09:59:10 2009 -0400
+++ b/src/jscomp.sml	Sat May 30 13:29:00 2009 -0400
@@ -625,16 +625,17 @@
                                                    str ":",
                                                    succ,
                                                    str ")"]
-                              | PSome (t, p) => strcat (str ("(d" ^ Int.toString depth ^ "?")
-                                                        :: (if isNullable t then
-                                                                [str ("d" ^ Int.toString depth
-                                                                      ^ "=d" ^ Int.toString depth ^ ".v")]
-                                                            else
-                                                                [])
-                                                        @ [jsPat depth inner p succ fail,
-                                                           str ":",
-                                                           fail,
-                                                           str ")"])
+                              | PSome (t, p) => strcat [str ("(d" ^ Int.toString depth ^ "?(d" ^ Int.toString (depth+1)
+                                                             ^ "=d" ^ Int.toString depth
+                                                             ^ (if isNullable t then
+                                                                    ".v"
+                                                                else
+                                                                    "")
+                                                             ^ ","),
+                                                        jsPat (depth+1) inner p succ fail,
+                                                        str "):",
+                                                        fail,
+                                                        str ")"]
 
                         val jsifyString = String.translate (fn #"\"" => "\\\""
                                                              | #"\\" => "\\\\"