summaryrefslogtreecommitdiff
path: root/src/mono_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-03 12:43:20 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-03 12:43:20 -0400
commit6314b4c27a14576b356258dad74607168135cb51 (patch)
treeec853f9102b3d3e5729457db7a10fd4f81165431 /src/mono_util.sml
parent1798f5eb1b11613d88acb307472922976f1583b4 (diff)
Compiled pattern matching to C
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r--src/mono_util.sml16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mono_util.sml b/src/mono_util.sml
index 4414385d..805a1c88 100644
--- a/src/mono_util.sml
+++ b/src/mono_util.sml
@@ -181,30 +181,30 @@ fun mapfoldB {typ = fc, exp = fe, bind} =
fn e' =>
(EField (e', x), loc))
- | ECase (e, pes, t) =>
+ | ECase (e, pes, {disc, result}) =>
S.bind2 (mfe ctx e,
fn e' =>
S.bind2 (ListUtil.mapfold (fn (p, e) =>
let
- val dummyt = (TFfi ("", ""), ErrorMsg.dummySpan)
-
fun pb ((p, _), ctx) =
case p of
PWild => ctx
- | PVar x => bind (ctx, RelE (x, dummyt))
+ | PVar (x, t) => bind (ctx, RelE (x, t))
| PPrim _ => ctx
| PCon (_, NONE) => ctx
| PCon (_, SOME p) => pb (p, ctx)
- | PRecord xps => foldl (fn ((_, p), ctx) =>
+ | PRecord xps => foldl (fn ((_, p, _), ctx) =>
pb (p, ctx)) ctx xps
in
S.map2 (mfe (pb (p, ctx)) e,
fn e' => (p, e'))
end) pes,
fn pes' =>
- S.map2 (mft t,
- fn t' =>
- (ECase (e', pes', t'), loc))))
+ S.bind2 (mft disc,
+ fn disc' =>
+ S.map2 (mft result,
+ fn result' =>
+ (ECase (e', pes', {disc = disc', result = result'}), loc)))))
| EStrcat (e1, e2) =>
S.bind2 (mfe ctx e1,