Skip to content

Commit ae3a728

Browse files
authored
Remove more uncurried leftovers (#6989)
1 parent 30b38a0 commit ae3a728

File tree

4 files changed

+0
-59
lines changed

4 files changed

+0
-59
lines changed

jscomp/frontend/ast_uncurry_gen.ml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -66,36 +66,3 @@ let to_method_callback loc (self : Bs_ast_mapper.mapper) label
6666
}
6767
[Typ.any ~loc ()]) );
6868
] )
69-
70-
let to_uncurry_fn (e : Parsetree.expression) (self : Bs_ast_mapper.mapper)
71-
(label : Asttypes.arg_label) pat body async : Parsetree.expression =
72-
let loc = e.pexp_loc in
73-
Bs_syntaxerr.optional_err loc label;
74-
let rec aux acc (body : Parsetree.expression) =
75-
match Ast_attributes.process_attributes_rev body.pexp_attributes with
76-
| Nothing, _ -> (
77-
match body.pexp_desc with
78-
| Pexp_fun (arg_label, _, arg, body) ->
79-
Bs_syntaxerr.optional_err loc arg_label;
80-
aux ((arg_label, self.pat self arg) :: acc) body
81-
| _ -> (self.expr self body, acc))
82-
| _, _ -> (self.expr self body, acc)
83-
in
84-
let first_arg = self.pat self pat in
85-
86-
let result, rev_extra_args = aux [(label, first_arg)] body in
87-
let result = Ast_async.add_promise_type ~async result in
88-
let body =
89-
Ext_list.fold_left rev_extra_args result (fun e (label, p) ->
90-
Ast_helper.Exp.fun_ ~loc label None p e)
91-
in
92-
let body = Ast_async.add_async_attribute ~async body in
93-
94-
let arity = List.length rev_extra_args in
95-
Bs_syntaxerr.err_large_arity loc arity;
96-
let fun_exp = Ast_uncurried.uncurried_fun ~loc ~arity body in
97-
{
98-
e with
99-
pexp_desc = fun_exp.pexp_desc;
100-
pexp_attributes = fun_exp.pexp_attributes @ e.pexp_attributes;
101-
}

jscomp/frontend/ast_uncurry_gen.mli

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,6 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25-
val to_uncurry_fn :
26-
Parsetree.expression ->
27-
Bs_ast_mapper.mapper ->
28-
Asttypes.arg_label ->
29-
Parsetree.pattern ->
30-
Parsetree.expression ->
31-
bool ->
32-
(* async *)
33-
Parsetree.expression
34-
(**
35-
[function] can only take one argument, that is the reason we did not adopt it
36-
syntax:
37-
{[ fun [@bs] pat pat1-> body ]}
38-
[to_uncurry_fn (fun pat -> (fun pat1 -> ... body))]
39-
40-
*)
41-
4225
val to_method_callback :
4326
Location.t ->
4427
Bs_ast_mapper.mapper ->

jscomp/frontend/bs_syntaxerr.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,10 @@ type error =
5151
| Misplaced_label_syntax
5252
| Optional_in_uncurried_bs_attribute
5353
| Bs_this_simple_pattern
54-
| Bs_uncurried_arity_too_large
5554

5655
let pp_error fmt err =
5756
Format.pp_print_string fmt
5857
(match err with
59-
| Bs_uncurried_arity_too_large ->
60-
"Uncurried function supports only up to arity 22"
6158
| Misplaced_label_syntax -> "Label syntax is not support in this position"
6259
(*
6360
let fn x = ((##) x ~hi) ~lo:1 ~hi:2
@@ -114,6 +111,3 @@ let optional_err loc (lbl : Asttypes.arg_label) =
114111

115112
let err_if_label loc (lbl : Asttypes.arg_label) =
116113
if lbl <> Nolabel then raise (Error (loc, Misplaced_label_syntax))
117-
118-
let err_large_arity loc arity =
119-
if arity > 22 then raise (Error (loc, Bs_uncurried_arity_too_large))

jscomp/frontend/bs_syntaxerr.mli

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,9 @@ type error =
5151
| Misplaced_label_syntax
5252
| Optional_in_uncurried_bs_attribute
5353
| Bs_this_simple_pattern
54-
| Bs_uncurried_arity_too_large
5554

5655
val err : Location.t -> error -> 'a
5756

5857
val optional_err : Location.t -> Asttypes.arg_label -> unit
5958

6059
val err_if_label : Location.t -> Asttypes.arg_label -> unit
61-
62-
val err_large_arity : Location.t -> int -> unit

0 commit comments

Comments
 (0)