-
Notifications
You must be signed in to change notification settings - Fork 12.8k
fix flow in finally blocks #11675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix flow in finally blocks #11675
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except for a couple of typos
// console.log(2); // this line should be unreachable even if flow falls out of finally block | ||
if (!(currentFlow.flags & FlowFlags.Unreachable)) { | ||
if ((flowAfterTry.flags & FlowFlags.Unreachable) && (flowAfterCatch.flags & FlowFlags.Unreachable)) { | ||
currentFlow = flowAfterTry == reportedUnreachableFlow || flowAfterCatch === reportedUnreachableFlow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: ==
not ===
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
} | ||
if (node.finallyBlock) { | ||
currentFlow = preTryFlow; | ||
// in finally flow is combined from pre-try/flow from try/flow from catch | ||
// pre-flow is necessary to make sure that finally is reachable even if finaly flows in both try and finally blocks are unreachable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo:finaly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
fixes #11665.
Make initial flow in finally block a combination from start flow in
try
, final flow intry
and final flow incatch
blocks