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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 8 additions & 8 deletions
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

Lines changed: 9 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 7 additions & 3 deletions
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;

0 commit comments

Comments
 (0)