Skip to content

When for loop has a label at beginning, break does not work correctly #275

@wch

Description

@wch

Consider the following code

for (var i=0; i<4; i++)
label: {
  console.log(i);
  if (i === 1) {
    console.log("break");
    break;
  }
}

When I run this code in Safari, Firefox, Chrome, or V8's d8 console, they print out:

0
1
break

However, with qjs, it prints:

0
1
break
2
3

For context, I'm encountering this problem with some code generated from compiling Dart Sass to JS: sass/dart-sass#2212

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions