Continue label incorrectly allowed to be a non-IterationStatement label
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 773
- PR merge metrics
- No merged PRs in 30d
Description
Filed by @michaelficarra previously as issue 450.
What steps will reproduce the problem?
Attempt to parse for(;;){ a: continue a; }.
What is the expected output?
The parse should fail to parse the program.
What do you see instead?
The parser allows the illegal continue.
What version of the product are you using? On what operating system? Which browser?
esprima master on node v0.10.15
Please provide any additional information below.
See ES5 section 12.7, specifically "A program is considered syntactically incorrect if [...] The program contains a continue statement with the optional Identifier, where Identifier does not appear in the label set of an enclosing (but not crossing function boundaries) IterationStatement.", as opposed to section 12.8 (break) which states "A program is considered syntactically incorrect if [...] The program contains a break statement with the optional Identifier, where Identifier does not appear in the label set of an enclosing (but not crossing function boundaries) Statement.", emphasis mine.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the parser behavior with for(;;){ a: continue a; } and inspect the parsing path for labeled continue statements. Done means the parser rejects this program while preserving the distinct label rules for continue and break described in ES5 sections 12.7 and 12.8.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100