diff src/core_env.sml @ 1080:a4979e31e4bf

Another try at reasonable Especialize, this time with a custom traversal
author Adam Chlipala <adamc@hcoop.net>
date Sun, 20 Dec 2009 15:17:43 -0500
parents 0657e5adc938
children c316ca3c9ec6
line wrap: on
line diff
--- a/src/core_env.sml	Tue Dec 15 19:26:52 2009 -0500
+++ b/src/core_env.sml	Sun Dec 20 15:17:43 2009 -0500
@@ -368,4 +368,13 @@
       | 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