summaryrefslogtreecommitdiff
path: root/src/mono_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-17 10:38:03 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-17 10:38:03 -0400
commit462c9d472ebe1a585e3bddb103a3f7cf1cdc64e5 (patch)
treec57ef255d292387fa8cff95182d164437f64b3e5 /src/mono_util.sml
parente3313edc92a73932ff57b1c803fe7e408283406f (diff)
Tagging (non-mutual) 'val rec'
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r--src/mono_util.sml23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/mono_util.sml b/src/mono_util.sml
index bb4e20b2..99393b10 100644
--- a/src/mono_util.sml
+++ b/src/mono_util.sml
@@ -258,16 +258,25 @@ fun mapfoldB {typ = fc, exp = fe, decl = fd, bind} =
and mfd' ctx (dAll as (d, loc)) =
case d of
- DVal (x, n, t, e, s) =>
- S.bind2 (mft t,
- fn t' =>
- S.map2 (mfe ctx e,
- fn e' =>
- (DVal (x, n, t', e', s), loc)))
+ DVal vi =>
+ S.map2 (mfvi ctx vi,
+ fn vi' =>
+ (DVal vi', loc))
+ | DValRec vis =>
+ S.map2 (ListUtil.mapfold (mfvi ctx) vis,
+ fn vis' =>
+ (DValRec vis', loc))
| DExport (s, n, ts) =>
S.map2 (ListUtil.mapfold mft ts,
fn ts' =>
(DExport (s, n, ts'), loc))
+
+ and mfvi ctx (x, n, t, e, s) =
+ S.bind2 (mft t,
+ fn t' =>
+ S.map2 (mfe ctx e,
+ fn e' =>
+ (x, n, t', e', s)))
in
mfd
end
@@ -305,6 +314,8 @@ fun mapfoldB (all as {bind, ...}) =
val ctx' =
case #1 d' of
DVal (x, n, t, e, s) => bind (ctx, NamedE (x, n, t, SOME e, s))
+ | DValRec vis => foldl (fn ((x, n, t, e, s), ctx) =>
+ bind (ctx, NamedE (x, n, t, SOME e, s))) ctx vis
| DExport _ => ctx
in
S.map2 (mff ctx' ds',