Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for 5.2 AST bump #276

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to recurse on rest, params and constraint here

| Pexp_let(_,[{pvb_pat = { ppat_attributes = l; _}; _}],rest) when not !enabled ->
if has_iftrace_attribute l then self#expression rest
else e
Expand Down
Loading