10000 refactor: reuse convert_lfunction_params_and_body by anmonteiro · Pull Request #1333 · melange-re/melange · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor: reuse convert_lfunction_params_and_body #1333

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

Merged
merged 1 commit into from
Feb 20, 2025
Merged
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
9 changes: 5 additions & 4 deletions jscomp/core/lam_convert.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -766,17 +766,18 @@ let convert (exports : Ident.Set.t) (lam : Lambda.lambda) :
ap_status = App_na;
}
| Lfunction { params; body = l; attr = attr1; _ } -> (
let params, body =
let body = convert_aux ~dynamic_import l in
convert_lfunction_params_and_body params body
in
(* because of ocaml/ocaml#12236, `fun a -> fun b -> ..` becomes 2
`Lfunction` nodes in the AST on OCaml 5.2 and up. *)
match convert_aux ~dynamic_import l with
match body with
| Lfunction { arity = arity'; params = params'; body; attr = attr2 }
when List.length params + List.length params' <= Lambda.max_arity() ->

let params, body = convert_lfunction_params_and_body params body in
let arity = (List.length params) + arity' in
Lam.function_ ~arity ~params:(params @ params') ~body ~attr:attr2
| body ->
let params, body = convert_lfunction_params_and_body params body in
Lam.function_ ~attr:attr1 ~arity:(List.length params) ~params ~body)
| Llet (kind, _value_kind, id, e, body) (*FIXME*) ->
convert_let kind id e body
Expand Down
0