diff src/compiler.sml @ 1677:3cfc79f92db7

-dumpSource flag; Especialize tweak: may specialize any argument sequence ending in a value of function-containing type
author Adam Chlipala <adam@chlipala.net>
date Thu, 12 Jan 2012 20:37:39 -0500
parents 8de2ea0a0701
children 2b04104896a8
line wrap: on
line diff
--- a/src/compiler.sml	Wed Jan 11 14:52:31 2012 -0500
+++ b/src/compiler.sml	Thu Jan 12 20:37:39 2012 -0500
@@ -1,4 +1,4 @@
-(* Copyright (c) 2008-2011, Adam Chlipala
+(* Copyright (c) 2008-2012, Adam Chlipala
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -79,8 +79,11 @@
 }
 
 val debug = ref false
+val dumpSource = ref false
 val doIflow = ref false
 
+val doDumpSource = ref (fn () => ())
+
 fun transform (ph : ('src, 'dst) phase) name = {
     func = fn input => let
                   val () = if !debug then
@@ -94,9 +97,15 @@
                   else
                       ();
                   if ErrorMsg.anyErrors () then
-                      NONE
+                      (!doDumpSource ();
+                       doDumpSource := (fn () => ());
+                       NONE)
                   else
-                      SOME v
+                      (if !dumpSource then
+                           doDumpSource := (fn () => Print.eprint (#print ph v))
+                       else
+                           ();
+                       SOME v)
               end,
     print = #print ph,
     time = fn (input, pmap) => let