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

Allow BindingPattern as CatchParameter #1600

Closed
raskad opened this issue Sep 29, 2021 · 3 comments · Fixed by #1628
Closed

Allow BindingPattern as CatchParameter #1600

raskad opened this issue Sep 29, 2021 · 3 comments · Fixed by #1628
Assignees
Labels
E-Medium Medium difficulty problem enhancement New feature or request good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com parser Issues surrounding the parser
Milestone

Comments

@raskad
Copy link
Member

raskad commented Sep 29, 2021

ECMASCript feature
Currently we only allow BindingIdentifiers in the CatchParameter of the try...catch statement. BindingPatterns should be also allowed.

ECMAScript specification

Example code
This code should work and give the expected result:

try {
  throw { a: 1, b: 2 }
} catch ({ a, b }) {
  console.log(a, b)
}
// prints `1 2`

Good starting points would be the catch parsing in https://github.com/boa-dev/boa/blob/master/boa/src/syntax/parser/statement/try_stm/catch.rs and the BindingPattern parsing in https://github.com/boa-dev/boa/blob/master/boa/src/syntax/parser/statement/mod.rs

@raskad raskad added enhancement New feature or request good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com parser Issues surrounding the parser E-Medium Medium difficulty problem labels Sep 29, 2021
@am-a-man
Copy link
Contributor

am-a-man commented Oct 1, 2021

hey,
I'd like to work on this, please assign this to me.

@lowr
Copy link
Contributor

lowr commented Oct 2, 2021

Hi, I saw comments at #1601, and looks like this issue hasn't been taken yet. I'd like to give it a shot!

@jedel1043
Copy link
Member

@lowr Please do! I've assigned it to you, let us know if you have any questions or if you need any pointers to get started 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-Medium Medium difficulty problem enhancement New feature or request good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com parser Issues surrounding the parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants