changeset 1865:5144e03ef603

Potentially exponential search through where to head-normalize in [decompileCon]
author Adam Chlipala <adam@chlipala.net>
date Mon, 19 Aug 2013 12:38:43 -0400
parents 1aa9629e3a4c
children 9fc086e3c95a
files src/elaborate.sml
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/elaborate.sml	Mon Aug 19 12:25:32 2013 -0400
+++ b/src/elaborate.sml	Mon Aug 19 12:38:43 2013 -0400
@@ -3553,11 +3553,16 @@
                        | L'.KFun _ => NONE
 
                  fun maybeHnorm env c =
-                     hnormCon env c
-                     handle E.UnboundNamed _ => c
-
-                 fun decompileCon env (c as (_, loc)) =
-                     case #1 (maybeHnorm env c) of
+		     hnormCon env c
+		     handle E.UnboundNamed _ => c
+
+                 fun decompileCon env c =
+		     case decompileCon' env c of
+			 SOME v => SOME v
+		       | NONE => decompileCon' env (maybeHnorm env c)
+
+		 and decompileCon' env (c as (_, loc)) =
+                     case #1 c of
                          L'.CRel i =>
                          let
                              val (s, _) = E.lookupCRel env i
@@ -3619,6 +3624,10 @@
 			 end
 
 		       | L'.CMap _ => SOME (L.CMap, loc)
+		       | L'.TRecord c =>
+			 (case decompileCon env c of
+			      NONE => NONE
+			    | SOME c' => SOME (L.TRecord c', loc))
 
                        | c => (Print.preface ("WTF?", p_con env (c, loc)); NONE)