Skip to content

Commit 8a28daf

Browse files
DZakhcristianoc
authored andcommitted
Revert unrelated changes
1 parent f1432ad commit 8a28daf

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

jscomp/ml/matching.ml

+12-8
Original file line numberDiff line numberDiff line change
@@ -2299,19 +2299,23 @@ let combine_constructor sw_names loc arg ex_pat cstr partial ctx def
22992299
| None ->
23002300
begin match extension_cases with
23012301
| (_, act)::rem -> act, rem
2302-
| _ -> failwith "Empty extension case list is not possible"
2302+
| _ -> assert false
23032303
end
23042304
| Some fail -> fail, extension_cases in
23052305
match extension_cases with
23062306
| [] -> default
23072307
| _ ->
2308-
List.fold_right
2309-
(fun (path, act) rem ->
2310-
let ext = transl_extension_path ex_pat.pat_env path in
2311-
Lifthenelse(Lprim(extension_slot_eq , [arg; ext], loc),
2312-
act, rem))
2313-
extension_cases
2314-
default
2308+
let tag = Ident.create "tag" in
2309+
let tests =
2310+
List.fold_right
2311+
(fun (path, act) rem ->
2312+
let ext = transl_extension_path ex_pat.pat_env path in
2313+
Lifthenelse(Lprim(extension_slot_eq , [Lvar tag; ext], loc),
2314+
act, rem))
2315+
extension_cases
2316+
default
2317+
in
2318+
Llet(Alias, Pgenval,tag, arg, tests)
23152319
in
23162320
lambda1, jumps_union local_jumps total1
23172321
end else begin

jscomp/ml/predef.ml

+12
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ and ident_assert_failure = ident_create_predef_exn "Assert_failure"
140140
and ident_undefined_recursive_module =
141141
ident_create_predef_exn "Undefined_recursive_module"
142142

143+
let all_predef_exns = [
144+
ident_match_failure;
145+
ident_invalid_argument;
146+
ident_failure;
147+
ident_js_error;
148+
ident_not_found;
149+
ident_end_of_file;
150+
ident_division_by_zero;
151+
ident_assert_failure;
152+
ident_undefined_recursive_module;
153+
]
154+
143155
let path_match_failure = Pident ident_match_failure
144156
and path_assert_failure = Pident ident_assert_failure
145157
and path_undefined_recursive_module = Pident ident_undefined_recursive_module

jscomp/ml/predef.mli

+7
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ val build_initial_env:
7777
val builtin_values: (string * Ident.t) list
7878
val builtin_idents: (string * Ident.t) list
7979

80+
(** All predefined exceptions, exposed as [Ident.t] for flambda (for
81+
building value approximations).
82+
The [Ident.t] for division by zero is also exported explicitly
83+
so flambda can generate code to raise it. *)
84+
val ident_division_by_zero: Ident.t
85+
val all_predef_exns : Ident.t list
86+
8087
type test =
8188
| For_sure_yes
8289
| For_sure_no

0 commit comments

Comments
 (0)