Skip to content

Commit

Permalink
Fixed boolean return value of Cidre.check and Cidre.make so that it i…
Browse files Browse the repository at this point in the history
…s true if there were no warnings (or errors).
  • Loading branch information
Rowan Davies committed Jul 4, 2013
1 parent 735606b commit 6bbb964
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Cidre/Cidre.sml
Expand Up @@ -188,7 +188,8 @@ structure Cidre = struct
(case ParseElab.parse_elab {infB=infB0, elabB=B.plus_rT(B0,rT0), prjid=atbdec, file=atbdec}
of SUCCESS {report, infB, elabB, topdec} =>
(if print_flag then print_result_report report
else (Flags.report_warnings(); Flags.reset_warnings();warned:=true);
else ( warned := ((!warned) orelse (Flags.get_warned())) ;
Flags.report_warnings(); Flags.reset_warnings() );
( B.to_rT elabB, (infB, BE.empty, B.no_rT elabB), BC0 ) )
| FAILURE (report, error_codes) =>
(Flags.report_warnings(); (* Print warnings even if there are errors. *)
Expand Down
1 change: 1 addition & 0 deletions src/Common/FLAGS-sig.sml
Expand Up @@ -14,6 +14,7 @@ signature FLAGS =
val warn_string : string -> unit
val report_warnings : unit -> unit
val reset_warnings : unit -> unit
val get_warned : unit -> bool

(*Warnings are collected during compilation and printed all at once at
the end of the compilation of a program. The printing is done in
Expand Down
2 changes: 2 additions & 0 deletions src/Common/Flags.sml
Expand Up @@ -184,6 +184,8 @@ functor Flags (structure Crash : CRASH
fun warn report = warnings := report :: !warnings
val warn_string = warn o Report.line

fun get_warned () = case (!warnings) of [] => false | _::_ => true

fun report_warnings () =
(case !warnings of
[] => ()
Expand Down

0 comments on commit 6bbb964

Please sign in to comment.