Skip to content

Commit 33ce3d9

Browse files
committed
reduce changed surfaces
1 parent 91d29cc commit 33ce3d9

19 files changed

+55
-495
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
1313
# 11.1.0-rc.5 (Unreleased)
1414

15-
#### :rocket: New Feature
15+
#### :nail_care: Polish
1616

17-
- Add bindings to `ArrayBuffer`, `SharedArrayBuffer` and `Atomics`. https://github.com/rescript-lang/rescript-compiler/pull/6683
17+
- Add `ArrayBuffer.t` and `SharedArrayBuffer.t` to be base types of the Core bindings. https://github.com/rescript-lang/rescript-compiler/pull/6683
1818

1919
# 11.1.0-rc.4
2020

jscomp/others/js.ml

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
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-
[@@@bs.config { flags = [| "-unboxed-types"; "-w"; "-49" |] }]
25+
[@@@bs.config {flags = [|"-unboxed-types"; "-w"; "-49"|]}]
2626
(* DESIGN:
2727
- It does not have any code, all its code will be inlined so that
2828
there will never be
@@ -82,29 +82,23 @@ module Internal = struct
8282
external opaqueFullApply : 'a -> 'a = "%uncurried_apply"
8383

8484
(* Use opaque instead of [._n] to prevent some optimizations happening *)
85-
external run : (unit -> 'a [@bs]) -> 'a = "#run"
85+
external run : ((unit -> 'a)[@bs]) -> 'a = "#run"
8686
external opaque : 'a -> 'a = "%opaque"
8787
end
8888

8989
(**/**)
9090

91-
type +'a null =
92-
| Value of 'a
93-
| Null [@as null]
94-
[@@unboxed]
9591
(**
9692
Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t.
9793
*)
94+
type +'a null = Value of 'a | Null [@as null] [@@unboxed]
9895

9996
type +'a undefined
10097
(**
10198
A value of this type can be either undefined or 'a. This type is equivalent to Js.Undefined.t.
10299
*)
103100

104-
type +'a nullable =
105-
| Value of 'a
106-
| Null [@as null]
107-
| Undefined [@as undefined]
101+
type +'a nullable = Value of 'a | Null [@as null] | Undefined [@as undefined]
108102
[@@unboxed]
109103

110104
(**
@@ -144,17 +138,17 @@ external typeof : 'a -> string = "#typeof"
144138
*)
145139

146140
external log : 'a -> unit = "log"
147-
[@@val] [@@scope "console"]
141+
[@@val] [@@scope "console"]
148142
(** Equivalent to console.log any value. *)
149143

150144
external log2 : 'a -> 'b -> unit = "log" [@@bs.val] [@@bs.scope "console"]
151145
external log3 : 'a -> 'b -> 'c -> unit = "log" [@@bs.val] [@@bs.scope "console"]
152146

153147
external log4 : 'a -> 'b -> 'c -> 'd -> unit = "log"
154-
[@@bs.val] [@@bs.scope "console"]
148+
[@@bs.val] [@@bs.scope "console"]
155149

156150
external logMany : 'a array -> unit = "log"
157-
[@@bs.val] [@@bs.scope "console"] [@@bs.splice]
151+
[@@bs.val] [@@bs.scope "console"] [@@bs.splice]
158152
(** A convenience function to console.log more than 4 arguments *)
159153

160154
external eqNull : 'a -> 'a null -> bool = "%bs_equal_null"
@@ -199,8 +193,9 @@ module Undefined = Js_undefined
199193
module Nullable = Js_null_undefined
200194
(** Provide utilities for `Js.null_undefined` *)
201195

202-
module Null_undefined = Js_null_undefined
203-
[@deprecated "Please use `Js.Nullable`"]
196+
module Null_undefined =
197+
Js_null_undefined
198+
[@deprecated "Please use `Js.Nullable`"]
204199

205200
module Exn = Js_exn
206201
(** Provide utilities for dealing with Js exceptions *)
@@ -244,21 +239,12 @@ module Math = Js_math
244239
module Obj = Js_obj
245240
(** Provide utilities for `Js.t` *)
246241

247-
module ArrayBuffer = Js_array_buffer
248-
(** Provide utilities for `ArrayBuffer` object *)
249-
250-
module SharedArrayBuffer = Js_shared_array_buffer
251-
(** Provide utilities for `SharedArrayBuffer` object *)
252-
253242
module Typed_array = Js_typed_array
254243
(** Provide bindings for JS typed array *)
255244

256245
module TypedArray2 = Js_typed_array2
257246
(** Provide bindings for JS typed array *)
258247

259-
module Atomics = Js_atomics
260-
(** Provide bindings for JS `Atomics` utilities *)
261-
262248
module Types = Js_types
263249
(** Provide utilities for manipulating JS types *)
264250

jscomp/others/js_array_buffer.res

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,6 @@
1-
@@uncurried
2-
3-
/***
4-
The underlying buffer that the typed arrays provide views of
5-
6-
**see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)
7-
*/
81
type t = {
92
byteLength: int,
103
maxByteLength: int,
114
detached: bool,
125
resizable: bool,
136
}
14-
15-
type makeOptions = {
16-
maxByteLength?: int
17-
}
18-
19-
@new /** takes length. initializes elements to 0 */
20-
external make: (int, makeOptions) => t = "ArrayBuffer"
21-
let make = (length, ~maxByteLength=?) => make(length, { maxByteLength: ?maxByteLength })
22-
23-
/* ArrayBuffer.isView: seems pointless with a type system */
24-
25-
@get external byteLength: t => int = "byteLength"
26-
@get external maxByteLength: t => int = "maxByteLength"
27-
@get external detached: t => bool = "detached"
28-
@get external resizable: t => bool = "resizable"
29-
30-
@send external slice: (t, ~start: int, ~end_: int) => t = "slice"
31-
@send external sliceFrom: (t, int) => t = "slice"
32-
33-
@send external transfer: (t, ~newByteLength: int=?) => t = "transfer"
34-
@send external transferToFixedLength: (t, ~newByteLength: int=?) => t = "transferToFixedLength"

jscomp/others/js_atomics.res

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
1-
@@uncurried
2-
3-
/***
4-
The underlying buffer that the typed arrays provide views of
5-
6-
**see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer)
7-
*/
81
type t = {
92
byteLength: int,
103
maxByteLength: int,
114
growable: bool,
125
}
13-
14-
type makeOptions = {
15-
maxByteLength?: int
16-
}
17-
18-
@new /** takes length. initializes elements to 0 */
19-
external make: (int, makeOptions) => t = "SharedArrayBuffer"
20-
let make = (length, ~maxByteLength=?) => make(length, { maxByteLength: ?maxByteLength })
21-
22-
/* ArrayBuffer.isView: seems pointless with a type system */
23-
24-
@get external byteLength: t => int = "byteLength"
25-
@get external maxByteLength: t => int = "maxByteLength"
26-
@get external growable: t => bool = "growable"
27-
28-
@send external slice: (t, ~start: int, ~end_: int) => t = "slice"
29-
@send external sliceFrom: (t, int) => t = "slice"

0 commit comments

Comments
 (0)