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

labeled block support #2243

Closed
SheetJSDev opened this issue Aug 18, 2022 · 2 comments
Closed

labeled block support #2243

SheetJSDev opened this issue Aug 18, 2022 · 2 comments
Labels
bug Something isn't working enhancement New feature or request vm Issues and PRs related to the Boa Virtual Machine.
Milestone

Comments

@SheetJSDev
Copy link

The following example is from MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label#using_a_labeled_block_with_break

You can use labels within simple blocks, but only break statements can make use of non-loop labels.

foo: {
  console.log('face');
  break foo;
  console.log('this will not be executed');
}
console.log('swap');

// this will log:

// "face"
// "swap"

Saving that to a file and testing with cargo run -- test.js prints the error

Uncaught "SyntaxError": "Cannot use the undeclared label 'foo'"
@SheetJSDev SheetJSDev added the bug Something isn't working label Aug 18, 2022
@meirochun
Copy link

meirochun commented Aug 20, 2022

Looks like this bug already in execution since Feb 23. #1852
And it was already expected, it's on PR's describe.

@jedel1043 jedel1043 added enhancement New feature or request bug Something isn't working and removed bug Something isn't working enhancement New feature or request labels Aug 22, 2022
@Razican
Copy link
Member

Razican commented Sep 7, 2022

This might be related to the fact that we don't use completion records. We only check for labels on loops, afaik, instead of on "any labeled statement", which should be the case. But we also don't have the notion of a "labeled statement" I think.

@jedel1043 jedel1043 added enhancement New feature or request vm Issues and PRs related to the Boa Virtual Machine. labels Sep 16, 2022
@jedel1043 jedel1043 added this to the v0.16.0 milestone Sep 16, 2022
@jedel1043 jedel1043 linked a pull request Sep 16, 2022 that will close this issue
@Razican Razican closed this as completed Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request vm Issues and PRs related to the Boa Virtual Machine.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants