diff options
-rw-r--r-- | src/cloconv.sml | 8 | ||||
-rw-r--r-- | tests/html_fn.lac | 9 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/cloconv.sml b/src/cloconv.sml index bf877d28..d9863cb5 100644 --- a/src/cloconv.sml +++ b/src/cloconv.sml @@ -140,6 +140,8 @@ fun ccExp env ((e, loc), D) = val ns = List.filter (fn n => n <> 0) ns val D = Ds.leave D + val envT = (L'.TRecord (map (fn n => ("fv" ^ Int.toString n, #2 (E.lookupERel env (n-1)))) ns), loc) + (*val () = Print.preface ("Before", FlatPrint.p_exp FlatEnv.basis e) val () = List.app (fn (x, t) => preface ("Bound", box [string x, space, @@ -153,11 +155,11 @@ fun ccExp env ((e, loc), D) = subExpInExp (n, (L'.EField ((L'.ERel 1, loc), "fv" ^ Int.toString n), loc)) e) e ns (*val () = Print.preface (" After", FlatPrint.p_exp FlatEnv.basis body)*) - val body = (L'.ELet ([("env", (L'.TTop, loc), (L'.EField ((L'.ERel 0, loc), "env"), loc)), - ("arg", (L'.TTop, loc), (L'.EField ((L'.ERel 1, loc), "arg"), loc))], + val body = (L'.ELet ([("env", envT, (L'.EField ((L'.ERel 0, loc), "env"), loc)), + ("arg", dom, (L'.EField ((L'.ERel 1, loc), "arg"), loc))], body), loc) - val envT = (L'.TRecord (map (fn n => ("fv" ^ Int.toString n, #2 (E.lookupERel env (n-1)))) ns), loc) + val (D, fi) = Ds.func D (x, (L'.TRecord [("env", envT), ("arg", dom)], loc), ran, body) in ((L'.ERecord [("code", (L'.ECode fi, loc), (L'.TTop, loc)), diff --git a/tests/html_fn.lac b/tests/html_fn.lac new file mode 100644 index 00000000..9b81b73d --- /dev/null +++ b/tests/html_fn.lac @@ -0,0 +1,9 @@ +val main = fn () => <html> + <head> + <title>Hello World!</title> + </head> + + <body> + <b>Hello</b> <i>World</i>! + </body> +</html> |