Bug: super method call within async arrow within class method fails
- Dominant language
- JavaScript
- Stars
- 739
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
The async-arrows-in-class transform [uses Babel's arrowFunctionToExpression() helper](https://github.com/babel/preset-modules/blob/6155d0ddd2ba47d1d325659989e80e8a659d0e13/src/plugins/transform-async-arrows-in-class/index.js#L31), which doesn't patch calls to super methods:
Input:Output:
```js
class A extends B {
a() {
(async () => {
super.b();
})();
}
}
```
```js
class A extends B {
a() {
(async function () {
super.b(); // this is invalid
})();
}
}
```
Here's the bug [reproduced in the Babel repl](https://babeljs.io/repl#?browsers=edge%3E%3D16%2Csafari%3E%3D10.1&build=&builtIns=false&corejs=3.6&spec=false&loose=true&code_lz=MYGwhgzhAEBiD29oFMAeAXZA7AJjAQmAE7QDeAUNNMPFhOkQK7DrxEAUAlGZVdBIwAOyDpwDcvKpOhZkAd2gAFIvAC2ASwjJ2kAJ5Zg0EgF4AfDz58BwogDoAZoi4TLVdfejsGjZN1Eu-AF9xXkDyQKA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=true&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env&prettier=false&targets=&version=7.14.3&externalPlugins=).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/plugins/transform-async-arrows-in-class/index.js at the call to arrowFunctionToExpression(). Reproduce the input shown in the issue and inspect the generated output; done means the transformed async arrow preserves a valid super.b() call rather than emitting super inside a function expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript
- Domain
- compilers, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100