From 218d3c311c2ebd1e5b511acfd6579c9cbab47998 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 6 Jun 2009 15:29:34 -0400 Subject: Fix unbound name problem in Jscomp injectors; more List stuff --- src/jscomp.sml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/jscomp.sml') diff --git a/src/jscomp.sml b/src/jscomp.sml index 0178888a..b66cdaf2 100644 --- a/src/jscomp.sml +++ b/src/jscomp.sml @@ -42,7 +42,7 @@ structure TM = BinaryMapFn(struct 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 @@ fun process file = {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 @@ fun process file = {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 @@ fun process file = 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, -- cgit v1.2.3