aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/mono_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-01-07 15:56:22 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2012-01-07 15:56:22 -0500
commit09b5839acfe26561fa87c89168133fc93c1083cc (patch)
tree587292f9b176c383c7b6332cdc30a817e355fe1d /src/mono_util.sml
parentbd78657f61d3783f9a282bf38ad0cbcb8b8bf5d4 (diff)
First part of changes to avoid depending on C function call argument order of evaluation (omitting normal Ur function calls, so far)
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r--src/mono_util.sml10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mono_util.sml b/src/mono_util.sml
index 39305d1b..38016f85 100644
--- a/src/mono_util.sml
+++ b/src/mono_util.sml
@@ -156,6 +156,12 @@ fun mapfoldB {typ = fc, exp = fe, bind} =
fun mfe ctx e acc =
S.bindP (mfe' ctx e acc, fe ctx)
+ and mfet ctx (e, t) =
+ S.bind2 (mfe ctx e,
+ fn e' =>
+ S.map2 (mft t,
+ fn t' => (e', t')))
+
and mfe' ctx (eAll as (e, loc)) =
case e of
EPrim _ => S.return2 eAll
@@ -178,7 +184,7 @@ fun mapfoldB {typ = fc, exp = fe, bind} =
(ESome (t', e'), loc)))
| EFfi _ => S.return2 eAll
| EFfiApp (m, x, es) =>
- S.map2 (ListUtil.mapfold (fn e => mfe ctx e) es,
+ S.map2 (ListUtil.mapfold (fn e => mfet ctx e) es,
fn es' =>
(EFfiApp (m, x, es'), loc))
| EApp (e1, e2) =>
@@ -479,7 +485,7 @@ fun appLoc f =
| ENone _ => ()
| ESome (_, e) => appl e
| EFfi _ => ()
- | EFfiApp (_, _, es) => app appl es
+ | EFfiApp (_, _, es) => app (appl o #1) es
| EApp (e1, e2) => (appl e1; appl e2)
| EAbs (_, _, _, e1) => appl e1
| EUnop (_, e1) => appl e1