diff src/corify.sml @ 182:d11754ffe252

Compiled pattern matching to C
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 12:43:20 -0400
parents 5d030ee143e2
children 19ee24bffbc0
line wrap: on
line diff
--- a/src/corify.sml	Sun Aug 03 11:17:33 2008 -0400
+++ b/src/corify.sml	Sun Aug 03 12:43:20 2008 -0400
@@ -411,10 +411,10 @@
 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 @@
                                                    {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)