Skip to content

Commit 581db90

Browse files
authored
Remove leftover Fn_uncurry_arity and no_auto_uncurried_arg_types (rescript-lang#6939)
* Remove leftover Fn_uncurry_arity * Remove no_auto_uncurried_arg_types which is always true now * CHANGELOG
1 parent 2a6f0fa commit 581db90

File tree

6 files changed

+1
-46
lines changed

6 files changed

+1
-46
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
- Reunify JsxC/JsxU -> Jsx etc. https://github.com/rescript-lang/rescript-compiler/pull/6895
8484
- Remove the transformation of `foo(1,2)` into `Js.Internal.opaqueFullApply(Internal.opaque(f), 1, 2)`, and change the back-end to treat all applications as uncurried. https://github.com/rescript-lang/rescript-compiler/pull/6893
8585
- Remove `@uncurry` from ReScript sources (others, tests). https://github.com/rescript-lang/rescript-compiler/pull/6938
86+
- Remove leftover Fn_uncurry_arity and no_auto_uncurried_arg_types. https://github.com/rescript-lang/rescript-compiler/pull/6939
8687

8788
#### :nail_care: Polish
8889

jscomp/core/lam.ml

-37
Original file line numberDiff line numberDiff line change
@@ -748,19 +748,6 @@ let sequor l r = if_ l true_ r
748748
(** [l && r ] *)
749749
let sequand l r = if_ l r false_
750750

751-
(******************************************************************)
752-
(* only [handle_bs_non_obj_ffi] will be used outside *)
753-
(*
754-
[no_auto_uncurried_arg_types xs]
755-
check if the FFI have @uncurry attribute.
756-
if it does not we wrap it in a nomral way otherwise
757-
*)
758-
let rec no_auto_uncurried_arg_types (xs : External_arg_spec.params) =
759-
match xs with
760-
| [] -> true
761-
| { arg_type = Fn_uncurry_arity _ } :: _ -> false
762-
| _ :: xs -> no_auto_uncurried_arg_types xs
763-
764751
let result_wrap loc (result_type : External_ffi_types.return_wrapper) result =
765752
match result_type with
766753
| Return_replaced_with_unit -> seq result unit
@@ -771,31 +758,7 @@ let result_wrap loc (result_type : External_ffi_types.return_wrapper) result =
771758
prim ~primitive:Pundefined_to_opt ~args:[ result ] loc
772759
| Return_unset | Return_identity -> result
773760

774-
let rec transform_uncurried_arg_type loc (arg_types : External_arg_spec.params)
775-
(args : t list) =
776-
match (arg_types, args) with
777-
| { arg_type = Fn_uncurry_arity n; arg_label } :: xs, y :: ys ->
778-
let o_arg_types, o_args = transform_uncurried_arg_type loc xs ys in
779-
( { External_arg_spec.arg_type = Nothing; arg_label } :: o_arg_types,
780-
prim ~primitive:(Pjs_fn_make n) ~args:[ y ] loc :: o_args )
781-
| x :: xs, y :: ys -> (
782-
match x with
783-
| { arg_type = Arg_cst _ } ->
784-
let o_arg_types, o_args = transform_uncurried_arg_type loc xs args in
785-
(x :: o_arg_types, o_args)
786-
| _ ->
787-
let o_arg_types, o_args = transform_uncurried_arg_type loc xs ys in
788-
(x :: o_arg_types, y :: o_args))
789-
| ([], [] | _ :: _, [] | [], _ :: _) as ok -> ok
790-
791761
let handle_bs_non_obj_ffi (arg_types : External_arg_spec.params)
792762
(result_type : External_ffi_types.return_wrapper) ffi args loc prim_name ~dynamic_import =
793-
if no_auto_uncurried_arg_types arg_types then
794763
result_wrap loc result_type
795764
(prim ~primitive:(Pjs_call { prim_name; arg_types; ffi; dynamic_import }) ~args loc)
796-
else
797-
let n_arg_types, n_args = transform_uncurried_arg_type loc arg_types args in
798-
result_wrap loc result_type
799-
(prim
800-
~primitive:(Pjs_call { prim_name; arg_types = n_arg_types; ffi; dynamic_import })
801-
~args:n_args loc)

jscomp/core/lam_compile_external_call.ml

-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ let ocaml_to_js_eff ~(arg_label : External_arg_spec.label_noname)
106106
in
107107
match arg_type with
108108
| Arg_cst _ -> assert false
109-
| Fn_uncurry_arity _ -> assert false
110109
(* has to be preprocessed by {!Lam} module first *)
111110
| Extern_unit ->
112111
( (if arg_label = Arg_empty then Splice0 else Splice1 E.unit),

jscomp/frontend/ast_external_process.ml

-6
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,6 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string)
527527
[],
528528
Ast_literal.type_string ~loc () )
529529
:: result_types )
530-
| Fn_uncurry_arity _ ->
531-
Location.raise_errorf ~loc
532-
"The combination of %@obj, %@uncurry is not supported yet"
533530
| Extern_unit -> assert false
534531
| Poly_var _ ->
535532
Location.raise_errorf ~loc
@@ -596,9 +593,6 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string)
596593
| Arg_cst _ ->
597594
Location.raise_errorf ~loc
598595
"%@as is not supported with optional yet"
599-
| Fn_uncurry_arity _ ->
600-
Location.raise_errorf ~loc
601-
"The combination of %@obj, %@uncurry is not supported yet"
602596
| Extern_unit -> assert false
603597
| Poly_var _ ->
604598
Location.raise_errorf ~loc

jscomp/frontend/external_arg_spec.ml

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ type attr =
5454
(* `a does not have any value*)
5555
| Int of (string * int) list (* ([`a | `b ] [@int])*)
5656
| Arg_cst of cst
57-
| Fn_uncurry_arity of int (* annotated with [@uncurry ] or [@uncurry 2]*)
5857
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
5958
| Extern_unit
6059
| Nothing

jscomp/frontend/external_arg_spec.mli

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ type attr =
3131
| Poly_var of {descr: (string * string) list option}
3232
| Int of (string * int) list (* ([`a | `b ] [@int])*)
3333
| Arg_cst of cst
34-
| Fn_uncurry_arity of int (* annotated with [@uncurry ] or [@uncurry 2]*)
3534
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
3635
| Extern_unit
3736
| Nothing

0 commit comments

Comments
 (0)