Skip to content
Merged
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
2 changes: 1 addition & 1 deletion jscomp/bin/all_ounit_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7500,7 +7500,7 @@ let reserved_words =
"Buffer"; (* Node *)
"Map"; (* es6*)
"Set";

"Promise";
"Infinity";
"isFinite";

Expand Down
2 changes: 1 addition & 1 deletion jscomp/ext/ext_ident.ml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ let reserved_words =
"Buffer"; (* Node *)
"Map"; (* es6*)
"Set";

"Promise";
"Infinity";
"isFinite";

Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ belt_SortArrayString.ml : sort.cppo.ml
cppo -D TYPE_STRING $^ >$@
belt_SortArrayInt.mli : sort.cppo.mli
cppo -D TYPE_INT $^ > $@
belt_gSortArrayString.mli : sort.cppo.mli
belt_SortArrayString.mli : sort.cppo.mli
cppo -D TYPE_STRING $^ > $@
endif

Expand Down
8 changes: 4 additions & 4 deletions jscomp/others/belt_MapString.ml
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ let rec removeMany0 t xs i len =
| Some t -> removeMany0 t xs (i + 1) len
else
N.return t

let findFirstByU = N.findFirstByU
let findFirstBy = N.findFirstBy


let removeMany t keys =
let len = A.length keys in
match N.toOpt t with
| None -> N.empty
| Some t -> removeMany0 t keys 0 len

let findFirstByU = N.findFirstByU
let findFirstBy = N.findFirstBy

let mergeMany h arr =
let len = A.length arr in
let v = ref h in
Expand Down
8 changes: 7 additions & 1 deletion jscomp/others/belt_MapString.mli
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ val eq: 'v t -> 'v t -> ('v -> 'v -> bool) -> bool
val findFirstByU : 'v t -> (key -> 'v -> bool [@bs]) -> (key * 'v) option
val findFirstBy : 'v t -> (key -> 'v -> bool) -> (key * 'v) option
(** [findFirstBy m p] uses funcion [f] to find the first key value pair
to match predicate [p]. *)
to match predicate [p].

@example {[
let s0 = fromArray ~id:(module IntCmp) [|4,"4";1,"1";2,"2,"3""|];;
findFirstBy s0 (fun k v -> k = 4 ) = option (4, "4");;
]}
*)

val forEachU: 'v t -> (key -> 'v -> unit [@bs]) -> unit
val forEach: 'v t -> (key -> 'v -> unit) -> unit
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/belt_SortArrayInt.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 2 "sort.cppo.ml"
type element = int

# 9
# 9 "sort.cppo.ml"
module A = Belt_Array

let rec sortedLengthAuxMore (xs : element array) prec acc len =
Expand Down
4 changes: 2 additions & 2 deletions jscomp/others/belt_SortArrayString.mli
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
applies here, except the comparator is fixed and inlined
*)

# 34
# 34 "sort.cppo.mli"
type element = string

# 39
# 39 "sort.cppo.mli"
val strictlySortedLength: element array -> int
(**
The same as {!Belt_SortArray.strictlySortedLength } except the comparator is fixed
Expand Down
3 changes: 3 additions & 0 deletions jscomp/others/map.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ let removeMany t keys =
| None -> N.empty
| Some t -> removeMany0 t keys 0 len

let findFirstByU = N.findFirstByU
let findFirstBy = N.findFirstBy

let mergeMany h arr =
let len = A.length arr in
let v = ref h in
Expand Down
11 changes: 11 additions & 0 deletions jscomp/others/map.cppo.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ val eq: 'v t -> 'v t -> ('v -> 'v -> bool) -> bool
equal, that is, contain equal keys and associate them with
equal data. *)

val findFirstByU : 'v t -> (key -> 'v -> bool [@bs]) -> (key * 'v) option
val findFirstBy : 'v t -> (key -> 'v -> bool) -> (key * 'v) option
(** [findFirstBy m p] uses funcion [f] to find the first key value pair
to match predicate [p].

@example {[
let s0 = fromArray ~id:(module IntCmp) [|4,"4";1,"1";2,"2,"3""|];;
findFirstBy s0 (fun k v -> k = 4 ) = option (4, "4");;
]}
*)

val forEachU: 'v t -> (key -> 'v -> unit [@bs]) -> unit
val forEach: 'v t -> (key -> 'v -> unit) -> unit
(** [forEach m f] applies [f] to all bindings in map [m].
Expand Down
14 changes: 6 additions & 8 deletions jscomp/test/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ int_hashtbl_test.cmj : mt.cmj
int_map.cmj :
int_overflow_test.cmj : mt.cmj ../runtime/js.cmj
int_switch_test.cmj : mt.cmj
int_swtich_test.cmj :
io_test.cmj : ../runtime/js.cmj
js_array_test.cmj : mt.cmj ../runtime/js.cmj
js_bool_test.cmj : mt.cmj
Expand Down Expand Up @@ -367,7 +366,6 @@ js_typed_array_test.cmj : mt.cmj ../others/js_typed_array.cmj \
js_undefined_test.cmj : mt.cmj ../others/js_undefined.cmj ../runtime/js.cmj
js_val.cmj :
jsoo_400_test.cmj : mt.cmj
jsoo_485.cmj :
jsoo_485_test.cmj :
key_word_property.cmj :
key_word_property2.cmj : export_keyword.cmj
Expand Down Expand Up @@ -423,12 +421,12 @@ obj_literal_ppx_test.cmj : ../runtime/js.cmj
obj_magic_test.cmj : mt.cmj
obj_test.cmj : mt.cmj
obj_type_test.cmj : ../runtime/js.cmj
ocaml_parsetree_main.cmj : mt.cmj
ocaml_parsetree_main_bspack.cmj : mt.cmj
ocaml_parsetree_test.cmj : ../others/node.cmj ../runtime/js.cmj \
ocaml_parsetree_test.cmi
ocaml_proto_test.cmj : mt.cmj ocaml_proto_test.cmi
ocaml_re_test.cmj : mt.cmj
ocaml_typed_tree_main.cmj : mt.cmj
ocaml_typed_tree_main_bspack.cmj : mt.cmj
ocaml_typedtree_test.cmj : ../others/node.cmj ../runtime/js.cmj \
ocaml_typedtree_test.cmi
of_string_test.cmj : mt.cmj
Expand All @@ -438,7 +436,7 @@ option_repr_test.cmj : mt.cmj ../runtime/js.cmj ../others/belt.cmj
optional_ffi_test.cmj : mt.cmj
optional_regression_test.cmj : mt.cmj ../runtime/js.cmj
parser_api.cmj :
parser_api_main.cmj :
parser_api_main_bspack.cmj :
parser_api_test.cmj : parser_api.cmj mt.cmj
pipe_send_readline.cmj : ../runtime/js.cmj
pipe_syntax.cmj :
Expand Down Expand Up @@ -487,9 +485,8 @@ sexpm_test.cmj : sexpm.cmj mt.cmj ../runtime/js.cmj
shift_test.cmj :
side_effect.cmj : ../runtime/js.cmj
side_effect_free.cmj :
simple_derive_test.cmj : ../runtime/js.cmj ../others/belt.cmj \
simple_derive_test.cmi
simple_derive_use.cmj : simple_derive_test.cmj simple_derive_use.cmi
simple_derive_test.cmj : simple_derive_test.cmi
simple_derive_use.cmj : simple_derive_use.cmi
simple_lexer_test.cmj : mt.cmj
simplify_lambda_632o.cmj :
single_module_alias.cmj :
Expand Down Expand Up @@ -583,6 +580,7 @@ test_pervasive.cmj :
test_pervasives2.cmj :
test_pervasives3.cmj :
test_primitive.cmj :
test_promise_bind.cmj : promise.cmj
test_ramification.cmj :
test_react.cmj : ../runtime/js.cmj
test_react_case.cmj :
Expand Down
1 change: 1 addition & 0 deletions jscomp/test/build.ninja
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ build test_pervasive.cmi test_pervasive.cmj : cc test_pervasive.ml
build test_pervasives2.cmi test_pervasives2.cmj : cc test_pervasives2.ml
build test_pervasives3.cmi test_pervasives3.cmj : cc test_pervasives3.ml
build test_primitive.cmi test_primitive.cmj : cc test_primitive.ml
build test_promise_bind.cmi test_promise_bind.cmj : cc test_promise_bind.ml | promise.cmj
build test_ramification.cmi test_ramification.cmj : cc test_ramification.ml
build test_react.cmi test_react.cmj : cc test_react.ml
build test_react_case.cmi test_react_case.cmj : cc test_react_case.ml
Expand Down
8 changes: 8 additions & 0 deletions jscomp/test/test_promise_bind.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

var $$Promise = require("./promise.js");

var v = $$Promise.f;

exports.v = v;
/* Promise Not a pure module */
3 changes: 3 additions & 0 deletions jscomp/test/test_promise_bind.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


let v = Promise.f
4 changes: 2 additions & 2 deletions lib/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var $$String = 0;

var Re = 0;

var Promise = 0;
var $$Promise = 0;

var $$Date = 0;

Expand Down Expand Up @@ -63,7 +63,7 @@ exports.Exn = Exn;
exports.$$Array = $$Array;
exports.$$String = $$String;
exports.Re = Re;
exports.Promise = Promise;
exports.$$Promise = $$Promise;
exports.$$Date = $$Date;
exports.Dict = Dict;
exports.Global = Global;
Expand Down
2 changes: 1 addition & 1 deletion lib/whole_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61050,7 +61050,7 @@ let reserved_words =
"Buffer"; (* Node *)
"Map"; (* es6*)
"Set";

"Promise";
"Infinity";
"isFinite";

Expand Down