summaryrefslogtreecommitdiff
path: root/src/core_env.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-12-20 15:17:43 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-12-20 15:17:43 -0500
commita16e550a2284ab7485429afae24f20032e5bac17 (patch)
treef9a855e7e3c71bbfd21c3657ce6a4a7bb2424bd3 /src/core_env.sml
parent489ae9fdc1b78eac867252e5088baa632d85f8c9 (diff)
Another try at reasonable Especialize, this time with a custom traversal
Diffstat (limited to 'src/core_env.sml')
-rw-r--r--src/core_env.sml9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core_env.sml b/src/core_env.sml
index 4c50bdd7..9001e29c 100644
--- a/src/core_env.sml
+++ b/src/core_env.sml
@@ -368,4 +368,13 @@ fun patBindsN (p, loc) =
| PCon (_, _, _, SOME p) => patBindsN p
| PRecord xps => foldl (fn ((_, p, _), count) => count + patBindsN p) 0 xps
+fun patBindsL (p, loc) =
+ case p of
+ PWild => []
+ | PVar (x, t) => [(x, t)]
+ | PPrim _ => []
+ | PCon (_, _, _, NONE) => []
+ | PCon (_, _, _, SOME p) => patBindsL p
+ | PRecord xps => rev (ListUtil.mapConcat (rev o patBindsL o #2) xps)
+
end