From 6314b4c27a14576b356258dad74607168135cb51 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 3 Aug 2008 12:43:20 -0400 Subject: Compiled pattern matching to C --- src/mono_util.sml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/mono_util.sml') 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, -- cgit v1.2.3