Skip to content

Commit 3613522

Browse files
committed
tweak
1 parent 2b3970b commit 3613522

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

jscomp/core/lam_compile.ml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ let change_tail_type_in_try
7979
Maybe_tail_is_return Tail_in_try
8080
| Not_tail | Maybe_tail_is_return Tail_in_try
8181
-> x
82+
let in_staticcatch (x : Lam_compile_context.tail_type)
83+
: Lam_compile_context.tail_type =
84+
match x with
85+
| Maybe_tail_is_return (Tail_with_name ({in_staticcatch = false} as x))
86+
->
87+
Maybe_tail_is_return (Tail_with_name ({ x with in_staticcatch = true}))
88+
| _ -> x
8289

8390
(* let change_tail_type_in_static
8491
(x : Lam_compile_context.tail_type)
@@ -745,7 +752,7 @@ and compile_staticcatch (lam : Lam.t) (lambda_cxt : Lam_compile_context.t)=
745752
let code_table, body = flatten_nested_caches lam in
746753
let exit_id = Ext_ident.create_tmp ~name:"exit" () in
747754
match lambda_cxt.continuation, code_table with
748-
| EffectCall (Maybe_tail_is_return (Tail_with_name ({in_staticcatch = false} as z))),
755+
| EffectCall (Maybe_tail_is_return (Tail_with_name ({in_staticcatch = false} )) as tail_type),
749756
[ code_table ]
750757
(* tail position and only one exit code *)
751758
when Lam_compile_context.no_static_raise_in_handler code_table
@@ -758,7 +765,7 @@ and compile_staticcatch (lam : Lam.t) (lambda_cxt : Lam_compile_context.t)=
758765
{lambda_cxt with
759766
jmp_table = jmp_table ;
760767
continuation =
761-
EffectCall (Maybe_tail_is_return (Tail_with_name { z with in_staticcatch = true}))
768+
EffectCall (in_staticcatch tail_type)
762769
} in
763770

764771
let lbody = compile_lambda new_cxt body in

0 commit comments

Comments
 (0)