diff src/shake.sml @ 125:fd98dd10dce7

Corifying (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:23:04 -0400
parents 813e5a52063d
children f0d3402184d1
line wrap: on
line diff
--- a/src/shake.sml	Thu Jul 17 10:13:18 2008 -0400
+++ b/src/shake.sml	Thu Jul 17 10:23:04 2008 -0400
@@ -49,6 +49,8 @@
 
         val (cdef, edef) = foldl (fn ((DCon (_, n, _, c), _), (cdef, edef)) => (IM.insert (cdef, n, c), edef)
                                    | ((DVal (_, n, t, e, _), _), (cdef, edef)) => (cdef, IM.insert (edef, n, (t, e)))
+                                   | ((DValRec vis, _), (cdef, edef)) =>
+                                     (cdef, foldl (fn ((_, n, t, e, _), edef) => IM.insert (edef, n, (t, e))) edef vis)
                                    | ((DExport _, _), acc) => acc)
                                  (IM.empty, IM.empty) file
 
@@ -99,6 +101,7 @@
     in
         List.filter (fn (DCon (_, n, _, _), _) => IS.member (#con s, n)
                       | (DVal (_, n, _, _, _), _) => IS.member (#exp s, n)
+                      | (DValRec vis, _) => List.exists (fn (_, n, _, _, _) => IS.member (#exp s, n)) vis
                       | (DExport _, _) => true) file
     end