Skip to content

Breaks and labels interact incorrectly #741

Closed
@WardBrian

Description

@WardBrian

This is essentially me duplicating bellard/quickjs#275 here, since it seems to still affect quickjs-ng:

./qjs-linux-x86_64 -e 'for (var i=0; i<4; i++)
label: {
  console.log(i);
  if (i === 1) {
    console.log("break");
    break;
  }
}'

prints

0
1
break
2
3

When the expected output does not print 2 or 3.

In particular, this seems to be an issue when using quickjs with code created the js_of_ocaml Ocaml->JS compiler, as this has moved to heavy use of labels and break statements for ocsigen/js_of_ocaml#1496

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions