summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-05-05 12:58:13 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2012-05-05 12:58:13 -0400
commita424e0352aff3490a58d19de5ebf4a164bd03b65 (patch)
tree9cc3661046de89d0263f025bdbf935cce233811d /src
parentf2ae62f46ac8b9cefc841bd064c7ea8317cc9752 (diff)
-dumpTypesOnError
Diffstat (limited to 'src')
-rw-r--r--src/elaborate.sig3
-rw-r--r--src/elaborate.sml3
-rw-r--r--src/main.mlton.sml4
3 files changed, 9 insertions, 1 deletions
diff --git a/src/elaborate.sig b/src/elaborate.sig
index b4a4da88..d60cff42 100644
--- a/src/elaborate.sig
+++ b/src/elaborate.sig
@@ -37,6 +37,9 @@ signature ELABORATE = sig
(* After elaboration (successful or failed), should I output a mapping from
* all identifiers to their kinds/types? *)
+ val dumpTypesOnError : bool ref
+ (* Like above, but only used if there are compile errors. *)
+
val unifyMore : bool ref
(* Run all phases of type inference, even if an error is detected by an
* early phase. *)
diff --git a/src/elaborate.sml b/src/elaborate.sml
index fe2e2f12..07a1d976 100644
--- a/src/elaborate.sml
+++ b/src/elaborate.sml
@@ -39,6 +39,7 @@
open ElabErr
val dumpTypes = ref false
+ val dumpTypesOnError = ref false
val unifyMore = ref false
val incremental = ref false
val verbose = ref false
@@ -4747,7 +4748,7 @@ fun elabFile basis basis_tm topStr topSgn top_tm env file =
(*preface ("file", p_file env' file);*)
- if !dumpTypes then
+ if !dumpTypes orelse (!dumpTypesOnError andalso ErrorMsg.anyErrors ()) then
let
open L'
open Print.PD
diff --git a/src/main.mlton.sml b/src/main.mlton.sml
index 4e1f8e2c..6ecb2f92 100644
--- a/src/main.mlton.sml
+++ b/src/main.mlton.sml
@@ -43,6 +43,7 @@ fun oneRun args =
val () = (Compiler.debug := false;
Elaborate.verbose := false;
Elaborate.dumpTypes := false;
+ Elaborate.dumpTypesOnError := false;
Elaborate.unifyMore := false;
Compiler.dumpSource := false;
Compiler.doIflow := false;
@@ -103,6 +104,9 @@ fun oneRun args =
| "-dumpTypes" :: rest =>
(Elaborate.dumpTypes := true;
doArgs rest)
+ | "-dumpTypesOnError" :: rest =>
+ (Elaborate.dumpTypesOnError := true;
+ doArgs rest)
| "-unifyMore" :: rest =>
(Elaborate.unifyMore := true;
doArgs rest)