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

Bug: super method call within async arrow within class method fails #31

Open
developit opened this issue May 27, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@developit
Copy link
Member

The async-arrows-in-class transform uses Babel's arrowFunctionToExpression() helper, which doesn't patch calls to super methods:

Input:Output:
class A extends B {
  a() {
    (async () => {
      super.b();
    })();
  }
}
class A extends B {
  a() {
    (async function () {
      super.b();  // this is invalid
    })();
  }
}

Here's the bug reproduced in the Babel repl.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented May 27, 2021

I'd consider this a bug in arrowFunctionToExpression itself rather than in this plugin.

EDIT: Ok no, the fix relies on injecting new sync arrow functions so if cannot be done in arrowFunctionToExpression. I think we have something like hoistFunctionEnvironment somewhere that will help.

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

No branches or pull requests

2 participants