jashkenas / jashkenas/coffeescript
Bug: Loop control statements are allowed where they are invalid
Open
Nobody has claimed this yet.
- Dominant language
- CoffeeScript
- Stars
- 16.6k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
Input Code
continue
break
for item in iterable then do (item) ->
if await item
continue
else
break
Expected Behavior
Compile Error: Unexpected token
Current Behavior
continue;
break;
var i, item, len;
for (i = 0, len = iterable.length; i < len; i++) {
item = iterable[i];
(async function(item) {
if ((await item)) {
continue;
} else {
break;
}
})(item);
}
Context
The current output is invalid javascript.
Environment
- CoffeeScript: v2.5.1
- Node.js: v14.13.0
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
Use the provided CoffeeScript snippet as the reproduction case and inspect the compiler path that accepts the top-level and nested continue and break statements. Completion means compilation rejects these invalid statements with an "Unexpected token" error instead of emitting invalid JavaScript.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- coffeescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100