Skip to content

Commit 15d5cf4

Browse files
committed
remove function_kind which does not make sense
1 parent 505623c commit 15d5cf4

File tree

6 files changed

+23
-35
lines changed

6 files changed

+23
-35
lines changed

jscomp/core/lam_convert.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,9 +713,8 @@ let convert (exports : Set_ident.t) (lam : Lambda.lambda) : Lam.t * Lam_module_i
713713
(* we need do this eargly in case [aux fn] add some wrapper *)
714714
Lam.apply (convert_aux fn) (Ext_list.map args convert_aux ) {ap_loc = loc; ap_inlined = (convert_inline_attr ap_inlined); ap_status = App_na}
715715
| Lfunction
716-
{kind; params; body ; attr }
716+
{ params; body ; attr }
717717
->
718-
assert (kind = Curried);
719718
let new_map,body = rename_optional_parameters Map_ident.empty params body in
720719
let attr = convert_fn_attribute attr in
721720
if Map_ident.is_empty new_map then

jscomp/ml/lambda.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ type specialise_attribute =
239239
| Never_specialise (* [@specialise never] *)
240240
| Default_specialise (* no [@specialise] attribute *)
241241

242-
type function_kind = Curried | Tupled
242+
243243

244244
type let_kind = Strict | Alias | StrictOpt | Variable
245245

@@ -276,7 +276,7 @@ type lambda =
276276
| Lsend of string * lambda * Location.t
277277

278278
and lfunction =
279-
{ kind: function_kind;
279+
{
280280
params: Ident.t list;
281281
body: lambda;
282282
attr: function_attribute; (* specified with [@inline] attribute *)
@@ -598,8 +598,8 @@ let subst_lambda s lam =
598598
| Lapply ap ->
599599
Lapply{ap with ap_func = subst ap.ap_func;
600600
ap_args = List.map subst ap.ap_args}
601-
| Lfunction{kind; params; body; attr; loc} ->
602-
Lfunction{kind; params; body = subst body; attr; loc}
601+
| Lfunction{ params; body; attr; loc} ->
602+
Lfunction{ params; body = subst body; attr; loc}
603603
| Llet(str, k, id, arg, body) -> Llet(str, k, id, subst arg, subst body)
604604
| Lletrec(decl, body) -> Lletrec(List.map subst_decl decl, subst body)
605605
| Lprim(p, args, loc) -> Lprim(p, List.map subst args, loc)
@@ -645,8 +645,8 @@ let rec map f lam =
645645
ap_inlined;
646646
ap_specialised;
647647
}
648-
| Lfunction { kind; params; body; attr; loc; } ->
649-
Lfunction { kind; params; body = map f body; attr; loc; }
648+
| Lfunction { params; body; attr; loc; } ->
649+
Lfunction { params; body = map f body; attr; loc; }
650650
| Llet (str, k, v, e1, e2) ->
651651
Llet (str, k, v, map f e1, map f e2)
652652
| Lletrec (idel, e2) ->

jscomp/ml/lambda.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ type specialise_attribute =
264264
| Never_specialise (* [@specialise never] *)
265265
| Default_specialise (* no [@specialise] attribute *)
266266

267-
type function_kind = Curried | Tupled
267+
268268

269269
type let_kind = Strict | Alias | StrictOpt | Variable
270270
(* Meaning of kinds for let x = e in e':
@@ -315,7 +315,7 @@ type lambda =
315315
| Lsend of string * lambda * Location.t
316316

317317
and lfunction =
318-
{ kind: function_kind;
318+
{
319319
params: Ident.t list;
320320
body: lambda;
321321
attr: function_attribute; (* specified with [@inline] attribute *)

jscomp/ml/printlambda.ml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -418,20 +418,10 @@ let rec lam ppf = function
418418
apply_tailcall_attribute ap.ap_should_be_tailcall
419419
apply_inlined_attribute ap.ap_inlined
420420
apply_specialised_attribute ap.ap_specialised
421-
| Lfunction{kind; params; body; attr} ->
421+
| Lfunction{ params; body; attr} ->
422422
let pr_params ppf params =
423-
match kind with
424-
| Curried ->
425423
List.iter (fun param -> fprintf ppf "@ %a" Ident.print param) params
426-
| Tupled ->
427-
fprintf ppf " (";
428-
let first = ref true in
429-
List.iter
430-
(fun param ->
431-
if !first then first := false else fprintf ppf ",@ ";
432-
Ident.print ppf param)
433-
params;
434-
fprintf ppf ")" in
424+
in
435425
fprintf ppf "@[<2>(function%a@ %a%a)@]" pr_params params
436426
function_attribute attr lam body
437427
| Llet(str, k, id, arg, body) ->

jscomp/ml/translcore.ml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ let transl_primitive loc p env ty path =
425425
match prim with
426426
| Plazyforce ->
427427
let parm = Ident.create "prim" in
428-
Lfunction{kind = Curried; params = [parm];
428+
Lfunction{ params = [parm];
429429
body = Matching.inline_lazy_force (Lvar parm) Location.none;
430430
loc = loc;
431431
attr = default_stub_attribute }
@@ -435,7 +435,7 @@ let transl_primitive loc p env ty path =
435435
| 0 -> lam
436436
| 1 -> (* TODO: we should issue a warning ? *)
437437
let param = Ident.create "prim" in
438-
Lfunction{kind = Curried; params = [param];
438+
Lfunction{ params = [param];
439439
attr = default_stub_attribute;
440440
loc = loc;
441441
body = Lprim(Pmakeblock(0, Lambda.Blk_tuple, Immutable, None),
@@ -450,7 +450,7 @@ let transl_primitive loc p env ty path =
450450
let params =
451451
if prim_arity = 1 then [Ident.create "prim"]
452452
else make_params prim_arity prim_arity in
453-
Lfunction{ kind = Curried; params;
453+
Lfunction{ params;
454454
attr = default_stub_attribute;
455455
loc = loc;
456456
body = Lprim(prim, List.map (fun id -> Lvar id) params, loc) }
@@ -629,7 +629,7 @@ and transl_exp0 e =
629629
| Texp_let(rec_flag, pat_expr_list, body) ->
630630
transl_let rec_flag pat_expr_list (event_before body (transl_exp body))
631631
| Texp_function { arg_label = _; param; cases; partial; } ->
632-
let ((kind, params), body) =
632+
let ( params, body) =
633633
let pl = push_defaults e.exp_loc [] cases partial in
634634
transl_function e.exp_loc partial
635635
param pl
@@ -641,7 +641,7 @@ and transl_exp0 e =
641641
}
642642
in
643643
let loc = e.exp_loc in
644-
Lfunction{kind; params; body; attr; loc}
644+
Lfunction{ params; body; attr; loc}
645645
| Texp_apply({ exp_desc = Texp_ident(path, _, {val_kind = Val_prim p});
646646
exp_type = prim_type } as funct, oargs)
647647
when List.length oargs >= p.prim_arity
@@ -954,11 +954,11 @@ and transl_apply ?(should_be_tailcall=false) ?(inlined = Default_inline)
954954
and id_arg = Ident.create "param" in
955955
let body =
956956
match build_apply handle ((Lvar id_arg, optional)::args') l with
957-
Lfunction{kind = Curried; params = ids; body = lam; attr; loc} ->
958-
Lfunction{kind = Curried; params = id_arg::ids; body = lam; attr;
957+
Lfunction{params = ids; body = lam; attr; loc} ->
958+
Lfunction{params = id_arg::ids; body = lam; attr;
959959
loc}
960960
| lam ->
961-
Lfunction{kind = Curried; params = [id_arg]; body = lam;
961+
Lfunction{params = [id_arg]; body = lam;
962962
attr = default_stub_attribute; loc = loc}
963963
in
964964
List.fold_left
@@ -980,12 +980,12 @@ and transl_function loc partial param cases =
980980
c_rhs={exp_desc = Texp_function { arg_label = _; param = param'; cases;
981981
partial = partial'; }} as exp}]
982982
when Parmatch.inactive ~partial pat ->
983-
let ((_, params), body) =
983+
let (params, body) =
984984
transl_function exp.exp_loc partial' param' cases in
985-
((Curried, param :: params),
985+
((param :: params),
986986
Matching.for_function loc None (Lvar param) [pat, body] partial)
987987
| _ ->
988-
((Curried, [param]),
988+
([param],
989989
Matching.for_function loc None (Lvar param)
990990
(transl_cases cases) partial)
991991

jscomp/ml/translmod.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ and apply_coercion_result loc strict funct params args cc_res =
111111
(param :: params) (arg :: args) cc_res
112112
| _ ->
113113
name_lambda strict funct (fun id ->
114-
Lfunction{kind = Curried; params = List.rev params;
114+
Lfunction{ params = List.rev params;
115115
attr = { default_function_attribute with
116116
is_a_functor = true;
117117
stub = true; };
@@ -425,7 +425,6 @@ let rec compile_functor mexp coercion root_path loc =
425425
functor_params_rev
426426
in
427427
Lfunction {
428-
kind = Curried;
429428
params;
430429
attr = {
431430
inline = inline_attribute;

0 commit comments

Comments
 (0)