summaryrefslogtreecommitdiff
path: root/src/corify.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/corify.sml
parent1798f5eb1b11613d88acb307472922976f1583b4 (diff)
Compiled pattern matching to C
Diffstat (limited to 'src/corify.sml')
-rw-r--r--src/corify.sml13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/corify.sml b/src/corify.sml
index 44da20da..a3cbb92e 100644
--- a/src/corify.sml
+++ b/src/corify.sml
@@ -411,10 +411,10 @@ fun corifyPatCon st pc =
fun corifyPat st (p, loc) =
case p of
L.PWild => (L'.PWild, loc)
- | L.PVar x => (L'.PVar x, loc)
+ | L.PVar (x, t) => (L'.PVar (x, corifyCon st t), loc)
| L.PPrim p => (L'.PPrim p, loc)
| L.PCon (pc, po) => (L'.PCon (corifyPatCon st pc, Option.map (corifyPat st) po), loc)
- | L.PRecord xps => (L'.PRecord (map (fn (x, p) => (x, corifyPat st p)) xps), loc)
+ | L.PRecord xps => (L'.PRecord (map (fn (x, p, t) => (x, corifyPat st p, corifyCon st t)) xps), loc)
fun corifyExp st (e, loc) =
case e of
@@ -473,10 +473,11 @@ fun corifyExp st (e, loc) =
{field = corifyCon st field, rest = corifyCon st rest}), loc)
| L.EFold k => (L'.EFold (corifyKind k), loc)
- | L.ECase (e, pes, t) => (L'.ECase (corifyExp st e,
- map (fn (p, e) => (corifyPat st p, corifyExp st e)) pes,
- corifyCon st t),
- loc)
+ | L.ECase (e, pes, {disc, result}) =>
+ (L'.ECase (corifyExp st e,
+ map (fn (p, e) => (corifyPat st p, corifyExp st e)) pes,
+ {disc = corifyCon st disc, result = corifyCon st result}),
+ loc)
| L.EWrite e => (L'.EWrite (corifyExp st e), loc)