coffeescript icon indicating copy to clipboard operation
coffeescript copied to clipboard

Bug: Loop control statements are allowed where they are invalid

Open Inve1951 opened this issue 3 years ago • 0 comments

Input Code

#try

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

Inve1951 avatar Oct 10 '20 18:10 Inve1951