comparison 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
comparison
equal deleted inserted replaced
839:b2413e4dd109 840:e4a02e4fa35c
40 type ord_key = typ 40 type ord_key = typ
41 val compare = U.Typ.compare 41 val compare = U.Typ.compare
42 end) 42 end)
43 43
44 type state = { 44 type state = {
45 decls : decl list, 45 decls : (string * int * (string * int * typ option) list) list,
46 script : string list, 46 script : string list,
47 included : IS.set, 47 included : IS.set,
48 injectors : int IM.map, 48 injectors : int IM.map,
49 listInjectors : int TM.map, 49 listInjectors : int TM.map,
50 decoders : int IM.map, 50 decoders : int IM.map,
299 (EField ((ERel 0, loc), "2"), loc)), loc), 299 (EField ((ERel 0, loc), "2"), loc)), loc),
300 str loc "}}"])], 300 str loc "}}"])],
301 {disc = t, result = s}), loc) 301 {disc = t, result = s}), loc)
302 val body = (EAbs ("x", t, s, body), loc) 302 val body = (EAbs ("x", t, s, body), loc)
303 303
304 val st = {decls = (DValRec [("jsify", n', (TFun (t, s), loc), 304 val st = {decls = ("jsify", n', (TFun (t, s), loc),
305 body, "jsify")], loc) :: #decls st, 305 body, "jsify") :: #decls st,
306 script = #script st, 306 script = #script st,
307 included = #included st, 307 included = #included st,
308 injectors = #injectors st, 308 injectors = #injectors st,
309 listInjectors = #listInjectors st, 309 listInjectors = #listInjectors st,
310 decoders= #decoders st, 310 decoders= #decoders st,
360 val s = (TFfi ("Basis", "string"), loc) 360 val s = (TFfi ("Basis", "string"), loc)
361 val body = (ECase ((ERel 0, loc), pes, 361 val body = (ECase ((ERel 0, loc), pes,
362 {disc = t, result = s}), loc) 362 {disc = t, result = s}), loc)
363 val body = (EAbs ("x", t, s, body), loc) 363 val body = (EAbs ("x", t, s, body), loc)
364 364
365 val st = {decls = (DValRec [("jsify", n', (TFun (t, s), loc), 365 val st = {decls = ("jsify", n', (TFun (t, s), loc),
366 body, "jsify")], loc) :: #decls st, 366 body, "jsify") :: #decls st,
367 script = #script st, 367 script = #script st,
368 included = #included st, 368 included = #included st,
369 injectors = #injectors st, 369 injectors = #injectors st,
370 listInjectors = #listInjectors st, 370 listInjectors = #listInjectors st,
371 decoders= #decoders st, 371 decoders= #decoders st,
1335 1335
1336 fun doDecl (d, st) = 1336 fun doDecl (d, st) =
1337 let 1337 let
1338 (*val () = Print.preface ("doDecl", MonoPrint.p_decl MonoEnv.empty d)*) 1338 (*val () = Print.preface ("doDecl", MonoPrint.p_decl MonoEnv.empty d)*)
1339 val (d, st) = decl (d, st) 1339 val (d, st) = decl (d, st)
1340
1341 val ds =
1342 case #decls st of
1343 [] => [d]
1344 | vis => [(DValRec vis, #2 d), d]
1340 in 1345 in
1341 (List.revAppend (#decls st, [d]), 1346 (ds,
1342 {decls = [], 1347 {decls = [],
1343 script = #script st, 1348 script = #script st,
1344 included = #included st, 1349 included = #included st,
1345 injectors = #injectors st, 1350 injectors = #injectors st,
1346 listInjectors = #listInjectors st, 1351 listInjectors = #listInjectors st,