Skip to content

Commit 2789454

Browse files
authored
Merge pull request #5325 from rescript-lang/decouple_runtime
decouple runtime from stdlib
2 parents fdec0e7 + cb48729 commit 2789454

26 files changed

+268
-140
lines changed

jscomp/build_tests/exports/src/demo.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
2+
exception Stack_overflow
3+
exception Sys_error of string
34
let _ =
45
Js.Int.toString,
56
Js.Float.isNaN

jscomp/core/lam_convert.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ let convert (exports : Set_ident.t) (lam : Lambda.lambda) :
484484
| "#null_to_opt" -> Pnull_to_opt
485485
| "#is_nullable" -> Pis_null_undefined
486486
| "#string_append" -> Pstringadd
487+
| "#wrap_exn" -> Pwrap_exn
487488
| "#obj_length" -> Pcaml_obj_length
488489
| "#function_length" -> Pjs_function_length
489490
| "#unsafe_lt" -> Pjscomp Clt

jscomp/main/builtin_cmi_datasets.ml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

jscomp/main/builtin_cmj_datasets.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(* 42e8429bc1f9afe63a58d02628ed4252 *)
1+
(* e66926b4ce32d12b760cb368ecce9f15 *)
22
let module_names : string array = Obj.magic (
33
"Js" (* 23 *),
44
"Arg" (* 217 *),
@@ -25,7 +25,7 @@ let module_names : string array = Obj.magic (
2525
"Buffer" (* 531 *),
2626
"Digest" (* 153 *),
2727
"Genlex" (* 44 *),
28-
"Js_exn" (* 1099 *),
28+
"Js_exn" (* 950 *),
2929
"Js_int" (* 116 *),
3030
"Js_obj" (* 23 *),
3131
"Lexing" (* 807 *),
@@ -151,7 +151,7 @@ let module_data : string array = Obj.magic (
151151
(* Buffer *)"\132\149\166\190\000\000\001\255\000\000\000\140\000\000\001\216\000\000\001\188\160\b\000\000P\000\176#nth\144\160\160B@@@\176#sub\144\160\160C@@@\176$blit\144\160\160E@@@\176%clear\144\160\160A@@\144\148\192A\160\176\001\004\007!b@@\151\176\162A\144(position\160\144\004\t\160\146\160\025_i\000\000\000\000\000@@\176\1924stdlib-406/buffer.mlv\001\007\212\001\007\226\192\004\002v\001\007\212\001\007\241@\192B@@A\176%reset\144\160\160A@@@\176&create\144\160\160A@@@\176&length\144\160\160A@@\144\148\192A\160\176\001\004\005!b@@\151\176\161A\160\004%A\160\144\004\b@\176\192\004 t\001\007\185\001\007\200\192\004!t\001\007\185\001\007\210@\192B@@@\176(add_char\144\160\160B@@@\176(contents\144\160\160A@@@\176(to_bytes\144\160\160A@@@\176(truncate\144\160\160B@@@\176)add_bytes\144\160\160B@@@\176*add_buffer\144\160\160B@@@\176*add_string\144\160\160B@@@\176,add_subbytes\144\160\160D@@@\176-add_substring\144\160\160D@@@\176.add_substitute\144\160\160C@@@\176/add_utf_8_uchar\144\160\160B@@@\1762add_utf_16be_uchar\144\160\160B@@@\1762add_utf_16le_uchar\144\160\160B@@@A",
152152
(* Digest *)"\132\149\166\190\000\000\000\133\000\000\000*\000\000\000\135\000\000\000\127\160\b\000\000 \000\176%bytes\144\160\160A@@@\176%equal\144\160\160B@@@\176&string\144\160\160A@@@\176&to_hex\144\160\160A@@@\176'compare\144\160\160B@@@\176(from_hex\144\160\160A@@@\176(subbytes\144\160\160C@@@\176)substring\144\160\160C@@@A",
153153
(* Genlex *)"\132\149\166\190\000\000\000\024\000\000\000\b\000\000\000\024\000\000\000\023\160\144\176*make_lexer\144\160\160A\160A@@@A",
154-
(* Js_exn *)"\132\149\166\190\000\000\0047\000\000\000\246\000\000\003w\000\000\003P\160\b\000\000 \000\176*raiseError\144\160\160A@A\144\148\192A\160\176\001\0048#str@@\151\176D\160\151\176\180%Error\160\160AA@\182%Error@@\160\144\004\015@\176\1920others/js_exn.mlu\001\007\205\001\007\225\192\004\002u\001\007\205\001\007\238@@\176\192\004\004u\001\007\205\001\007\207\192\004\005u\001\007\205\001\007\254@\192B@@@\176-raiseUriError\144\160\160A@A\144\148\192A\160\176\001\004P#str@@\151\176D\160\151\176\180(URIError\160\004 @\182(URIError@@\160\144\004\014@\176\192\004\031\000Z\001\011\208\001\011\227\192\004 \000Z\001\011\208\001\011\245@@\176\192\004\"\000Z\001\011\208\001\011\210\192\004#\000Z\001\011\208\001\011\246@\192B@@@\176.raiseEvalError\144\160\160A@A\144\148\192A\160\176\001\004<#str@@\151\176D\160\151\176\180)EvalError\160\004>@\182)EvalError@@\160\144\004\014@\176\192\004={\001\br\001\b\134\192\004>{\001\br\001\b\151@@\176\192\004@{\001\br\001\bt\192\004A{\001\br\001\b\172@\192B@@@\176.raiseTypeError\144\160\160A@A\144\148\192A\160\176\001\004L#str@@\151\176D\160\151\176\180)TypeError\160\004\\@\182)TypeError@@\160\144\004\014@\176\192\004[\000T\001\011:\001\011M\192\004\\\000T\001\011:\001\011`@@\176\192\004^\000T\001\011:\001\011<\192\004_\000T\001\011:\001\011a@\192B@@@\176/raiseRangeError\144\160\160A@A\144\148\192A\160\176\001\004@#str@@\151\176D\160\151\176\180*RangeError\160\004z@\182*RangeError@@\160\144\004\014@\176\192\004y\000A\001\t&\001\t:\192\004z\000A\001\t&\001\tL@@\176\192\004|\000A\001\t&\001\t(\192\004}\000A\001\t&\001\tb@\192B@@@\1760anyToExnInternal\144\160\160A@@\144\148\192A\160\176\001\003\249!x@@\147\176\151\176\161A\1458internalToOCamlException\160\145\176@2Caml_js_exceptionsA@\176\192&_none_A@\000\255\004\002A\160\144\004\018@\176\176\192\004\156q\001\007v\001\007z\192\004\157q\001\007v\001\007\178@BA\192B@@@\1760raiseSyntaxError\144\160\160A@A\144\148\192A\160\176\001\004H#str@@\151\176D\160\151\176\180+SyntaxError\160\004\184@\182+SyntaxError@@\160\144\004\014@\176\192\004\183\000N\001\n\157\001\n\176\192\004\184\000N\001\n\157\001\n\197@@\176\192\004\186\000N\001\n\157\001\n\159\192\004\187\000N\001\n\157\001\n\198@\192B@@@\1763raiseReferenceError\144\160\160A@A\144\148\192A\160\176\001\004D#str@@\151\176D\160\151\176\180.ReferenceError\160\004\214@\182.ReferenceError@@\160\144\004\014@\176\192\004\213\000H\001\t\242\001\n\005\192\004\214\000H\001\t\242\001\n\029@@\176\192\004\216\000H\001\t\242\001\t\244\192\004\217\000H\001\t\242\001\n\030@\192B@@@A",
154+
(* Js_exn *)"\132\149\166\190\000\000\003\162\000\000\000\214\000\000\003\002\000\000\002\227\160\240\176*raiseError\144\160\160A@A\144\148\192A\160\176\001\003\246#str@@\151\176D\160\151\176\180%Error\160\160AA@\182%Error@@\160\144\004\015@\176\1920others/js_exn.mlt\001\007\140\001\007\160\192\004\002t\001\007\140\001\007\173@@\176\192\004\004t\001\007\140\001\007\142\192\004\005t\001\007\140\001\007\189@\192B@@@\176-raiseUriError\144\160\160A@A\144\148\192A\160\176\001\004\014#str@@\151\176D\160\151\176\180(URIError\160\004 @\182(URIError@@\160\144\004\014@\176\192\004\031\000Y\001\011\143\001\011\162\192\004 \000Y\001\011\143\001\011\180@@\176\192\004\"\000Y\001\011\143\001\011\145\192\004#\000Y\001\011\143\001\011\181@\192B@@@\176.raiseEvalError\144\160\160A@A\144\148\192A\160\176\001\003\250#str@@\151\176D\160\151\176\180)EvalError\160\004>@\182)EvalError@@\160\144\004\014@\176\192\004=z\001\b1\001\bE\192\004>z\001\b1\001\bV@@\176\192\004@z\001\b1\001\b3\192\004Az\001\b1\001\bk@\192B@@@\176.raiseTypeError\144\160\160A@A\144\148\192A\160\176\001\004\n#str@@\151\176D\160\151\176\180)TypeError\160\004\\@\182)TypeError@@\160\144\004\014@\176\192\004[\000S\001\n\249\001\011\012\192\004\\\000S\001\n\249\001\011\031@@\176\192\004^\000S\001\n\249\001\n\251\192\004_\000S\001\n\249\001\011 @\192B@@@\176/raiseRangeError\144\160\160A@A\144\148\192A\160\176\001\003\254#str@@\151\176D\160\151\176\180*RangeError\160\004z@\182*RangeError@@\160\144\004\014@\176\192\004y\000@\001\b\229\001\b\249\192\004z\000@\001\b\229\001\t\011@@\176\192\004|\000@\001\b\229\001\b\231\192\004}\000@\001\b\229\001\t!@\192B@@@\1760raiseSyntaxError\144\160\160A@A\144\148\192A\160\176\001\004\006#str@@\151\176D\160\151\176\180+SyntaxError\160\004\152@\182+SyntaxError@@\160\144\004\014@\176\192\004\151\000M\001\n\\\001\no\192\004\152\000M\001\n\\\001\n\132@@\176\192\004\154\000M\001\n\\\001\n^\192\004\155\000M\001\n\\\001\n\133@\192B@@@\1763raiseReferenceError\144\160\160A@A\144\148\192A\160\176\001\004\002#str@@\151\176D\160\151\176\180.ReferenceError\160\004\182@\182.ReferenceError@@\160\144\004\014@\176\192\004\181\000G\001\t\177\001\t\196\192\004\182\000G\001\t\177\001\t\220@@\176\192\004\184\000G\001\t\177\001\t\179\192\004\185\000G\001\t\177\001\t\221@\192B@@@A",
155155
(* Js_int *)"\132\149\166\190\000\000\000`\000\000\000\028\000\000\000Z\000\000\000W\160\144\176%equal\144\160\160B@@\144\148\192B\160\176\001\003\242!x@\160\176\001\003\243!y@@\151\176\152@\160\144\004\n\160\144\004\t@\176\1920others/js_int.ml\001\000\168\001\023\227\001\023\250\192\004\002\001\000\168\001\023\227\001\023\255@\192B@@@A",
156156
(* Js_obj *)"\132\149\166\190\000\000\000\003\000\000\000\001\000\000\000\003\000\000\000\003\160\128A",
157157
(* Lexing *)"\132\149\166\190\000\000\003\019\000\000\000\192\000\000\002\153\000\000\002v\160\b\000\000@\000\176&engine\144\160\160C@@@\176&lexeme\144\160\160A@@@\176(new_line\144\160\160A@@@\176*lexeme_end\144\160\160A@@\144\148\192A\160\176\001\004@&lexbuf@@\151\176\161C\160(pos_cnum@\160\151\176\161K\160*lex_curr_pA\160\144\004\015@\176\1924stdlib-406/lexing.ml\001\000\210\001\026\178\001\026\202\192\004\002\001\000\210\001\026\178\001\026\219@@\176\004\004\192\004\004\001\000\210\001\026\178\001\026\228@\192B@@@\176*new_engine\144\160\160C@@@\176*sub_lexeme\144\160\160C@@@\176+flush_input\144\160\160A@@@\176+from_string\144\160\160A@@@\176+lexeme_char\144\160\160B@@@\176,lexeme_end_p\144\160\160A@@\144\148\192A\160\176\001\004D&lexbuf@@\151\176\161K\160\0042A\160\144\004\b@\176\192\0041\001\000\213\001\027\021\001\027/\192\0042\001\000\213\001\027\021\001\027@@\192B@@@\176,lexeme_start\144\160\160A@@\144\148\192A\160\176\001\004>&lexbuf@@\151\176\161C\160\004M@\160\151\176\161J\160+lex_start_pA\160\144\004\014@\176\192\004L\001\000\209\001\026|\001\026\150\192\004M\001\000\209\001\026|\001\026\168@@\176\004\003\192\004O\001\000\209\001\026|\001\026\177@\192B@@@\176-from_function\144\160\160A@@@\176.lexeme_start_p\144\160\160A@@\144\148\192A\160\176\001\004B&lexbuf@@\151\176\161J\160\004\029A\160\144\004\b@\176\192\004h\001\000\212\001\026\230\001\027\002\192\004i\001\000\212\001\026\230\001\027\020@\192B@@@\176.sub_lexeme_opt\144\160\160C@@@\176/sub_lexeme_char\144\160\160B@@\144\148\192B\160\176\001\0045&lexbuf@\160\176\001\0046!i@@\151\176d\160\151\176\161A\160*lex_bufferA\160\144\004\015@\176\192\004\137\001\000\197\001\025z\001\025\163\192\004\138\001\000\197\001\025z\001\025\180@\160\144\004\017@\176\192\004\142\001\000\197\001\025z\001\025\153\192\004\143\001\000\197\001\025z\001\025\182@\192B@@@\1763sub_lexeme_char_opt\144\160\160B@@@A",

jscomp/ml/predef.ml

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,22 @@ and ident_string = ident_create "string"
4646
and ident_extension_constructor = ident_create "extension_constructor"
4747
and ident_floatarray = ident_create "floatarray"
4848

49+
and ident_unknown = ident_create "unknown"
50+
4951
type test =
5052
| For_sure_yes
5153
| For_sure_no
5254
| NA
5355

5456
let type_is_builtin_path_but_option (p : Path.t) : test =
5557
match p with
56-
| Pident {Ident.stamp} ->
58+
| Pident {stamp} ->
5759
if
58-
stamp >= ident_int.Ident.stamp
59-
&& stamp <= ident_floatarray.Ident.stamp
60+
stamp >= ident_int.stamp
61+
&& stamp <= ident_floatarray.stamp
6062
then
61-
if (stamp = ident_option.Ident.stamp)
62-
|| (stamp = ident_unit.Ident.stamp) then
63+
if (stamp = ident_option.stamp)
64+
|| (stamp = ident_unit.stamp) then
6365
For_sure_no
6466
else For_sure_yes
6567
else NA
@@ -80,6 +82,8 @@ and path_option = Pident ident_option
8082
and path_int64 = Pident ident_int64
8183
and path_lazy_t = Pident ident_lazy_t
8284
and path_string = Pident ident_string
85+
86+
and path_unkonwn = Pident ident_unknown
8387
and path_extension_constructor = Pident ident_extension_constructor
8488
and path_floatarray = Pident ident_floatarray
8589

@@ -98,35 +102,36 @@ and type_option t = newgenty (Tconstr(path_option, [t], ref Mnil))
98102
and type_int64 = newgenty (Tconstr(path_int64, [], ref Mnil))
99103
and type_lazy_t t = newgenty (Tconstr(path_lazy_t, [t], ref Mnil))
100104
and type_string = newgenty (Tconstr(path_string, [], ref Mnil))
105+
106+
and type_unknown = newgenty (Tconstr(path_unkonwn, [], ref Mnil))
101107
and type_extension_constructor =
102108
newgenty (Tconstr(path_extension_constructor, [], ref Mnil))
103109
and type_floatarray = newgenty (Tconstr(path_floatarray, [], ref Mnil))
104110

105111
let ident_match_failure = ident_create_predef_exn "Match_failure"
106-
and ident_out_of_memory = ident_create_predef_exn "Out_of_memory"
112+
107113
and ident_invalid_argument = ident_create_predef_exn "Invalid_argument"
108114
and ident_failure = ident_create_predef_exn "Failure"
115+
116+
and ident_js_error = ident_create_predef_exn "JsError"
109117
and ident_not_found = ident_create_predef_exn "Not_found"
110-
and ident_sys_error = ident_create_predef_exn "Sys_error"
118+
111119
and ident_end_of_file = ident_create_predef_exn "End_of_file"
112120
and ident_division_by_zero = ident_create_predef_exn "Division_by_zero"
113-
and ident_stack_overflow = ident_create_predef_exn "Stack_overflow"
114-
and ident_sys_blocked_io = ident_create_predef_exn "Sys_blocked_io"
121+
122+
115123
and ident_assert_failure = ident_create_predef_exn "Assert_failure"
116124
and ident_undefined_recursive_module =
117125
ident_create_predef_exn "Undefined_recursive_module"
118126

119127
let all_predef_exns = [
120128
ident_match_failure;
121-
ident_out_of_memory;
122129
ident_invalid_argument;
123130
ident_failure;
131+
ident_js_error;
124132
ident_not_found;
125-
ident_sys_error;
126133
ident_end_of_file;
127134
ident_division_by_zero;
128-
ident_stack_overflow;
129-
ident_sys_blocked_io;
130135
ident_assert_failure;
131136
ident_undefined_recursive_module;
132137
]
@@ -167,6 +172,8 @@ and ident_nil = ident_create "[]"
167172
and ident_cons = ident_create "::"
168173
and ident_none = ident_create "None"
169174
and ident_some = ident_create "Some"
175+
176+
and ident_ctor_unknown = ident_create "Unknown"
170177
let common_initial_env add_type add_extension empty_env =
171178
let decl_bool =
172179
{decl_abstr with
@@ -200,6 +207,20 @@ let common_initial_env add_type add_extension empty_env =
200207
type_arity = 1;
201208
type_kind = Type_variant([cstr ident_none []; cstr ident_some [tvar]]);
202209
type_variance = [Variance.covariant]}
210+
and decl_unknown =
211+
let tvar = newgenvar () in
212+
{decl_abstr with
213+
type_params = [];
214+
type_arity = 0;
215+
type_kind = Type_variant ([ {
216+
cd_id = ident_ctor_unknown;
217+
cd_args = Cstr_tuple [tvar];
218+
cd_res = Some type_unknown;
219+
cd_loc = Location.none;
220+
cd_attributes = []
221+
}]);
222+
type_unboxed = Types.unboxed_true_default_false
223+
}
203224
and decl_lazy_t =
204225
let tvar = newgenvar() in
205226
{decl_abstr with
@@ -222,13 +243,10 @@ let common_initial_env add_type add_extension empty_env =
222243
in
223244
add_extension ident_match_failure
224245
[newgenty (Ttuple[type_string; type_int; type_int])] (
225-
add_extension ident_out_of_memory [] (
226-
add_extension ident_stack_overflow [] (
227246
add_extension ident_invalid_argument [type_string] (
247+
add_extension ident_js_error [type_unknown] (
228248
add_extension ident_failure [type_string] (
229249
add_extension ident_not_found [] (
230-
add_extension ident_sys_blocked_io [] (
231-
add_extension ident_sys_error [type_string] (
232250
add_extension ident_end_of_file [] (
233251
add_extension ident_division_by_zero [] (
234252
add_extension ident_assert_failure
@@ -245,11 +263,12 @@ let common_initial_env add_type add_extension empty_env =
245263
add_type ident_unit decl_unit (
246264
add_type ident_bool decl_bool (
247265
add_type ident_float decl_abstr (
266+
add_type ident_unknown decl_unknown(
248267
add_type ident_string decl_abstr (
249268
add_type ident_int decl_abstr_imm (
250269
add_type ident_extension_constructor decl_abstr (
251270
add_type ident_floatarray decl_abstr (
252-
empty_env)))))))))))))))))))))))))
271+
empty_env)))))))))))))))))))))))
253272

254273
let build_initial_env add_type add_exception empty_env =
255274
let common = common_initial_env add_type add_exception empty_env in
@@ -263,10 +282,10 @@ let build_initial_env add_type add_exception empty_env =
263282

264283
let builtin_values =
265284
List.map (fun id -> Ident.make_global id; (Ident.name id, id))
266-
[ident_match_failure; ident_out_of_memory; ident_stack_overflow;
285+
[ident_match_failure;
267286
ident_invalid_argument;
268-
ident_failure; ident_not_found; ident_sys_error; ident_end_of_file;
269-
ident_division_by_zero; ident_sys_blocked_io;
287+
ident_failure; ident_js_error; ident_not_found; ident_end_of_file;
288+
ident_division_by_zero;
270289
ident_assert_failure; ident_undefined_recursive_module ]
271290

272291
(* Start non-predef identifiers at 1000. This way, more predefs can

jscomp/others/js_exn.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

2525

26-
type t = Caml_js_exceptions.t
26+
type t = unknown
2727

2828
[@@@warning "-38"] (* unused extension constructor*)
29-
exception Error = Caml_js_exceptions.Error
29+
exception Error = JsError
3030

3131
external asJsExn : exn -> t option =
3232
"?as_js_exn"
@@ -45,8 +45,7 @@ external makeError : string -> error = "Error" [@@bs.new]
4545
external isCamlExceptionOrOpenVariant :
4646
'a -> bool = "?is_extension"
4747

48-
let anyToExnInternal x =
49-
Caml_js_exceptions.internalToOCamlException (Obj.repr x)
48+
external anyToExnInternal : 'a -> exn = "#wrap_exn"
5049

5150

5251
let raiseError str =

jscomp/others/js_exn.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ external isCamlExceptionOrOpenVariant:
4343
'a -> bool = "?is_extension"
4444
(** internal use only *)
4545

46-
val anyToExnInternal: 'a -> exn
46+
external anyToExnInternal : 'a -> exn = "#wrap_exn"
4747
(**
4848
`anyToExnInternal obj` will take any value `obj` and wrap it
4949
in a Js.Exn.Error if given value is not an exn already. If

jscomp/runtime/caml_js_exceptions.ml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,40 @@
1+
(* Copyright (C) 2015- Hongbo Zhang, Authors of ReScript
2+
*
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU Lesser General Public License as published by
5+
* the Free Software Foundation, either version 3 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* In addition to the permissions granted to you by the LGPL, you may combine
9+
* or link a "work that uses the Library" with a publicly distributed version
10+
* of this file to produce a combined library or application, then distribute
11+
* that combined work under the terms of your choosing, with no requirement
12+
* to comply with the obligations normally placed on you by section 4 of the
13+
* LGPL version 3 (or the corresponding section of a later version of the LGPL
14+
* should you choose to use a later version).
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Lesser General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU Lesser General Public License
22+
* along with this program; if not, write to the Free Software
23+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
124

225

3-
type t =
4-
| Any : 'a -> t [@@unboxed]
526

6-
exception Error of t
27+
exception Error = JsError
728

829

930
(**
1031
This function has to be in this module Since
1132
[Error] is defined here
1233
*)
13-
let internalToOCamlException (e : Obj.t) =
34+
let internalToOCamlException (e : unknown) =
1435
if Caml_exceptions.is_extension e then
1536
(Obj.magic e : exn)
16-
else Error (Any e)
37+
else JsError ( e)
1738

1839
let as_js_exn exn =
1940
match exn with

jscomp/stdlib-406/printexc.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ let to_string x =
4949
| None -> conv tl)
5050
| [] ->
5151
match x with
52-
| Out_of_memory -> "Out of memory"
53-
| Stack_overflow -> "Stack overflow"
5452
| Match_failure(file, line, char) ->
5553
locfmt file line char (char+5) "Pattern matching failed"
5654
| Assert_failure(file, line, char) ->

jscomp/test/build.ninja

Lines changed: 2 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)