diff options
Diffstat (limited to 'src/compiler.sml')
-rw-r--r-- | src/compiler.sml | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/compiler.sml b/src/compiler.sml index 57c3e1ff..8ee86947 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -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 @@ type ('src, 'dst) transform = { } 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 @@ fun transform (ph : ('src, 'dst) phase) name = { 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 |