summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 09:05:33 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 09:05:33 -0400
commitf275800f83cfeb86cef8f28b511bf37165d37ccd (patch)
tree4e51f95d90abfc2f22acaba1f3c35cf01067dfba /src
parent652ca797f5c9de9adc198df0c0e8a706807328a6 (diff)
Fix shaking of tables
Diffstat (limited to 'src')
-rw-r--r--src/shake.sml10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/shake.sml b/src/shake.sml
index 015d2f11..6d8280fe 100644
--- a/src/shake.sml
+++ b/src/shake.sml
@@ -45,9 +45,11 @@ val dummye = (EPrim (Prim.String ""), ErrorMsg.dummySpan)
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 @@ fun shake file =
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)