Skip to content

Commit c093e06

Browse files
committed
snapshot
1 parent 3b87c70 commit c093e06

File tree

250 files changed

+20058
-17997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+20058
-17997
lines changed

jscomp/runtime/caml_exceptions.ml

+5
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,8 @@ let caml_is_extension = [%raw {|function (e){
104104
return typeof e.CamlExt.CamlId === "number"
105105
}
106106
|}]
107+
108+
type exn = { exn : Caml_builtin_exceptions.t [@bs.as "CamlExt"]}
109+
110+
let caml_exn_slot_id x = x.exn.id
111+
let caml_exn_slot_name x = x.exn.name

jscomp/runtime/caml_exceptions.mli

+5
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,8 @@ val create : string -> Caml_builtin_exceptions.t
3737

3838
val caml_is_extension :
3939
'a -> bool
40+
41+
type exn
42+
43+
val caml_exn_slot_id : exn -> nativeint
44+
val caml_exn_slot_name : exn -> string

jscomp/runtime/release.ninja

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ build runtime/block.cmj : cc_cmi runtime/block.ml | runtime/block.cmi runtime/ca
1717
build runtime/block.cmi : cc runtime/block.mli | runtime/bs_stdlib_mini.cmi runtime/caml_obj_extern.cmj runtime/js.cmi runtime/js.cmj
1818
build runtime/caml_array.cmj : cc_cmi runtime/caml_array.ml | runtime/caml_array.cmi runtime/caml_array_extern.cmj runtime/caml_builtin_exceptions.cmj
1919
build runtime/caml_array.cmi : cc runtime/caml_array.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
20-
build runtime/caml_builtin_exceptions.cmj : cc_cmi runtime/caml_builtin_exceptions.ml | runtime/caml_builtin_exceptions.cmi runtime/caml_obj_extern.cmj
20+
build runtime/caml_builtin_exceptions.cmj : cc_cmi runtime/caml_builtin_exceptions.ml | runtime/caml_builtin_exceptions.cmi
2121
build runtime/caml_builtin_exceptions.cmi : cc runtime/caml_builtin_exceptions.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
2222
build runtime/caml_bytes.cmj : cc_cmi runtime/caml_bytes.ml | runtime/caml_builtin_exceptions.cmj runtime/caml_bytes.cmi runtime/caml_bytes_extern.cmj runtime/caml_string_extern.cmj
2323
build runtime/caml_bytes.cmi : cc runtime/caml_bytes.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
2424
build runtime/caml_chrome_debugger.cmj : cc_cmi runtime/caml_chrome_debugger.ml | runtime/block.cmj runtime/caml_chrome_debugger.cmi runtime/caml_obj_extern.cmj
2525
build runtime/caml_chrome_debugger.cmi : cc runtime/caml_chrome_debugger.mli | runtime/bs_stdlib_mini.cmi runtime/caml_obj_extern.cmj runtime/js.cmi runtime/js.cmj
26-
build runtime/caml_exceptions.cmj : cc_cmi runtime/caml_exceptions.ml | runtime/caml_builtin_exceptions.cmj runtime/caml_exceptions.cmi runtime/caml_nativeint_extern.cmj runtime/caml_obj_extern.cmj runtime/js.cmj
27-
build runtime/caml_exceptions.cmi : cc runtime/caml_exceptions.mli | runtime/bs_stdlib_mini.cmi runtime/caml_builtin_exceptions.cmi runtime/js.cmi runtime/js.cmj
26+
build runtime/caml_exceptions.cmj : cc_cmi runtime/caml_exceptions.ml | runtime/caml_builtin_exceptions.cmj runtime/caml_exceptions.cmi runtime/caml_nativeint_extern.cmj runtime/caml_obj_extern.cmj
27+
build runtime/caml_exceptions.cmi : cc runtime/caml_exceptions.mli | runtime/bs_stdlib_mini.cmi runtime/caml_builtin_exceptions.cmi runtime/caml_obj_extern.cmj runtime/js.cmi runtime/js.cmj
2828
build runtime/caml_float.cmj : cc_cmi runtime/caml_float.ml | runtime/caml_float.cmi runtime/caml_float_extern.cmj
2929
build runtime/caml_float.cmi : cc runtime/caml_float.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
3030
build runtime/caml_format.cmj : cc_cmi runtime/caml_format.ml | runtime/caml_builtin_exceptions.cmj runtime/caml_char.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_format.cmi runtime/caml_int32.cmj runtime/caml_int64.cmj runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj

jscomp/test/406_primitive_test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ function f(param) {
2727
try {
2828
for(var i = 0; i <= 200; ++i){
2929
if (i === 10) {
30-
throw [
31-
A,
32-
0
33-
];
30+
throw {
31+
CamlExt: A,
32+
_1: 0
33+
};
3434
}
3535

3636
}
3737
return ;
3838
}
3939
catch (raw_exn){
4040
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
41-
if (exn[0] === A) {
41+
if (exn.CamlExt === A) {
4242
return ;
4343
}
4444
throw exn;

jscomp/test/adt_optimize_test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,14 @@ function f11(x) {
157157
if (!x.tag) {
158158
return 1;
159159
}
160-
throw [
161-
Caml_builtin_exceptions.assert_failure,
162-
/* tuple */[
160+
throw {
161+
CamlExt: Caml_builtin_exceptions.assert_failure,
162+
_1: /* tuple */[
163163
"adt_optimize_test.ml",
164164
191,
165165
9
166166
]
167-
];
167+
};
168168
}
169169

170170
exports.f = f;

jscomp/test/app_root_finder.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ function find_package_json(_dir) {
1414
}
1515
var new_dir = Path.dirname(dir);
1616
if (new_dir === dir) {
17-
throw Caml_builtin_exceptions.not_found;
17+
throw {
18+
CamlExt: Caml_builtin_exceptions.not_found
19+
};
1820
}
1921
_dir = new_dir;
2022
continue ;

jscomp/test/arith_parser.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ var yynames_block = "NUMERAL\0IDENT\0";
4646

4747
var yyact = [
4848
(function (param) {
49-
throw [
50-
Caml_builtin_exceptions.failure,
51-
"parser"
52-
];
49+
throw {
50+
CamlExt: Caml_builtin_exceptions.failure,
51+
_1: "parser"
52+
};
5353
}),
5454
(function (__caml_parser_env) {
5555
return Parsing.peek_val(__caml_parser_env, 1);
@@ -102,10 +102,10 @@ var yyact = [
102102
return Parsing.peek_val(__caml_parser_env, 1);
103103
}),
104104
(function (__caml_parser_env) {
105-
throw [
106-
Parsing.YYexit,
107-
Parsing.peek_val(__caml_parser_env, 0)
108-
];
105+
throw {
106+
CamlExt: Parsing.YYexit,
107+
_1: Parsing.peek_val(__caml_parser_env, 0)
108+
};
109109
})
110110
];
111111

jscomp/test/arity_infer.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ function f0(x) {
1010
return x + 1 | 0;
1111
});
1212
} else {
13-
throw Caml_builtin_exceptions.not_found;
13+
throw {
14+
CamlExt: Caml_builtin_exceptions.not_found
15+
};
1416
}
1517
return tmp(3);
1618
}
1719

1820
function f1(x) {
19-
throw Caml_builtin_exceptions.not_found;
21+
throw {
22+
CamlExt: Caml_builtin_exceptions.not_found
23+
};
2024
return Curry._1(undefined, x);
2125
}
2226

@@ -44,7 +48,9 @@ function f3(x) {
4448
});
4549
break;
4650
default:
47-
throw Caml_builtin_exceptions.not_found;
51+
throw {
52+
CamlExt: Caml_builtin_exceptions.not_found
53+
};
4854
}
4955
return tmp(3);
5056
}

jscomp/test/array_safe_get.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ try {
1616
}
1717
catch (raw_msg){
1818
var msg = Caml_js_exceptions.internalToOCamlException(raw_msg);
19-
if (msg[0] === Caml_builtin_exceptions.invalid_argument) {
20-
console.log(msg[1]);
19+
if (msg.CamlExt === Caml_builtin_exceptions.invalid_argument) {
20+
console.log(msg._1);
2121
y = 0;
2222
} else {
2323
throw msg;

jscomp/test/array_test.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var Caml_obj = require("../../lib/js/caml_obj.js");
99
var Caml_array = require("../../lib/js/caml_array.js");
1010
var Caml_primitive = require("../../lib/js/caml_primitive.js");
1111
var Caml_exceptions = require("../../lib/js/caml_exceptions.js");
12+
var Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js");
1213

1314
function starts_with(xs, prefix, p) {
1415
var H = Caml_exceptions.create("H");
@@ -20,14 +21,17 @@ function starts_with(xs, prefix, p) {
2021
try {
2122
for(var i = 0; i < len2; ++i){
2223
if (!Curry._2(p, Caml_array.caml_array_get(xs, i), Caml_array.caml_array_get(prefix, i))) {
23-
throw H;
24+
throw {
25+
CamlExt: H
26+
};
2427
}
2528

2629
}
2730
return true;
2831
}
29-
catch (exn){
30-
if (exn === H) {
32+
catch (raw_exn){
33+
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
34+
if (exn.CamlExt === H) {
3135
return false;
3236
}
3337
throw exn;

jscomp/test/bb.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ function ff(x) {
2323
case "c" :
2424
return /* c */99;
2525
default:
26-
throw [
27-
Caml_builtin_exceptions.assert_failure,
28-
/* tuple */[
26+
throw {
27+
CamlExt: Caml_builtin_exceptions.assert_failure,
28+
_1: /* tuple */[
2929
"bb.ml",
3030
17,
3131
9
3232
]
33-
];
33+
};
3434
}
3535
}
3636

@@ -47,14 +47,14 @@ function test(x) {
4747
match = /* c */99;
4848
break;
4949
default:
50-
throw [
51-
Caml_builtin_exceptions.assert_failure,
52-
/* tuple */[
50+
throw {
51+
CamlExt: Caml_builtin_exceptions.assert_failure,
52+
_1: /* tuple */[
5353
"bb.ml",
5454
26,
5555
13
5656
]
57-
];
57+
};
5858
}
5959
if (match !== 98) {
6060
if (match >= 99) {

jscomp/test/bdd.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ function resize(newSize) {
6363
}
6464
var n = bucket[0];
6565
if (typeof n === "number") {
66-
throw [
67-
Caml_builtin_exceptions.assert_failure,
68-
/* tuple */[
66+
throw {
67+
CamlExt: Caml_builtin_exceptions.assert_failure,
68+
_1: /* tuple */[
6969
"bdd.ml",
7070
54,
7171
27
7272
]
73-
];
73+
};
7474
}
7575
var ind = hashVal(getId(n[0]), getId(n[3]), n[1]) & newSz_1;
7676
Caml_array.caml_array_set(newArr, ind, /* :: */[
@@ -128,14 +128,14 @@ function mkNode(low, v, high) {
128128
if (b) {
129129
var n = b[0];
130130
if (typeof n === "number") {
131-
throw [
132-
Caml_builtin_exceptions.assert_failure,
133-
/* tuple */[
131+
throw {
132+
CamlExt: Caml_builtin_exceptions.assert_failure,
133+
_1: /* tuple */[
134134
"bdd.ml",
135135
99,
136136
31
137137
]
138-
];
138+
};
139139
}
140140
if (v === n[1] && idl === getId(n[0]) && idh === getId(n[3])) {
141141
return n;
@@ -371,14 +371,14 @@ function main(param) {
371371
if (succeeded) {
372372
return ;
373373
}
374-
throw [
375-
Caml_builtin_exceptions.assert_failure,
376-
/* tuple */[
374+
throw {
375+
CamlExt: Caml_builtin_exceptions.assert_failure,
376+
_1: /* tuple */[
377377
"bdd.ml",
378378
233,
379379
2
380380
]
381-
];
381+
};
382382
}
383383

384384
main(undefined);

jscomp/test/bench.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ function init(l, f) {
2424
return [];
2525
}
2626
if (l < 0) {
27-
throw [
28-
Caml_builtin_exceptions.invalid_argument,
29-
"Array.init"
30-
];
27+
throw {
28+
CamlExt: Caml_builtin_exceptions.invalid_argument,
29+
_1: "Array.init"
30+
};
3131
}
3232
var res = Caml_array.caml_make_vect(l, f$1(0));
3333
for(var i = 1; i < l; ++i){

0 commit comments

Comments
 (0)