diff options
author | Adam Chlipala <adam@chlipala.net> | 2014-01-19 13:08:01 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2014-01-19 13:08:01 -0500 |
commit | a0dd36d3721acc580461be8c968f6bdafc83827b (patch) | |
tree | 2892a610e83d5eb8212bf62f191746f807b4e2fa /src | |
parent | 6787b686afe5fd3e65b3d377d4c363b4cd086dad (diff) |
New compiler option: -stop
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler.sig | 3 | ||||
-rw-r--r-- | src/compiler.sml | 7 | ||||
-rw-r--r-- | src/main.mlton.sml | 3 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler.sig b/src/compiler.sig index fdb1311f..fa131cf4 100644 --- a/src/compiler.sig +++ b/src/compiler.sig @@ -202,4 +202,7 @@ signature COMPILER = sig val moduleOf : string -> string + val setStop : string -> unit + (* Stop compilation after this phase. *) + end diff --git a/src/compiler.sml b/src/compiler.sml index 0ffab01c..21ae903f 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -86,6 +86,9 @@ val doIflow = ref false val doDumpSource = ref (fn () => ()) +val stop = ref (NONE : string option) +fun setStop s = stop := SOME s + fun transform (ph : ('src, 'dst) phase) name = { func = fn input => let val () = if !debug then @@ -102,6 +105,10 @@ fun transform (ph : ('src, 'dst) phase) name = { (!doDumpSource (); doDumpSource := (fn () => ()); NONE) + else if !stop = SOME name then + (Print.eprint (#print ph v); + ErrorMsg.error ("Stopped compilation after phase " ^ name); + NONE) else (if !dumpSource then doDumpSource := (fn () => Print.eprint (#print ph v)) diff --git a/src/main.mlton.sml b/src/main.mlton.sml index b0c4e03f..6bdc9539 100644 --- a/src/main.mlton.sml +++ b/src/main.mlton.sml @@ -133,6 +133,9 @@ fun oneRun args = | "-static" :: rest => (Settings.setStaticLinking true; doArgs rest) + | "-stop" :: phase :: rest => + (Compiler.setStop phase; + doArgs rest) | "-path" :: name :: path :: rest => (Compiler.addPath (name, path); doArgs rest) |