Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(transformer): complete the async-to-generator plugin (oxc-projec…
…t#6658) In this PR, most of the async functions have transformed correctly. But the async arrow functions don't fully transform correctly yet, it is related to we need to transform the arrow function to the generator function. For example: Input: ```js function declaration() { const asy = async () => { console.log(this.name) } } ``` Output: ```js function declaration() { const asy = babelHelpers.asyncToGenerator(function* () { console.log(this.name); }); } ``` Expected Output: ```js function declaration() { var _this = this; const asy = /*#__PURE__*/function () { var _ref = babelHelpers.asyncToGenerator(function* () { console.log(_this.name); }); return function asy() { return _ref.apply(this, arguments); }; }(); } ``` From the expected output, we haven't handled `this` correctly, which means even if the `arrow-function` plugin doesn't enable, we still need to handle this correctly as the `arrow-function` plugin does, and further question if `arrow-function` plugin is enabled, how to avoid these making conflict? I thought we may move out the implementation of `arrow-function` and as a common helper, this way every plugin can handle this well
- Loading branch information