oxc/tasks
Dunqing 06ccb51fae fix(transformer/async-to-generator): move parameters to the inner generator function when they could throw errors (#8500)
The new implementation port from [esbuild](df815ac27b/internal/js_parser/js_parser_lower.go (L355-L467)), before from `Babel`.

Babel's transform implementation for the async method is incorrect because the async method should return a rejecting promise when it throws an error. Everything is good if the errors are thrown in the async method body, but the following case will throw an error in the parameters which causes the whole program crushed not a rejecting promise. So we should move the parameters to the inner generator function when the parameters could throw an error.

Input:
```js
class Cls {
  // ReferenceError: Cannot access 'b' before initialization
  async method(a = b, b = 0) {}
}
```

Before output
```js
class Cls {
  method(a = b, b = 0) {
    return babelHelpers.asyncToGenerator(function* () {})();
  }
}
```

After output:
```js
class Cls {
  method() {
     // ReferenceError: Cannot access 'b' before initialization
    return babelHelpers.asyncToGenerator(function* (a = b, b = 0) {}).apply(this, arguments);
  }
}
```

No override tests because Babel doesn't cover this case.
2025-01-16 00:18:05 +00:00
..
ast_tools feat(ast)!: remove unused and not useful ContentHash (#8483) 2025-01-14 09:53:27 +00:00
benchmark feat(tasks/benchmark): add mangler (#8470) 2025-01-14 10:08:13 +08:00
common
compat_data refactor(global): sort imports (#7883) 2024-12-14 15:07:21 +00:00
coverage fix(transformer/async-to-generator): move parameters to the inner generator function when they could throw errors (#8500) 2025-01-16 00:18:05 +00:00
javascript_globals
lint_rules fix(tasks/lint_rules): sync unicorn rules with eslint rules (#8224) 2025-01-03 11:39:51 +08:00
minsize feat(minifier): minify var x; void x -> void 0 (#8466) 2025-01-13 16:07:59 +00:00
prettier_conformance refactor(prettier): Update tasks/prettier to correctly handle snapshots (#8337) 2025-01-08 17:10:30 +08:00
rulegen chore(deps): update dependency rust to v1.84.0 (#8391) 2025-01-09 18:11:17 +00:00
transform_checker perf(semantic): allocate UnresolvedReferences in allocator (#8046) 2024-12-20 15:18:16 +00:00
transform_conformance fix(transformer/async-to-generator): move parameters to the inner generator function when they could throw errors (#8500) 2025-01-16 00:18:05 +00:00
website feat(oxlint): implement --init cli option (#8453) 2025-01-14 13:49:42 +08:00