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

[Call] Usage of "this" in methods is not supported #511

Closed
croraf opened this issue Jun 18, 2020 · 2 comments · Fixed by #526
Closed

[Call] Usage of "this" in methods is not supported #511

croraf opened this issue Jun 18, 2020 · 2 comments · Fixed by #526
Assignees
Labels
bug Something isn't working
Milestone

Comments

@croraf
Copy link
Contributor

croraf commented Jun 18, 2020

Describe the bug

const foo = {
  a: 3,
  bar: function () {return this.a + 5}
};

foo.bar()

should return 8. Instead thread 'main' panicked at 'Reference Error: Unitialised binding for this function', boa/src/environment/function_environment_record.rs:115:17 happens

@croraf croraf added the bug Something isn't working label Jun 18, 2020
@jasonwilliams jasonwilliams self-assigned this Jun 22, 2020
@jasonwilliams
Copy link
Member

jasonwilliams commented Jun 22, 2020

Looks like the binding status is defauting to uninitialized, changing to initialized will work https://github.com/boa-dev/boa/blob/master/boa/src/builtins/function/mod.rs#L196 but we probably want to pass that value in, as we don't know at that point whether we're in an arrow function or not

@jasonwilliams
Copy link
Member

There's a fix for this in #526

@Razican Razican added this to the v0.9.0 milestone Sep 2, 2020
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

Successfully merging a pull request may close this issue.

3 participants