changeset 1324:d596c7002ad8

More accurate/conservative leaky type detection in CjrPrint
author Adam Chlipala <adamc@hcoop.net>
date Sun, 28 Nov 2010 15:06:11 -0500
parents 0d8bd8ae8417
children fdf48f6ba418
files src/cjr_print.sml
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/cjr_print.sml	Fri Nov 26 11:57:04 2010 -0500
+++ b/src/cjr_print.sml	Sun Nov 28 15:06:11 2010 -0500
@@ -525,6 +525,10 @@
 
       | _ => raise Fail "CjrPrint: getPargs"
 
+val notLeakies = SS.fromList ["int", "float", "char", "time", "bool", "unit", "client", "channel",
+                              "xhtml", "page", "xbody", "css_class"]
+val notLeakies' = SS.fromList ["blob"]
+
 fun notLeaky env allowHeapAllocated =
     let
         fun nl ok (t, _) =
@@ -548,9 +552,9 @@
                                                     NONE => true
                                                   | SOME t => nl ok' t) cons
                  end)
-              | TFfi ("Basis", "string") => false
-              | TFfi ("Basis", "blob") => allowHeapAllocated
-              | TFfi _ => true
+              | TFfi ("Basis", t) => SS.member (notLeakies, t)
+                                     orelse (allowHeapAllocated andalso SS.member (notLeakies', t))
+              | TFfi _ => false
               | TOption t => allowHeapAllocated andalso nl ok t
               | TList (t, _) => allowHeapAllocated andalso nl ok t
     in