-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix bad jump from yield break inside catch in async-iterator #80927
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
Conversation
| tryBlock: F.Block(node.TryBlock, F.Label(finallyEntry)), | ||
| node.CatchBlocks, node.FinallyBlockOpt, node.FinallyLabelOpt, node.PreferFaultHandler); | ||
| tryEnd = F.GenerateLabel("tryEnd"); | ||
| _currentDisposalLabel = tryEnd; |
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.
According to documentation for _currentDisposalLabel: " Inside a try or catch with a finally, we'll use the label directly preceding the finally." This is no longer accurate. Please adjust documentation accordingly, perhaps also explaining why placing the label there gives us the right control flow. #Closed
| public override BoundNode VisitTryStatement(BoundTryStatement node) | ||
| { | ||
| var savedDisposalLabel = _currentDisposalLabel; | ||
| LabelSymbol tryEnd = null; |
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 (tryEnd != null) | ||
| { | ||
| // Append a label at the end of the `try`, which disposal within `try` can jump to to execute the `finally` (if any): |
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 (tryEnd != null) | ||
| { | ||
| // Append a label at the end of the `try`, which disposal within `try` can jump to to execute the `finally` (if any): |
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.
// Append a label at the end of the
try, which disposal withintrycan jump to to execute thefinally(if any):
Consider making the comment clearer. Something like: "Append a label immediately after the try-catch-finally statement, which disposal within try/catch blocks jumps to with a goal to pass control flow to the finally block" implicitly" #Closed
|
Done with review pass (commit 2) #Closed |
AlekseyTs
left a comment
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.
LGTM (commit 3)
Fixes #79124
The problem is that given the following code:
We'd lower to a tree like this (output from
DumpSource()with some formatting/cleanups):The fix is to move the label after the
try(output fromDumpSource()):