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

Access super member in nested expr transform incorrect #1959

Closed
IronLu233 opened this issue Jul 23, 2021 · 1 comment · Fixed by #1960
Closed

Access super member in nested expr transform incorrect #1959

IronLu233 opened this issue Jul 23, 2021 · 1 comment · Fixed by #1960
Labels
Milestone

Comments

@IronLu233
Copy link
Contributor

Describe the bug

transform super.foo() + 1 will become _get(_getPrototypeOf(Extended.prototype), 'getNext', this)() + 1
Input code
class Base {
getNext() {
return this.value++
}
}

class Extended extends Base {
getNext() {
return super.getNext() + 1
}
}

const ins = new Extended();
ins.getNext();

Config

{
  "module": {
    "type": "commonjs"
  }
}

Expected behavior

should invoke super class member's function with call

 _get(_getPrototypeOf(Extended.prototype), "getNext", this).call(this) + 1;

Version
The version of @swc/core: 1.2.66

Additional context

the code above will emit an error:

TypeError: Cannot read property 'value' of undefined
@swc-bot
Copy link
Collaborator

swc-bot commented Oct 23, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 participants