diff src/jscomp.sml @ 827:497c7dbcc695

Fix variable adjustment bug in fn/case alternation
author Adam Chlipala <adamc@hcoop.net>
date Thu, 28 May 2009 13:47:05 -0400
parents 395a5d450cc0
children 20fe00fd81da
line wrap: on
line diff
--- a/src/jscomp.sml	Thu May 28 12:40:55 2009 -0400
+++ b/src/jscomp.sml	Thu May 28 13:47:05 2009 -0400
@@ -913,9 +913,10 @@
                                 val len = inner + len
                                 val normalVars = List.tabulate (normalDepth, fn n => "_" ^ Int.toString (n + len))
                                 val patVars = List.tabulate (depth, fn n => "d" ^ Int.toString n)
+                                val caseVars = ListUtil.mapi (fn (i, _) => "c" ^ Int.toString i) pes
                             in
                                 (strcat (str "(function (){ var "
-                                         :: str (String.concatWith "," (normalVars @ patVars) ^ ";d0=")
+                                         :: str (String.concatWith "," (normalVars @ patVars @ caseVars) ^ ";d0=")
                                          :: e
                                          :: str ";\nreturn ("
                                          :: List.revAppend (cases,