Skip to content

Commit

Permalink
Fix bug in exceeds_max_children check for function calls,
Browse files Browse the repository at this point in the history
bump the version number.
  • Loading branch information
lukstafi committed Dec 20, 2023
1 parent 207d87b commit 4f8e5a5
Show file tree
Hide file tree
Showing 7 changed files with 746 additions and 756 deletions.
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

(documentation https://lukstafi.github.io/ppx_minidebug/ppx_minidebug)

(version 0.6.0)
(version 0.7.0)

(package
(name ppx_minidebug)
Expand Down
32 changes: 16 additions & 16 deletions ppx_minidebug.ml
Original file line number Diff line number Diff line change
Expand Up @@ -164,24 +164,24 @@ let debug_fun callback bind descr_loc typ_opt1 exp =
let result = pat2pat_res bind in
let body =
[%expr
[%e arg_logs];
if Debug_runtime.exceeds_max_nesting () then (
[%e log_string ~loc ~descr_loc "<max_nesting_depth exceeded>"];
Debug_runtime.close_log ();
failwith "ppx_minidebug: max_nesting_depth exceeded")
else if Debug_runtime.exceeds_max_children () then (
if Debug_runtime.exceeds_max_children () then (
[%e log_string ~loc ~descr_loc "<max_num_children exceeded>"];
Debug_runtime.close_log ();
failwith "ppx_minidebug: max_num_children exceeded")
else
match [%e callback body] with
| [%p result] ->
[%e !log_value ~loc ~typ ~descr_loc (pat2expr result)];
Debug_runtime.close_log ();
[%e pat2expr result]
| exception e ->
Debug_runtime.close_log ();
raise e]
else (
[%e arg_logs];
if Debug_runtime.exceeds_max_nesting () then (
[%e log_string ~loc ~descr_loc "<max_nesting_depth exceeded>"];
Debug_runtime.close_log ();
failwith "ppx_minidebug: max_nesting_depth exceeded")
else
match [%e callback body] with
| [%p result] ->
[%e !log_value ~loc ~typ ~descr_loc (pat2expr result)];
Debug_runtime.close_log ();
[%e pat2expr result]
| exception e ->
Debug_runtime.close_log ();
raise e)]
in
let body =
match typ_opt2 with None -> body | Some typ -> [%expr ([%e body] : [%t typ])]
Expand Down
2 changes: 1 addition & 1 deletion ppx_minidebug.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.6.0"
version: "0.7.0"
synopsis: "Debug logs for selected functions and let-bindings"
description:
"A poor man's `ppx_debug` with formatted logs of let-bound values, function arguments and results."
Expand Down
Loading

0 comments on commit 4f8e5a5

Please sign in to comment.