changeset 248:d5b12daa9b47

Fix shaking of tables
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 09:05:33 -0400
parents 5c50b17f5e4a
children b6b75e6e0898
files src/shake.sml
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/shake.sml	Sun Aug 31 09:00:28 2008 -0400
+++ b/src/shake.sml	Sun Aug 31 09:05:33 2008 -0400
@@ -45,9 +45,11 @@
 
 fun shake file =
     let
-        val page_es = List.foldl
-                          (fn ((DExport (_, n), _), page_es) => n :: page_es
-                            | (_, page_es) => page_es) [] file
+        val (page_es, table_cs) =
+            List.foldl
+                (fn ((DExport (_, n), _), (page_es, table_cs)) => (n :: page_es, table_cs)
+                  | ((DTable (_, _, c, _), _), (page_es, table_cs)) => (page_es, c :: table_cs)
+                  | (_, acc) => acc) ([], []) file
 
         val (cdef, edef) = foldl (fn ((DCon (_, n, _, c), _), (cdef, edef)) => (IM.insert (cdef, n, [c]), edef)
                                    | ((DDatatype (_, n, _, xncs), _), (cdef, edef)) =>
@@ -104,6 +106,8 @@
                           case IM.find (edef, n) of
                               NONE => raise Fail "Shake: Couldn't find 'val'"
                             | SOME (t, e) => shakeExp (shakeCon s t) e) s page_es
+
+        val s = foldl (fn (c, s) => shakeCon s c) s table_cs
     in
         List.filter (fn (DCon (_, n, _, _), _) => IS.member (#con s, n)
                       | (DDatatype (_, n, _, _), _) => IS.member (#con s, n)