-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Improve error recovery in top level statements #81604
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
base: main
Are you sure you want to change the base?
Conversation
| var state = _termState; | ||
| _termState |= TerminatorState.IsPossibleStatementStartOrStop; | ||
| var topLevelStatement = ParseLocalDeclarationStatement(attributes); | ||
| _termState = state; |
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.
note: this also follows the logic in tryParseStatement below. This was just missed when the global code parser decides to specifically only parse out a localdecl statement, not any arbitrary statement.
| void C() { } | ||
| } | ||
| } | ||
| """; |
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.
this didn't change at all. just adding an explicit test showing the behavior when we are not at the top level.
| } | ||
| N(SyntaxKind.GlobalStatement); | ||
| { | ||
| N(SyntaxKind.LocalFunctionStatement); |
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.
this changed. we would previously not get this, and instead end up with most of what followed becoming skipped tokens on the 'C'.
Fixes #72077