Skip to content

Commit 602ed5d

Browse files
authored
Merge pull request rescript-lang#2703 from BuckleScript/gpr_2698
fix rescript-lang#2698
2 parents 8924fdc + 2086826 commit 602ed5d

24 files changed

+342
-338
lines changed

jscomp/core/js_exp_make.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ let not_implemented ?comment (s : string) : t =
13191319
runtime_call
13201320
Js_runtime_modules.missing_polyfill
13211321
"not_implemented"
1322-
[str (s ^ " not implemented by bucklescript yet\n")]
1322+
[str s]
13231323

13241324

13251325

jscomp/runtime/.depend

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ caml_oo.cmj : bs_obj.cmj caml_oo.cmi
2727
curry.cmj : caml_array.cmj
2828
caml_oo_curry.cmj : curry.cmj caml_oo.cmj
2929
caml_module.cmj :
30-
caml_missing_polyfill.cmj : caml_missing_polyfill.cmi
30+
caml_missing_polyfill.cmj : js_exn.cmj caml_missing_polyfill.cmi
3131
bs_string.cmj :
3232
js_float.cmj :
3333
js_exn.cmj : caml_exceptions.cmj js_exn.cmi

jscomp/runtime/caml_missing_polyfill.ml

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,5 +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-
let not_implemented : string -> 'a [@bs] =
26-
[%raw{|function (s){ throw new Error(s)}|}]
25+
let not_implemented s =
26+
Js_exn.raiseError (s ^ " not implemented by BuckleScript yet\n")
27+

jscomp/runtime/caml_missing_polyfill.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

2525

26-
val not_implemented : string -> 'a [@bs]
26+
val not_implemented : string -> 'a

jscomp/test/bigarray_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ var Caml_missing_polyfill = require("../../lib/js/caml_missing_polyfill.js");
66

77
function sum() {
88
var result = 0;
9-
for(var i = 0 ,i_finish = Caml_missing_polyfill.not_implemented("caml_ba_dim_1 not implemented by bucklescript yet\n") - 1 | 0; i <= i_finish; ++i){
10-
result = result + Caml_missing_polyfill.not_implemented("caml_ba_get_1 not implemented by bucklescript yet\n") | 0;
9+
for(var i = 0 ,i_finish = Caml_missing_polyfill.not_implemented("caml_ba_dim_1") - 1 | 0; i <= i_finish; ++i){
10+
result = result + Caml_missing_polyfill.not_implemented("caml_ba_get_1") | 0;
1111
}
1212
return /* () */0;
1313
}
1414

1515
function init(v) {
16-
for(var i = 0 ,i_finish = Caml_missing_polyfill.not_implemented("caml_ba_dim_1 not implemented by bucklescript yet\n") - 1 | 0; i <= i_finish; ++i){
16+
for(var i = 0 ,i_finish = Caml_missing_polyfill.not_implemented("caml_ba_dim_1") - 1 | 0; i <= i_finish; ++i){
1717
v[i] = /* array */[
1818
Caml_int32.imul(i, i),
1919
Caml_int32.imul(Caml_int32.imul(i, i), i)
@@ -23,15 +23,15 @@ function init(v) {
2323
}
2424

2525
function init2(v) {
26-
for(var i = 0 ,i_finish = Caml_missing_polyfill.not_implemented("caml_ba_dim_1 not implemented by bucklescript yet\n") - 1 | 0; i <= i_finish; ++i){
26+
for(var i = 0 ,i_finish = Caml_missing_polyfill.not_implemented("caml_ba_dim_1") - 1 | 0; i <= i_finish; ++i){
2727
v[i] = i;
2828
}
2929
return /* () */0;
3030
}
3131

3232
function init3() {
33-
for(var i = 0 ,i_finish = Caml_missing_polyfill.not_implemented("caml_ba_dim_1 not implemented by bucklescript yet\n") - 1 | 0; i <= i_finish; ++i){
34-
Caml_missing_polyfill.not_implemented("caml_ba_set_1 not implemented by bucklescript yet\n");
33+
for(var i = 0 ,i_finish = Caml_missing_polyfill.not_implemented("caml_ba_dim_1") - 1 | 0; i <= i_finish; ++i){
34+
Caml_missing_polyfill.not_implemented("caml_ba_set_1");
3535
}
3636
return /* () */0;
3737
}

jscomp/test/ext_filename_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function node_relative_path(node_modules_shorten, file1, dep_file) {
211211
function find_root_filename(_cwd, filename) {
212212
while(true) {
213213
var cwd = _cwd;
214-
if (Caml_missing_polyfill.not_implemented("caml_sys_file_exists not implemented by bucklescript yet\n")) {
214+
if (Caml_missing_polyfill.not_implemented("caml_sys_file_exists")) {
215215
return cwd;
216216
} else {
217217
var cwd$prime = Curry._1(Filename.dirname, cwd);

jscomp/test/ocaml_parsetree_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ function highlight_terminfo(ppf, num_lines, lb, locs) {
12161216
throw Pervasives.Exit;
12171217
}
12181218
Caml_io.caml_ml_flush(Pervasives.stdout);
1219-
Caml_missing_polyfill.not_implemented("caml_terminfo_backup not implemented by bucklescript yet\n");
1219+
Caml_missing_polyfill.not_implemented("caml_terminfo_backup");
12201220
var bol = false;
12211221
Pervasives.print_string("# ");
12221222
for(var pos = 0 ,pos_finish = (lb[/* lex_buffer_len */2] - pos0 | 0) - 1 | 0; pos <= pos_finish; ++pos){
@@ -1229,21 +1229,21 @@ function highlight_terminfo(ppf, num_lines, lb, locs) {
12291229
return pos === loc[/* loc_start */0][/* pos_cnum */3];
12301230
}
12311231
}(pos)), locs)) {
1232-
Caml_missing_polyfill.not_implemented("caml_terminfo_standout not implemented by bucklescript yet\n");
1232+
Caml_missing_polyfill.not_implemented("caml_terminfo_standout");
12331233
}
12341234
if (List.exists((function(pos){
12351235
return function (loc) {
12361236
return pos === loc[/* loc_end */1][/* pos_cnum */3];
12371237
}
12381238
}(pos)), locs)) {
1239-
Caml_missing_polyfill.not_implemented("caml_terminfo_standout not implemented by bucklescript yet\n");
1239+
Caml_missing_polyfill.not_implemented("caml_terminfo_standout");
12401240
}
12411241
var c = Caml_bytes.get(lb[/* lex_buffer */1], pos + pos0 | 0);
12421242
Pervasives.print_char(c);
12431243
bol = c === /* "\n" */10;
12441244
}
1245-
Caml_missing_polyfill.not_implemented("caml_terminfo_standout not implemented by bucklescript yet\n");
1246-
Caml_missing_polyfill.not_implemented("caml_terminfo_resume not implemented by bucklescript yet\n");
1245+
Caml_missing_polyfill.not_implemented("caml_terminfo_standout");
1246+
Caml_missing_polyfill.not_implemented("caml_terminfo_resume");
12471247
return Caml_io.caml_ml_flush(Pervasives.stdout);
12481248
}
12491249

@@ -1397,7 +1397,7 @@ function highlight_locations(ppf, locs) {
13971397
return false;
13981398
}
13991399
} else {
1400-
status[0] = Caml_missing_polyfill.not_implemented("caml_terminfo_setup not implemented by bucklescript yet\n");
1400+
status[0] = Caml_missing_polyfill.not_implemented("caml_terminfo_setup");
14011401
continue ;
14021402
}
14031403
} else {

jscomp/test/ocaml_typedtree_test.js

+25-25
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ function find_in_path_uncap(path, name) {
224224
var dir = param[0];
225225
var fullname = Filename.concat(dir, name);
226226
var ufullname = Filename.concat(dir, uname);
227-
if (Caml_missing_polyfill.not_implemented("caml_sys_file_exists not implemented by bucklescript yet\n")) {
227+
if (Caml_missing_polyfill.not_implemented("caml_sys_file_exists")) {
228228
return ufullname;
229-
} else if (Caml_missing_polyfill.not_implemented("caml_sys_file_exists not implemented by bucklescript yet\n")) {
229+
} else if (Caml_missing_polyfill.not_implemented("caml_sys_file_exists")) {
230230
return fullname;
231231
} else {
232232
_param = param[1];
@@ -240,7 +240,7 @@ function find_in_path_uncap(path, name) {
240240

241241
function remove_file() {
242242
try {
243-
return Caml_missing_polyfill.not_implemented("caml_sys_remove not implemented by bucklescript yet\n");
243+
return Caml_missing_polyfill.not_implemented("caml_sys_remove");
244244
}
245245
catch (raw_exn){
246246
var exn = Js_exn.internalToOCamlException(raw_exn);
@@ -1460,7 +1460,7 @@ function highlight_terminfo(ppf, num_lines, lb, locs) {
14601460
throw Pervasives.Exit;
14611461
}
14621462
Caml_io.caml_ml_flush(Pervasives.stdout);
1463-
Caml_missing_polyfill.not_implemented("caml_terminfo_backup not implemented by bucklescript yet\n");
1463+
Caml_missing_polyfill.not_implemented("caml_terminfo_backup");
14641464
var bol = false;
14651465
Pervasives.print_string("# ");
14661466
for(var pos = 0 ,pos_finish = (lb[/* lex_buffer_len */2] - pos0 | 0) - 1 | 0; pos <= pos_finish; ++pos){
@@ -1473,21 +1473,21 @@ function highlight_terminfo(ppf, num_lines, lb, locs) {
14731473
return pos === loc[/* loc_start */0][/* pos_cnum */3];
14741474
}
14751475
}(pos)), locs)) {
1476-
Caml_missing_polyfill.not_implemented("caml_terminfo_standout not implemented by bucklescript yet\n");
1476+
Caml_missing_polyfill.not_implemented("caml_terminfo_standout");
14771477
}
14781478
if (List.exists((function(pos){
14791479
return function (loc) {
14801480
return pos === loc[/* loc_end */1][/* pos_cnum */3];
14811481
}
14821482
}(pos)), locs)) {
1483-
Caml_missing_polyfill.not_implemented("caml_terminfo_standout not implemented by bucklescript yet\n");
1483+
Caml_missing_polyfill.not_implemented("caml_terminfo_standout");
14841484
}
14851485
var c = Caml_bytes.get(lb[/* lex_buffer */1], pos + pos0 | 0);
14861486
Pervasives.print_char(c);
14871487
bol = c === /* "\n" */10;
14881488
}
1489-
Caml_missing_polyfill.not_implemented("caml_terminfo_standout not implemented by bucklescript yet\n");
1490-
Caml_missing_polyfill.not_implemented("caml_terminfo_resume not implemented by bucklescript yet\n");
1489+
Caml_missing_polyfill.not_implemented("caml_terminfo_standout");
1490+
Caml_missing_polyfill.not_implemented("caml_terminfo_resume");
14911491
return Caml_io.caml_ml_flush(Pervasives.stdout);
14921492
}
14931493

@@ -1641,7 +1641,7 @@ function highlight_locations(ppf, locs) {
16411641
return false;
16421642
}
16431643
} else {
1644-
status[0] = Caml_missing_polyfill.not_implemented("caml_terminfo_setup not implemented by bucklescript yet\n");
1644+
status[0] = Caml_missing_polyfill.not_implemented("caml_terminfo_setup");
16451645
continue ;
16461646
}
16471647
} else {
@@ -5343,9 +5343,9 @@ function backtrack(param) {
53435343
var $$Error$1 = Caml_exceptions.create("Ocaml_typedtree_test.Cmi_format.Error");
53445344

53455345
function input_cmi() {
5346-
var match = Caml_missing_polyfill.not_implemented("caml_input_value not implemented by bucklescript yet\n");
5347-
var crcs = Caml_missing_polyfill.not_implemented("caml_input_value not implemented by bucklescript yet\n");
5348-
var flags = Caml_missing_polyfill.not_implemented("caml_input_value not implemented by bucklescript yet\n");
5346+
var match = Caml_missing_polyfill.not_implemented("caml_input_value");
5347+
var crcs = Caml_missing_polyfill.not_implemented("caml_input_value");
5348+
var flags = Caml_missing_polyfill.not_implemented("caml_input_value");
53495349
return /* record */[
53505350
/* cmi_name */match[0],
53515351
/* cmi_sign */match[1],
@@ -5359,7 +5359,7 @@ function read_cmi(filename) {
53595359
try {
53605360
var buffer = Pervasives.really_input_string(ic, cmi_magic_number.length);
53615361
if (buffer !== cmi_magic_number) {
5362-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
5362+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
53635363
var pre_len = cmi_magic_number.length - 3 | 0;
53645364
if ($$String.sub(buffer, 0, pre_len) === $$String.sub(cmi_magic_number, 0, pre_len)) {
53655365
var msg = buffer < cmi_magic_number ? "an older" : "a newer";
@@ -5378,25 +5378,25 @@ function read_cmi(filename) {
53785378
}
53795379
}
53805380
var cmi = input_cmi(ic);
5381-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
5381+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
53825382
return cmi;
53835383
}
53845384
catch (raw_exn){
53855385
var exn = Js_exn.internalToOCamlException(raw_exn);
53865386
if (exn === Caml_builtin_exceptions.end_of_file) {
5387-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
5387+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
53885388
throw [
53895389
$$Error$1,
53905390
/* Corrupted_interface */Block.__(2, [filename])
53915391
];
53925392
} else if (exn[0] === Caml_builtin_exceptions.failure) {
5393-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
5393+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
53945394
throw [
53955395
$$Error$1,
53965396
/* Corrupted_interface */Block.__(2, [filename])
53975397
];
53985398
} else if (exn[0] === $$Error$1) {
5399-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
5399+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
54005400
throw [
54015401
$$Error$1,
54025402
exn[1]
@@ -5409,11 +5409,11 @@ function read_cmi(filename) {
54095409

54105410
function output_cmi(filename, oc, _) {
54115411
Pervasives.output_string(oc, cmi_magic_number);
5412-
Caml_missing_polyfill.not_implemented("caml_output_value not implemented by bucklescript yet\n");
5412+
Caml_missing_polyfill.not_implemented("caml_output_value");
54135413
Caml_io.caml_ml_flush(oc);
54145414
var crc = Digest.file(filename);
5415-
Caml_missing_polyfill.not_implemented("caml_output_value not implemented by bucklescript yet\n");
5416-
Caml_missing_polyfill.not_implemented("caml_output_value not implemented by bucklescript yet\n");
5415+
Caml_missing_polyfill.not_implemented("caml_output_value");
5416+
Caml_missing_polyfill.not_implemented("caml_output_value");
54175417
return crc;
54185418
}
54195419

@@ -12446,7 +12446,7 @@ function save_signature(sg, modname, filename) {
1244612446
];
1244712447
var crc = output_cmi(filename$1, oc, cmi);
1244812448
Caml_io.caml_ml_flush(oc);
12449-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
12449+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
1245012450
var comps = components_of_module(empty, identity, /* Pident */Block.__(0, [/* record */[
1245112451
/* stamp */0,
1245212452
/* name */modname$1,
@@ -12472,7 +12472,7 @@ function save_signature(sg, modname, filename) {
1247212472
}
1247312473
catch (exn){
1247412474
Caml_io.caml_ml_flush(oc);
12475-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
12475+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
1247612476
remove_file(filename$1);
1247712477
throw exn;
1247812478
}
@@ -23564,7 +23564,7 @@ function clear_env(binary_annots) {
2356423564

2356523565
function output_cmt(oc, _) {
2356623566
Pervasives.output_string(oc, "Caml2012T004");
23567-
return Caml_missing_polyfill.not_implemented("caml_output_value not implemented by bucklescript yet\n");
23567+
return Caml_missing_polyfill.not_implemented("caml_output_value");
2356823568
}
2356923569

2357023570
var saved_types = [/* [] */0];
@@ -23646,7 +23646,7 @@ function save_cmt(filename, modname, binary_annots, sourcefile, initial_env, sg)
2364623646
];
2364723647
output_cmt(oc, cmt);
2364823648
Caml_io.caml_ml_flush(oc);
23649-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
23649+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
2365023650
}
2365123651
return clear(/* () */0);
2365223652
}
@@ -75808,7 +75808,7 @@ function type_implementation_more(sourcefile, outputprefix, modulename, initial_
7580875808
} else {
7580975809
var sourceintf = chop_extension_if_any(sourcefile) + interface_suffix[0];
7581075810
var mli_status = assume_no_mli[0];
75811-
if (mli_status === /* Mli_na */0 && Caml_missing_polyfill.not_implemented("caml_sys_file_exists not implemented by bucklescript yet\n") || mli_status === /* Mli_exists */1) {
75811+
if (mli_status === /* Mli_na */0 && Caml_missing_polyfill.not_implemented("caml_sys_file_exists") || mli_status === /* Mli_exists */1) {
7581275812
var intf_file;
7581375813
try {
7581475814
intf_file = find_in_path_uncap(load_path[0], modulename + ".cmi");

jscomp/test/qcc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,7 @@ function main() {
18581858
top(/* () */0);
18591859
elfgen(oc);
18601860
Caml_io.caml_ml_flush(oc);
1861-
return Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
1861+
return Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
18621862
}
18631863
}
18641864

jscomp/test/scanf_io.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function write_tscanf_data_file(fname, lines) {
5454
create_tscanf_data(ob, lines);
5555
$$Buffer.output_buffer(oc, ob);
5656
Caml_io.caml_ml_flush(oc);
57-
return Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
57+
return Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
5858
}
5959

6060
function get_lines(fname) {

jscomp/test/sexpm.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ function _with_in(filename, f) {
2525
var ic = Pervasives.open_in_bin(filename);
2626
try {
2727
var x = Curry._1(f, ic);
28-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
28+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
2929
return x;
3030
}
3131
catch (raw_e){
3232
var e = Js_exn.internalToOCamlException(raw_e);
33-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
33+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
3434
return /* `Error */[
3535
106380200,
3636
Printexc.to_string(e)
@@ -318,12 +318,12 @@ function to_file_seq(filename, seq) {
318318
try {
319319
var x = Curry._1(f, oc);
320320
Caml_io.caml_ml_flush(oc);
321-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
321+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
322322
return x;
323323
}
324324
catch (e){
325325
Caml_io.caml_ml_flush(oc);
326-
Caml_missing_polyfill.not_implemented("caml_ml_close_channel not implemented by bucklescript yet\n");
326+
Caml_missing_polyfill.not_implemented("caml_ml_close_channel");
327327
throw e;
328328
}
329329
}

0 commit comments

Comments
 (0)