-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Parser analysis and errors for labelled statements, break, continue, return #215
Conversation
|
||
Debug.assert(inIterationStatement === ControlBlockContext.CrossingFunctionBoundary | ||
|| inSwitchStatement === ControlBlockContext.CrossingFunctionBoundary); | ||
grammarErrorAtPos(errorStart, errorLength, Diagnostics.Jump_target_cannot_cross_function_boundary); |
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.
i'd honestly prefer this was just repeated and htere was no fallthrough above. but up to you.
return ControlBlockContext.NotNested; | ||
} | ||
|
||
// TODO(jfreeman): Fill in these stubs |
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.
Remember to get rid of this now.
👍 after feedback is addressed. |
Conflicts: src/compiler/diagnosticInformationMap.generated.ts src/compiler/diagnosticMessages.json src/compiler/parser.ts
Parser analysis and errors for labelled statements, break, continue, return
This pull request covers a couple of things:
I've added a state machine to track labelled statements. It has a current label set for the labels being accumulated, as well as a stack for label sets of enclosing statements. It also tracks whether the enclosing labelled statements are iteration statements or not, because continue statements can only jump to iteration statements.