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

Support for "unsafe" cases of finally #7

Open
playXE opened this issue Feb 21, 2021 · 1 comment · May be fixed by #60
Open

Support for "unsafe" cases of finally #7

playXE opened this issue Feb 21, 2021 · 1 comment · May be fixed by #60
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@playXE
Copy link
Collaborator

playXE commented Feb 21, 2021

Starlight needs support for code like this:

function foo() {
  try {
      return 1;
  } finally {
      return 2;
  }
}

Right now it returns 1 but should return 2.

MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch#the_finally-block

@playXE playXE added the help wanted Extra attention is needed label Feb 21, 2021
@playXE
Copy link
Collaborator Author

playXE commented Feb 21, 2021

Problem with implementing it is we down break and continue to single jumps which means finally can't be executed correctly and return is lowered to OP_RET which instantly returns, there could be one way to just jump to finally block on continue,break and return but this will not work as expected.

@jameslahm jameslahm linked a pull request Jun 30, 2021 that will close this issue
@jameslahm jameslahm self-assigned this Jul 20, 2021
@jameslahm jameslahm added the bug Something isn't working label Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants