Mercurial > urweb
changeset 130:96bd3350e77d
Compiled mutual 'val rec'
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 17 Jul 2008 11:20:07 -0400 |
parents | 78d59cf0a0cc |
children | 5df655503288 |
files | src/corify.sml tests/rec.lac tests/rec2.lac |
diffstat | 3 files changed, 29 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/corify.sml Thu Jul 17 11:02:10 2008 -0400 +++ b/src/corify.sml Thu Jul 17 11:20:07 2008 -0400 @@ -387,18 +387,26 @@ | L.DValRec vis => let val (vis, st) = ListUtil.foldlMap - (fn ((x, n, t, e), st) => - let - val (st, n) = St.bindVal st x n - val s = - if String.isPrefix "wrap_" x then - String.extract (x, 5, NONE) - else - x - in - ((x, n, corifyCon st t, corifyExp st e, s), st) - end) - st vis + (fn ((x, n, t, e), st) => + let + val (st, n) = St.bindVal st x n + in + ((x, n, t, e), st) + end) + st vis + + val vis = map + (fn (x, n, t, e) => + let + val s = + if String.isPrefix "wrap_" x then + String.extract (x, 5, NONE) + else + x + in + (x, n, corifyCon st t, corifyExp st e, s) + end) + vis in ([(L'.DValRec vis, loc)], st) end
--- a/tests/rec.lac Thu Jul 17 11:02:10 2008 -0400 +++ b/tests/rec.lac Thu Jul 17 11:20:07 2008 -0400 @@ -1,3 +1,3 @@ -val rec looper = fn () => <html><body> - <a link={looper ()}>Ride again!</a> +val rec main = fn () => <html><body> + <a link={main ()}>Ride again!</a> </body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/rec2.lac Thu Jul 17 11:20:07 2008 -0400 @@ -0,0 +1,7 @@ +val rec main = fn () => <html><body> + <a link={aux ()}>See another page</a> +</body></html> + +and aux = fn () => <html><body> + <a link={main ()}>Back to square one</a> +</body></html>