Skip to content

Commit

Permalink
Prepare for 5.2 AST bump
Browse files Browse the repository at this point in the history
  • Loading branch information
patricoferris committed Oct 26, 2024
1 parent 3e6248d commit 05e91a7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions trace/ppx/trace_ppx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,14 @@ let map_trace = object(self)
let args = List.map (fun (x,y) -> x, self#expression y) args in
if args = [] then hd
else { e with pexp_desc = Pexp_apply (hd,args)}
| Pexp_fun(_,_,pat,rest) when not !enabled ->
let has_iftrace { ppat_attributes = l; _ } = has_iftrace_attribute l in
if has_iftrace pat then self#expression rest
else e
| Pexp_function (params, constraint_, rest) when not !enabled ->
let has_iftrace_pat { ppat_attributes = l; _ } = has_iftrace_attribute l in
let does_not_have_iftrace_param = function
| { pparam_desc = Pparam_val (_, _, pat); _ } -> not (has_iftrace_pat pat)
| _ -> true
in
let params = List.filter does_not_have_iftrace_param params in
{ e with pexp_desc = Pexp_function (params, constraint_, rest) }
| Pexp_let(_,[{pvb_pat = { ppat_attributes = l; _}; _}],rest) when not !enabled ->
if has_iftrace_attribute l then self#expression rest
else e
Expand Down

0 comments on commit 05e91a7

Please sign in to comment.