Skip to content

Commit bf01fd1

Browse files
committed
Move arity 0 onto new representation.
1 parent 5aa8ef1 commit bf01fd1

File tree

7 files changed

+713
-725
lines changed

7 files changed

+713
-725
lines changed

jscomp/frontend/ast_typ_uncurry.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,5 @@ let to_uncurry_type loc (mapper : Bs_ast_mapper.mapper)
6161
let fn_type = Typ.arrow ~loc label first_arg typ in
6262
let arity = Ast_core_type.get_uncurry_arity fn_type in
6363
match arity with
64-
| Some 0 -> Ast_uncurried.uncurriedType ~loc ~arity:0 typ
6564
| Some arity -> Ast_uncurried.uncurriedType ~loc ~arity fn_type
6665
| None -> assert false

jscomp/ml/ast_uncurried.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(* Untyped AST *)
22

3-
let new_representation arity = arity = 5
3+
let new_representation arity = arity = 0 || arity = 5
44

55
let arityType ~loc arity =
66
Ast_helper.Typ.variant ~loc

jscomp/others/js.ml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,13 @@
7474
type 'a t = < .. > as 'a
7575
(** JS object type *)
7676

77-
type ('fn, 'arity) uncurried = Uncurried of 'fn [@unboxed]
78-
7977
(**/**)
8078

8179
(* internal types for FFI, these types are not used by normal users
8280
Absent cmi file when looking up module alias.
8381
*)
8482

8583
module Fn = struct
86-
type 'a arity0 = { i0 : unit -> 'a [@internal] }
8784
type 'a arity1 = { i1 : 'a [@internal] }
8885
type 'a arity2 = { i2 : 'a [@internal] }
8986
type 'a arity3 = { i3 : 'a [@internal] }
@@ -113,12 +110,10 @@ end
113110
module MapperRt = Js_mapperRt
114111

115112
module Internal = struct
116-
open Fn
117-
118113
external opaqueFullApply : 'a -> 'a = "%uncurried_apply"
119114

120115
(* Use opaque instead of [._n] to prevent some optimizations happening *)
121-
external run : 'a arity0 -> 'a = "#run"
116+
external run : (unit -> 'a [@bs]) -> 'a = "#run"
122117
external opaque : 'a -> 'a = "%opaque"
123118
end
124119

jscomp/runtime/js.ml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,10 @@
4646
type 'a t = < .. > as 'a
4747
(**/**)
4848

49-
type ('fn, 'arity) uncurried = Uncurried of 'fn [@unboxed]
50-
5149
(* internal types for FFI, these types are not used by normal users
5250
Absent cmi file when looking up module alias.
5351
*)
5452
module Fn = struct
55-
type 'a arity0 = {
56-
i0 : unit -> 'a [@internal]
57-
}
5853
type 'a arity1 = {
5954
i1 : 'a [@internal]
6055
}
@@ -126,11 +121,10 @@ end
126121
(**/**)
127122
module MapperRt = Js_mapperRt
128123
module Internal = struct
129-
open Fn
130124
external opaqueFullApply : 'a -> 'a = "%uncurried_apply"
131125

132126
(* Use opaque instead of [._n] to prevent some optimizations happening *)
133-
external run : 'a arity0 -> 'a = "#run"
127+
external run : (unit -> 'a [@bs]) -> 'a = "#run"
134128
external opaque : 'a -> 'a = "%opaque"
135129

136130
end

0 commit comments

Comments
 (0)