Skip to content

Fix this binding in arrow functions in classes #237

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

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

SarahIsWeird
Copy link
Contributor

This fixes #236. I'm not sure if there are other weird edge cases this misses, though.

function(c, a) {
  class MyClass extends Object {
    constructor() {
      let _0o2iruz6j10_THIS_ = super()
      _0o2iruz6j10_THIS_.number = 2
    }
    foo() {
      let _0o2iruz6j10_THIS_ = super.valueOf()
      return [1, 2, 3].filter(n => n == _0o2iruz6j10_THIS_.number)
    }
  }
  return new MyClass()
}

@samualtnorman samualtnorman merged commit 6eb310a into samualtnorman:main Jan 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arrow functions in classes do not bind this
2 participants