diff src/jscomp.sml @ 840:e4a02e4fa35c

Fix unbound name problem in Jscomp injectors; more List stuff
author Adam Chlipala <adamc@hcoop.net>
date Sat, 06 Jun 2009 15:29:34 -0400
parents 5154a047c6bc
children 44c2c089ca15
line wrap: on
line diff
--- a/src/jscomp.sml	Sat Jun 06 14:09:30 2009 -0400
+++ b/src/jscomp.sml	Sat Jun 06 15:29:34 2009 -0400
@@ -42,7 +42,7 @@
                            end)
 
 type state = {
-     decls : decl list,
+     decls : (string * int * (string * int * typ option) list) list,
      script : string list,
      included : IS.set,
      injectors : int IM.map,
@@ -301,8 +301,8 @@
                                             {disc = t, result = s}), loc)
                          val body = (EAbs ("x", t, s, body), loc)
                                     
-                         val st = {decls = (DValRec [("jsify", n', (TFun (t, s), loc),
-                                                      body, "jsify")], loc) :: #decls st,
+                         val st = {decls = ("jsify", n', (TFun (t, s), loc),
+                                            body, "jsify") :: #decls st,
                                    script = #script st,
                                    included = #included st,
                                    injectors = #injectors st,
@@ -362,8 +362,8 @@
                                             {disc = t, result = s}), loc)
                          val body = (EAbs ("x", t, s, body), loc)
 
-                         val st = {decls = (DValRec [("jsify", n', (TFun (t, s), loc),
-                                                      body, "jsify")], loc) :: #decls st,
+                         val st = {decls = ("jsify", n', (TFun (t, s), loc),
+                                            body, "jsify") :: #decls st,
                                    script = #script st,
                                    included = #included st,
                                    injectors = #injectors st,
@@ -1337,8 +1337,13 @@
             let
                 (*val () = Print.preface ("doDecl", MonoPrint.p_decl MonoEnv.empty d)*)
                 val (d, st) = decl (d, st)
+
+                val ds =
+                    case #decls st of
+                        [] => [d]
+                      | vis => [(DValRec vis, #2 d), d]
             in
-                (List.revAppend (#decls st, [d]),
+                (ds,
                  {decls = [],
                   script = #script st,
                   included = #included st,