Skip to content

Commit ca0b908

Browse files
committed
snapshot
1 parent bf16e00 commit ca0b908

File tree

263 files changed

+12341
-14971
lines changed

Some content is hidden

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

263 files changed

+12341
-14971
lines changed

jscomp/artifacts.json

-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
"callback.js",
116116
"caml_array_extern.js",
117117
"caml_array.js",
118-
"caml_builtin_exceptions.js",
119118
"caml_bytes_extern.js",
120119
"caml_bytes.js",
121120
"caml_char.js",
@@ -296,7 +295,6 @@
296295
"callback.js",
297296
"caml_array_extern.js",
298297
"caml_array.js",
299-
"caml_builtin_exceptions.js",
300298
"caml_bytes_extern.js",
301299
"caml_bytes.js",
302300
"caml_char.js",

jscomp/main/builtin_cmi_datasets.ml

+3-3
Large diffs are not rendered by default.

jscomp/main/builtin_cmj_datasets.ml

+71-71
Large diffs are not rendered by default.

jscomp/runtime/caml_exceptions.ml

+17-32
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,10 @@
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-
type t = {
26-
mutable id : nativeint [@bs.as "ExceptionID"];
27-
name : string [@bs.as "Debug"];
28-
}
29-
30-
31-
let make name id = {
32-
name ; id }
33-
34-
25+
type t = {
26+
id : string [@bs.as "ExceptionID"];
3527

28+
}
3629

3730

3831
(**
@@ -43,7 +36,7 @@ name ; id }
4336
{[ a = caml_set_oo_id([248,"tag", caml_oo_last_id++]) ]}
4437
*)
4538

46-
let id = ref 0n
39+
let%private id = ref 0
4740

4841

4942
(* see #251
@@ -57,20 +50,15 @@ let id = ref 0n
5750
]}*)
5851
let caml_set_oo_id (b : Caml_obj_extern.t) : Caml_obj_extern.t =
5952
Caml_obj_extern.set_field (Caml_obj_extern.repr b) 1 (Caml_obj_extern.repr id.contents);
60-
id .contents <- Caml_nativeint_extern.add id.contents 1n;
53+
id .contents <- id.contents + 1;
6154
b
6255
(* FXIME: this is only relevant to OO module now *)
6356

64-
(* let object_tag = 248 *)
6557

66-
let create (str : string) : t =
67-
id .contents <- Caml_nativeint_extern.add id.contents 1n;
68-
make str id.contents
58+
let create (str : string) : string =
59+
id .contents <- id.contents + 1;
60+
str ^ "/" ^(Obj.magic (id.contents : int) : string)
6961

70-
(* let makeExtension (str : string) : Caml_builtin_exceptions.exception_block = *)
71-
(* let v = ( str, get_id ()) in *)
72-
(* Caml_obj_extern.set_tag (Caml_obj_extern.repr v) object_tag; *)
73-
(* v *)
7462

7563

7664

@@ -105,15 +93,12 @@ let create (str : string) : t =
10593
10694
This is not a problem in `try .. with` since the logic above is not expressible, see more design in [destruct_exn.md]
10795
*)
108-
let caml_is_extension = [%raw {|function (e){
109-
if(e == null ) {
110-
return false
111-
}
112-
return typeof e.ExceptionID === "number"
113-
}
114-
|}]
115-
116-
(* type exn = { exn : Caml_builtin_exceptions.t [@bs.as "CamlExt"]} *)
117-
118-
let caml_exn_slot_id (x : t) = x.id
119-
let caml_exn_slot_name (x : t) = x.name
96+
let caml_is_extension (type a ) (e : a) : bool =
97+
if Js.testAny e then false
98+
else Js.typeof (Obj.magic e : t) .id = "string"
99+
100+
101+
102+
103+
(**FIXME: remove the trailing `/` *)
104+
let caml_exn_slot_name (x : t) : string = x.id

jscomp/runtime/release.ninja

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ build runtime/caml_bytes.cmj : cc_cmi runtime/caml_bytes.ml | runtime/caml_bytes
2121
build runtime/caml_bytes.cmi : cc runtime/caml_bytes.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
2222
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
2323
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
24-
build runtime/caml_exceptions.cmj : cc_cmi runtime/caml_exceptions.ml | runtime/caml_exceptions.cmi runtime/caml_nativeint_extern.cmj runtime/caml_obj_extern.cmj
25-
build runtime/caml_exceptions.cmi : cc runtime/caml_exceptions.mli | runtime/bs_stdlib_mini.cmi runtime/caml_obj_extern.cmj runtime/js.cmi runtime/js.cmj
2624
build runtime/caml_float.cmj : cc_cmi runtime/caml_float.ml | runtime/caml_float.cmi runtime/caml_float_extern.cmj
2725
build runtime/caml_float.cmi : cc runtime/caml_float.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
2826
build runtime/caml_format.cmj : cc_cmi runtime/caml_format.ml | 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
@@ -64,9 +62,9 @@ build runtime/caml_sys.cmi : cc runtime/caml_sys.mli | runtime/bs_stdlib_mini.cm
6462
build runtime/caml_weak.cmj : cc_cmi runtime/caml_weak.ml | runtime/caml_array.cmj runtime/caml_array_extern.cmj runtime/caml_obj.cmj runtime/caml_obj_extern.cmj runtime/caml_option.cmj runtime/caml_undefined_extern.cmj runtime/caml_weak.cmi
6563
build runtime/caml_weak.cmi : cc runtime/caml_weak.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
6664
build runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj : cc runtime/caml_array_extern.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
67-
build runtime/caml_builtin_exceptions.cmi runtime/caml_builtin_exceptions.cmj : cc runtime/caml_builtin_exceptions.ml | runtime/bs_stdlib_mini.cmi runtime/caml_exceptions.cmj runtime/js.cmi runtime/js.cmj
6865
build runtime/caml_bytes_extern.cmi runtime/caml_bytes_extern.cmj : cc runtime/caml_bytes_extern.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
6966
build runtime/caml_char.cmi runtime/caml_char.cmj : cc runtime/caml_char.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
67+
build runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj : cc runtime/caml_exceptions.ml | runtime/bs_stdlib_mini.cmi runtime/caml_obj_extern.cmj runtime/js.cmi runtime/js.cmj
7068
build runtime/caml_external_polyfill.cmi runtime/caml_external_polyfill.cmj : cc runtime/caml_external_polyfill.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
7169
build runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj : cc runtime/caml_float_extern.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
7270
build runtime/caml_int32_extern.cmi runtime/caml_int32_extern.cmj : cc runtime/caml_int32_extern.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
@@ -78,4 +76,4 @@ build runtime/caml_oo_curry.cmi runtime/caml_oo_curry.cmj : cc runtime/caml_oo_c
7876
build runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj : cc runtime/caml_string_extern.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
7977
build runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj : cc runtime/caml_undefined_extern.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
8078
build runtime/curry.cmi runtime/curry.cmj : cc runtime/curry.ml | runtime/bs_stdlib_mini.cmi runtime/caml_array.cmj runtime/caml_array_extern.cmj runtime/js.cmi runtime/js.cmj
81-
build runtime : phony runtime/bs_stdlib_mini.cmi runtime/js.cmj runtime/js.cmi runtime/block.cmi runtime/block.cmj runtime/caml_array.cmi runtime/caml_array.cmj runtime/caml_bytes.cmi runtime/caml_bytes.cmj runtime/caml_chrome_debugger.cmi runtime/caml_chrome_debugger.cmj runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj runtime/caml_float.cmi runtime/caml_float.cmj runtime/caml_format.cmi runtime/caml_format.cmj runtime/caml_gc.cmi runtime/caml_gc.cmj runtime/caml_hash.cmi runtime/caml_hash.cmj runtime/caml_hash_primitive.cmi runtime/caml_hash_primitive.cmj runtime/caml_int32.cmi runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_int64.cmj runtime/caml_io.cmi runtime/caml_io.cmj runtime/caml_lexer.cmi runtime/caml_lexer.cmj runtime/caml_md5.cmi runtime/caml_md5.cmj runtime/caml_module.cmi runtime/caml_module.cmj runtime/caml_obj.cmi runtime/caml_obj.cmj runtime/caml_oo.cmi runtime/caml_oo.cmj runtime/caml_option.cmi runtime/caml_option.cmj runtime/caml_parser.cmi runtime/caml_parser.cmj runtime/caml_primitive.cmi runtime/caml_primitive.cmj runtime/caml_splice_call.cmi runtime/caml_splice_call.cmj runtime/caml_string.cmi runtime/caml_string.cmj runtime/caml_sys.cmi runtime/caml_sys.cmj runtime/caml_weak.cmi runtime/caml_weak.cmj runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj runtime/caml_builtin_exceptions.cmi runtime/caml_builtin_exceptions.cmj runtime/caml_bytes_extern.cmi runtime/caml_bytes_extern.cmj runtime/caml_char.cmi runtime/caml_char.cmj runtime/caml_external_polyfill.cmi runtime/caml_external_polyfill.cmj runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj runtime/caml_int32_extern.cmi runtime/caml_int32_extern.cmj runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj runtime/caml_obj_extern.cmi runtime/caml_obj_extern.cmj runtime/caml_oo_curry.cmi runtime/caml_oo_curry.cmj runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj runtime/curry.cmi runtime/curry.cmj
79+
build runtime : phony runtime/bs_stdlib_mini.cmi runtime/js.cmj runtime/js.cmi runtime/block.cmi runtime/block.cmj runtime/caml_array.cmi runtime/caml_array.cmj runtime/caml_bytes.cmi runtime/caml_bytes.cmj runtime/caml_chrome_debugger.cmi runtime/caml_chrome_debugger.cmj runtime/caml_float.cmi runtime/caml_float.cmj runtime/caml_format.cmi runtime/caml_format.cmj runtime/caml_gc.cmi runtime/caml_gc.cmj runtime/caml_hash.cmi runtime/caml_hash.cmj runtime/caml_hash_primitive.cmi runtime/caml_hash_primitive.cmj runtime/caml_int32.cmi runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_int64.cmj runtime/caml_io.cmi runtime/caml_io.cmj runtime/caml_lexer.cmi runtime/caml_lexer.cmj runtime/caml_md5.cmi runtime/caml_md5.cmj runtime/caml_module.cmi runtime/caml_module.cmj runtime/caml_obj.cmi runtime/caml_obj.cmj runtime/caml_oo.cmi runtime/caml_oo.cmj runtime/caml_option.cmi runtime/caml_option.cmj runtime/caml_parser.cmi runtime/caml_parser.cmj runtime/caml_primitive.cmi runtime/caml_primitive.cmj runtime/caml_splice_call.cmi runtime/caml_splice_call.cmj runtime/caml_string.cmi runtime/caml_string.cmj runtime/caml_sys.cmi runtime/caml_sys.cmj runtime/caml_weak.cmi runtime/caml_weak.cmj runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj runtime/caml_bytes_extern.cmi runtime/caml_bytes_extern.cmj runtime/caml_char.cmi runtime/caml_char.cmj runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj runtime/caml_external_polyfill.cmi runtime/caml_external_polyfill.cmj runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj runtime/caml_int32_extern.cmi runtime/caml_int32_extern.cmj runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj runtime/caml_obj_extern.cmi runtime/caml_obj_extern.cmj runtime/caml_oo_curry.cmi runtime/caml_oo_curry.cmj runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj runtime/curry.cmi runtime/curry.cmj

jscomp/test/406_primitive_test.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ function f(param) {
2828
for(var i = 0; i <= 200; ++i){
2929
if (i === 10) {
3030
throw {
31-
ExceptionID: A.ExceptionID,
32-
_1: 0,
33-
Debug: A.Debug
31+
ExceptionID: A,
32+
_1: 0
3433
};
3534
}
3635

@@ -39,7 +38,7 @@ function f(param) {
3938
}
4039
catch (raw_exn){
4140
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
42-
if (exn.ExceptionID === A.ExceptionID) {
41+
if (exn.ExceptionID === A) {
4342
return ;
4443
}
4544
throw exn;

jscomp/test/adt_optimize_test.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,12 @@ function f11(x) {
157157
return 1;
158158
}
159159
throw {
160-
ExceptionID: -9,
160+
ExceptionID: "Assert_failure",
161161
_1: /* tuple */[
162162
"adt_optimize_test.ml",
163163
191,
164164
9
165-
],
166-
Debug: "Assert_failure"
165+
]
167166
};
168167
}
169168

jscomp/test/app_root_finder.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ function find_package_json(_dir) {
1414
var new_dir = Path.dirname(dir);
1515
if (new_dir === dir) {
1616
throw {
17-
ExceptionID: -6,
18-
Debug: "Not_found"
17+
ExceptionID: "Not_found"
1918
};
2019
}
2120
_dir = new_dir;

jscomp/test/arith_parser.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ var yynames_block = "NUMERAL\0IDENT\0";
4646
var yyact = [
4747
(function (param) {
4848
throw {
49-
ExceptionID: -2,
50-
_1: "parser",
51-
Debug: "Failure"
49+
ExceptionID: "Failure",
50+
_1: "parser"
5251
};
5352
}),
5453
(function (__caml_parser_env) {
@@ -103,9 +102,8 @@ var yyact = [
103102
}),
104103
(function (__caml_parser_env) {
105104
throw {
106-
ExceptionID: Parsing.YYexit.ExceptionID,
107-
_1: Parsing.peek_val(__caml_parser_env, 0),
108-
Debug: Parsing.YYexit.Debug
105+
ExceptionID: Parsing.YYexit,
106+
_1: Parsing.peek_val(__caml_parser_env, 0)
109107
};
110108
})
111109
];

jscomp/test/arity_infer.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@ function f0(x) {
1010
});
1111
} else {
1212
throw {
13-
ExceptionID: -6,
14-
Debug: "Not_found"
13+
ExceptionID: "Not_found"
1514
};
1615
}
1716
return tmp(3);
1817
}
1918

2019
function f1(x) {
2120
throw {
22-
ExceptionID: -6,
23-
Debug: "Not_found"
21+
ExceptionID: "Not_found"
2422
};
2523
return Curry._1(undefined, x);
2624
}
@@ -50,8 +48,7 @@ function f3(x) {
5048
break;
5149
default:
5250
throw {
53-
ExceptionID: -6,
54-
Debug: "Not_found"
51+
ExceptionID: "Not_found"
5552
};
5653
}
5754
return tmp(3);

jscomp/test/array_safe_get.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ try {
1515
}
1616
catch (raw_msg){
1717
var msg = Caml_js_exceptions.internalToOCamlException(raw_msg);
18-
if (msg.ExceptionID === /* Invalid_argument */-3) {
18+
if (msg.ExceptionID === "Invalid_argument") {
1919
console.log(msg._1);
2020
y = 0;
2121
} else {

jscomp/test/array_test.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ function starts_with(xs, prefix, p) {
2222
for(var i = 0; i < len2; ++i){
2323
if (!Curry._2(p, Caml_array.caml_array_get(xs, i), Caml_array.caml_array_get(prefix, i))) {
2424
throw {
25-
ExceptionID: H.ExceptionID,
26-
Debug: H.Debug
25+
ExceptionID: H
2726
};
2827
}
2928

@@ -32,7 +31,7 @@ function starts_with(xs, prefix, p) {
3231
}
3332
catch (raw_exn){
3433
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
35-
if (exn.ExceptionID === H.ExceptionID) {
34+
if (exn.ExceptionID === H) {
3635
return false;
3736
}
3837
throw exn;

jscomp/test/bb.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ function ff(x) {
2323
return /* c */99;
2424
default:
2525
throw {
26-
ExceptionID: -9,
26+
ExceptionID: "Assert_failure",
2727
_1: /* tuple */[
2828
"bb.ml",
2929
17,
3030
9
31-
],
32-
Debug: "Assert_failure"
31+
]
3332
};
3433
}
3534
}
@@ -48,13 +47,12 @@ function test(x) {
4847
break;
4948
default:
5049
throw {
51-
ExceptionID: -9,
50+
ExceptionID: "Assert_failure",
5251
_1: /* tuple */[
5352
"bb.ml",
5453
26,
5554
13
56-
],
57-
Debug: "Assert_failure"
55+
]
5856
};
5957
}
6058
if (match !== 98) {

jscomp/test/bdd.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,12 @@ function resize(newSize) {
6363
var n = bucket[0];
6464
if (typeof n === "number") {
6565
throw {
66-
ExceptionID: -9,
66+
ExceptionID: "Assert_failure",
6767
_1: /* tuple */[
6868
"bdd.ml",
6969
54,
7070
27
71-
],
72-
Debug: "Assert_failure"
71+
]
7372
};
7473
}
7574
var ind = hashVal(getId(n[0]), getId(n[3]), n[1]) & newSz_1;
@@ -129,13 +128,12 @@ function mkNode(low, v, high) {
129128
var n = b[0];
130129
if (typeof n === "number") {
131130
throw {
132-
ExceptionID: -9,
131+
ExceptionID: "Assert_failure",
133132
_1: /* tuple */[
134133
"bdd.ml",
135134
99,
136135
31
137-
],
138-
Debug: "Assert_failure"
136+
]
139137
};
140138
}
141139
if (v === n[1] && idl === getId(n[0]) && idh === getId(n[3])) {
@@ -373,13 +371,12 @@ function main(param) {
373371
return ;
374372
}
375373
throw {
376-
ExceptionID: -9,
374+
ExceptionID: "Assert_failure",
377375
_1: /* tuple */[
378376
"bdd.ml",
379377
233,
380378
2
381-
],
382-
Debug: "Assert_failure"
379+
]
383380
};
384381
}
385382

jscomp/test/bench.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ function init(l, f) {
2424
}
2525
if (l < 0) {
2626
throw {
27-
ExceptionID: -3,
28-
_1: "Array.init",
29-
Debug: "Invalid_argument"
27+
ExceptionID: "Invalid_argument",
28+
_1: "Array.init"
3029
};
3130
}
3231
var res = Caml_array.caml_make_vect(l, f$1(0));

0 commit comments

Comments
 (0)