Skip to content

Commit bf0a070

Browse files
committed
minor tweaks, ready for merge
1 parent f4a03b9 commit bf0a070

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

jscomp/core/lam_compile.ml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,17 @@ and compile_general_cases
501501
(** see #2413
502502
In general, we know it is last call,
503503
there is no need to print [break];
504-
there is an exception when two conditions meet:
505-
- should_break does not imply
506-
There is one case (tailcall)
507-
where [should_break] inferred false while our
508-
exit engine could not infer
509-
- has_exit
504+
But we need make sure the last call lambda does not
505+
have `(exit ..)` due to we pass should_return from Lstaticcath downwards
506+
Since this is a rough approximation, some `(exit ..)` does not destroy
507+
last call property, we use exiting should_break to improve preciseness
508+
(and it indeed help catch more cases)
509+
510+
- tailcall or not does not matter, if it is the tailcall
511+
break still should not be printed (it will be continuned)
510512
*)
511-
should_break && (Lam_exit_code.has_exit lam)
513+
should_break &&
514+
(Lam_exit_code.has_exit lam)
512515
in
513516
{J.switch_case ;
514517
switch_body = switch_block, should_break

lib/whole_compiler.ml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97880,12 +97880,17 @@ and compile_general_cases
9788097880
(** see #2413
9788197881
In general, we know it is last call,
9788297882
there is no need to print [break];
97883-
there is an exception when two conditions meet:
97884-
- should_break does not imply
97885-
There is one case
97886-
where [should_break]for [tailcall], we get [should_break = false]
97883+
But we need make sure the last call lambda does not
97884+
have `(exit ..)` due to we pass should_return from Lstaticcath downwards
97885+
Since this is a rough approximation, some `(exit ..)` does not destroy
97886+
last call property, we use exiting should_break to improve preciseness
97887+
(and it indeed help catch more cases)
97888+
97889+
- tailcall or not does not matter, if it is the tailcall
97890+
break still should not be printed (it will be continuned)
9788797891
*)
97888-
should_break && (Lam_exit_code.has_exit lam)
97892+
should_break &&
97893+
(Lam_exit_code.has_exit lam)
9788997894
in
9789097895
{J.switch_case ;
9789197896
switch_body = switch_block, should_break

0 commit comments

Comments
 (0)