diff src/elab_util.sml @ 123:e3041657d653

Parsing and elaborating (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:09:34 -0400
parents 813e5a52063d
children 7420fa18d657
line wrap: on
line diff
--- a/src/elab_util.sml	Sun Jul 13 20:25:25 2008 -0400
+++ b/src/elab_util.sml	Thu Jul 17 10:09:34 2008 -0400
@@ -504,6 +504,8 @@
                                                    bind (ctx, NamedC (x, k))
                                                  | DVal (x, _, c, _) =>
                                                    bind (ctx, NamedE (x, c))
+                                                 | DValRec vis =>
+                                                   foldl (fn ((x, _, c, _), ctx) => bind (ctx, NamedE (x, c))) ctx vis
                                                  | DSgn (x, _, sgn) =>
                                                    bind (ctx, Sgn (x, sgn))
                                                  | DStr (x, _, sgn, _) =>
@@ -546,12 +548,14 @@
                             S.map2 (mfc ctx c,
                                     fn c' =>
                                        (DCon (x, n, k', c'), loc)))
-              | DVal (x, n, c, e) =>
-                S.bind2 (mfc ctx c,
-                         fn c' =>
-                            S.map2 (mfe ctx e,
-                                    fn e' =>
-                                       (DVal (x, n, c', e'), loc)))
+              | DVal vi =>
+                S.map2 (mfvi ctx vi,
+                     fn vi' =>
+                        (DVal vi', loc))
+              | DValRec vis =>
+                S.map2 (ListUtil.mapfold (mfvi ctx) vis,
+                     fn vis' =>
+                        (DValRec vis', loc))
               | DSgn (x, n, sgn) =>
                 S.map2 (mfsg ctx sgn,
                         fn sgn' =>
@@ -578,6 +582,13 @@
                             S.map2 (mfst ctx str,
                                     fn str' =>
                                        (DExport (en, sgn', str'), loc)))
+
+        and mfvi ctx (x, n, c, e) =
+            S.bind2 (mfc ctx c,
+                  fn c' =>
+                     S.map2 (mfe ctx e,
+                          fn e' =>
+                             (x, n, c', e')))
     in
         mfd
     end