Browse Source

[analyzer] respect debug config on typing errors too

Simon Krajewski 3 years ago
parent
commit
31c94d5d3e
1 changed files with 7 additions and 5 deletions
  1. 7 5
      src/optimization/analyzer.ml

+ 7 - 5
src/optimization/analyzer.ml

@@ -1071,21 +1071,23 @@ module Run = struct
 				Debug.dot_debug actx c cf;
 				Debug.dot_debug actx c cf;
 				print_endline (Printf.sprintf "dot graph written to %s" (String.concat "/" (Debug.get_dump_path actx c cf)));
 				print_endline (Printf.sprintf "dot graph written to %s" (String.concat "/" (Debug.get_dump_path actx c cf)));
 			in
 			in
+			let maybe_debug () = match config.debug_kind with
+				| DebugNone -> ()
+				| DebugDot -> Debug.dot_debug actx c cf;
+				| DebugFull -> debug()
+			in
 			let e = try
 			let e = try
 				run_on_expr actx e
 				run_on_expr actx e
 			with
 			with
 			| Error.Error _ | Abort _ | Sys.Break as exc ->
 			| Error.Error _ | Abort _ | Sys.Break as exc ->
+				maybe_debug();
 				raise exc
 				raise exc
 			| exc ->
 			| exc ->
 				debug();
 				debug();
 				raise exc
 				raise exc
 			in
 			in
 			let e = reduce_control_flow com e in
 			let e = reduce_control_flow com e in
-			begin match config.debug_kind with
-				| DebugNone -> ()
-				| DebugDot -> Debug.dot_debug actx c cf;
-				| DebugFull -> debug()
-			end;
+			maybe_debug();
 			cf.cf_expr <- Some e;
 			cf.cf_expr <- Some e;
 		| _ -> ()
 		| _ -> ()