Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibJS/Bytecode: break and continue should run finalizers between them and the target loop #13761

Open
Lubrsi opened this issue Apr 20, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@Lubrsi
Copy link
Member

Lubrsi commented Apr 20, 2022

For example, this should print hello and world, but doesn't print anything as the break jumps straight to the end:

for (;;) {
  try {
    try {
      break;
    } finally {
      console.log("hello");
    }
  } finally {
    console.log("world");
  }
}

Same for continue, which jumps straight to the update block of the for loop:

for (var i = 0; i < 1; i++) {
  try {
    try {
      continue;
    } finally {
      console.log("hello");
    }
  } finally {
    console.log("world");
  }
}

While not currently supported, this is also true for labelled continue and break:

outer: for (;;) {
  try {
    for (;;) {
      try {
        break outer;
      } finally {
        console.log("hello");
      }
    }
  } finally {
    console.log("world");
  }
}
outer: for (var i = 0; i < 1; i++) {
  try {
    for (;;) {
      try {
        continue outer;
      } finally {
        console.log("hello");
      }
    }
  } finally {
    console.log("world");
  }
}
@Lubrsi Lubrsi added the bug Something isn't working label Apr 20, 2022
@Lubrsi Lubrsi changed the title LibJS/Bytecode: break and continue should run finalizers between the break and the loop LibJS/Bytecode: break and continue should run finalizers between them and the loop Apr 20, 2022
@Lubrsi Lubrsi changed the title LibJS/Bytecode: break and continue should run finalizers between them and the loop LibJS/Bytecode: break and continue should run finalizers between them and the target loop Apr 20, 2022
@ammarbinfaisal
Copy link
Contributor

This seems the be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants