summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-17 11:20:07 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-17 11:20:07 -0400
commitd5fd0e7403767670197f0422c99ba62176323624 (patch)
treeed1ba9e135ca409c2464256429a62cd9b4bd34f4
parentf97f99744f08737c22c83d17b77449c78213b3f8 (diff)
Compiled mutual 'val rec'
-rw-r--r--src/corify.sml32
-rw-r--r--tests/rec.lac4
-rw-r--r--tests/rec2.lac7
3 files changed, 29 insertions, 14 deletions
diff --git a/src/corify.sml b/src/corify.sml
index 41b0e825..13db0685 100644
--- a/src/corify.sml
+++ b/src/corify.sml
@@ -387,18 +387,26 @@ fun corifyDecl ((d, loc : EM.span), st) =
| 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
diff --git a/tests/rec.lac b/tests/rec.lac
index e86b832a..6131337e 100644
--- a/tests/rec.lac
+++ b/tests/rec.lac
@@ -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>
diff --git a/tests/rec2.lac b/tests/rec2.lac
new file mode 100644
index 00000000..e5f208c9
--- /dev/null
+++ b/tests/rec2.lac
@@ -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>