Skip to content

Parser analysis and errors for labelled statements, break, continue, return - #215

Merged
Jason Freeman (JsonFreeman) merged 8 commits into
masterfrom
labelledStatements
Jul 25, 2014
Merged

Jason Freeman (JsonFreeman) merged 8 commits into
masterfrom
labelledStatements

Conversation

@JsonFreeman

Copy link
Copy Markdown
Contributor

This pull request covers a couple of things:

  1. Make sure break, continue, return statements are nested in the right control context
  2. Keeping track of labels and making sure jump targets are correct.
  3. Checking for duplicate labels

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.

Comment thread src/compiler/parser.ts Outdated

Copy link
Copy Markdown
Contributor

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.

Comment thread src/compiler/parser.ts Outdated

Copy link
Copy Markdown
Member

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.

@DanielRosenwasser

Copy link
Copy Markdown
Member

👍 after feedback is addressed.

Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/compiler/parser.ts
Jason Freeman (JsonFreeman) added a commit that referenced this pull request Jul 25, 2014
Parser analysis and errors for labelled statements, break, continue, return
@JsonFreeman
Jason Freeman (JsonFreeman) deleted the labelledStatements branch July 25, 2014 00:52
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants