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 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 9 additions & 4 deletions ppx/ppx_interact.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,20 @@ let traverse () =
method! expression e env =
let open Ast_helper in
match e.pexp_desc with
| Pexp_fun (_, _, pat, _) ->
let vs = var_names_of#pattern pat [] in
| Pexp_function (params, _, _) ->
let vs = List.fold_left (fun acc -> function
| { pparam_desc = Pparam_val (_, _, pat); _ } -> (var_names_of#pattern pat []) :: acc
| { pparam_desc = Pparam_newtype _; _ } -> acc) [] params in
(* update env, and only then recurse into subexpressions *)
let env1 =
List.fold_right
(fun c t ->
(fun cs t ->
let new_bindings =
List.map (fun c -> (c, env.module_context, Lident c)) cs
in
{
t with
bindings = (c, env.module_context, Lident c) :: t.bindings;
bindings = new_bindings @ t.bindings;
})
vs env
in
Expand Down