Bug: super method call within async arrow within class method fails
developit opened this issue · comments
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.
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.