Skip to content

Add BigInt module #5531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 98 additions & 96 deletions jscomp/main/builtin_cmi_datasets.ml

Large diffs are not rendered by default.

58 changes: 30 additions & 28 deletions jscomp/main/builtin_cmj_datasets.ml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions jscomp/others/js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,6 @@ module Vector = Js_vector

module Console = Js_console
(** Provides bindings for console *)

module BigInt = Js_bigint
(** Provide bindings for BigInt *)
3 changes: 3 additions & 0 deletions jscomp/others/js_bigint.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(** JavaScript BigInt API *)

type t
9 changes: 2 additions & 7 deletions jscomp/others/js_types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
type symbol
(** Js symbol type only available in ES6 *)

type bigint_val
(** Js bigint type only available in ES2020 *)

type obj_val
type undefined_val
(** This type has only one value `undefined` *)
Expand All @@ -48,9 +45,7 @@ type _ t =
| Function : function_val t
| Object : obj_val t
| Symbol : symbol t
| BigInt : bigint_val t


| BigInt : Js_bigint.t t

type tagged_t =
| JSFalse
Expand All @@ -62,7 +57,7 @@ type tagged_t =
| JSFunction of function_val
| JSObject of obj_val
| JSSymbol of symbol
| JSBigInt of bigint_val
| JSBigInt of Js_bigint.t

let classify (x : 'a) : tagged_t =
let ty = Js.typeof x in
Expand Down
7 changes: 2 additions & 5 deletions jscomp/others/js_types.mli
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
type symbol
(** Js symbol type (only available in ES6) *)

type bigint_val
(** Js bigint type only available in ES2020 *)

type obj_val

type undefined_val
Expand All @@ -49,7 +46,7 @@ type _ t =
| Function : function_val t
| Object : obj_val t
| Symbol : symbol t
| BigInt : bigint_val t
| BigInt : Js_bigint.t t

val test : 'a -> 'b t -> bool
(**
Expand All @@ -73,6 +70,6 @@ type tagged_t =
| JSFunction of function_val
| JSObject of obj_val
| JSSymbol of symbol
| JSBigInt of bigint_val
| JSBigInt of Js_bigint.t

val classify : 'a -> tagged_t
7 changes: 4 additions & 3 deletions jscomp/others/release.ninja
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ o others/node.cmj others/node.cmi : cc others/node.ml | $bsc others/js.cmi other
o others/js_OO.cmi others/js_OO.cmj : cc others/js_OO.ml | others/belt_internals.cmi others/js.cmi $bsc
o others/js_array.cmi others/js_array.cmj : cc others/js_array.ml | others/belt_internals.cmi others/js.cmi others/js_array2.cmj $bsc
o others/js_array2.cmi others/js_array2.cmj : cc others/js_array2.ml | others/belt_internals.cmi others/js.cmi $bsc
o others/js_bigint.cmi others/js_bigint.cmj : cc others/js_bigint.ml | others/belt_internals.cmi others/js.cmi $bsc
o others/js_cast.cmj : cc_cmi others/js_cast.ml | others/belt_internals.cmi others/js.cmi others/js_cast.cmi $bsc
o others/js_cast.cmi : cc others/js_cast.mli | others/belt_internals.cmi others/js.cmi $bsc
o others/js_console.cmi others/js_console.cmj : cc others/js_console.ml | others/belt_internals.cmi others/js.cmi $bsc
Expand Down Expand Up @@ -52,13 +53,13 @@ o others/js_string.cmi others/js_string.cmj : cc others/js_string.ml | others/be
o others/js_string2.cmi others/js_string2.cmj : cc others/js_string2.ml | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_re.cmj $bsc
o others/js_typed_array.cmi others/js_typed_array.cmj : cc others/js_typed_array.ml | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_typed_array2.cmj $bsc
o others/js_typed_array2.cmi others/js_typed_array2.cmj : cc others/js_typed_array2.ml | others/belt_internals.cmi others/js.cmi others/js.cmj $bsc
o others/js_types.cmj : cc_cmi others/js_types.ml | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_null.cmj others/js_types.cmi $bsc
o others/js_types.cmi : cc others/js_types.mli | others/belt_internals.cmi others/js.cmi $bsc
o others/js_types.cmj : cc_cmi others/js_types.ml | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_bigint.cmj others/js_null.cmj others/js_types.cmi $bsc
o others/js_types.cmi : cc others/js_types.mli | others/belt_internals.cmi others/js.cmi others/js_bigint.cmj $bsc
o others/js_undefined.cmj : cc_cmi others/js_undefined.ml | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_exn.cmj others/js_undefined.cmi $bsc
o others/js_undefined.cmi : cc others/js_undefined.mli | others/belt_internals.cmi others/js.cmi others/js.cmj $bsc
o others/js_vector.cmj : cc_cmi others/js_vector.ml | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_vector.cmi $bsc
o others/js_vector.cmi : cc others/js_vector.mli | others/belt_internals.cmi others/js.cmi $bsc
o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj
o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_bigint.cmi others/js_bigint.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj
o others/belt_Array.cmj : cc_cmi others/belt_Array.ml | others/belt.cmi others/belt_Array.cmi others/belt_internals.cmi others/js.cmi others/js.cmj others/js_math.cmj $bsc js_pkg
o others/belt_Array.cmi : cc others/belt_Array.mli | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg
o others/belt_Float.cmj : cc_cmi others/belt_Float.ml | others/belt.cmi others/belt_Float.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg
Expand Down
Loading