Closed wgoehrig closed 3 weeks ago
I have an async function using, but swc is omitting the await keyword that precedes calls to using.
using
await
async function using(x) { /* do something... */ } async function test() { await using(); }
{ "$schema": "https://swc.rs/schema.json", "jsc": { "parser": { "syntax": "ecmascript" }, "target": "es2022" }, "minify": false }
https://play.swc.rs/?version=1.7.40&code=H4sIAAAAAAAAA0ssrsxLVkgrzUsuyczPUygtzsxL16jQVKjm5VJQSM7PK87PSdXLyQeJWfNy1fJy8XIlomrJL8lILSJNS0lqcYkGVENieWJmCdRepbT8fCWQJpgwxGylpMQiJahZAEWBpXqwAAAA&config=H4sIAAAAAAAAA1VPOw7DIAzdOQXy3KFi6NA79BCIOhERBGQTqSjK3UsIpM3m9%2FOzVyElTGzgKdcyFhA1MdKJC8N5TvpTGEDjNRuyMcGtqxPv0qAdY6W2Q4GkacRUU6zuSrUEuBAYe6Jx3s52yP%2BdJvhIyHw17lY9jw6vjaK1gg%2FvpYrtl5QjHhc84GfqZedisPzqyUQLiu0LtK2NIRcBAAA%3D
Operating System: Platform: linux Arch: x64 Machine Type: x86_64 Version: #1 SMP Wed Mar 2 00:30:59 UTC 2022 CPU: (24 cores) Models: Intel(R) Core(TM) i9-9920X CPU @ 3.50GHz Binaries: Node: 21.7.3 npm: 10.5.0 Yarn: N/A pnpm: 9.12.2 Relevant Packages: @swc/core: 1.7.40 @swc/helpers: N/A @swc/types: N/A SWC Config: output: N/A .swcrc path: N/A Next.js info: output: N/A
The await keyword should be preserved in the output, since using (expr) is a valid function call:
using (expr)
async function using(x) {} async function test() { await using(); }
The await keyword is omitted from the output:
async function using(x) {} async function test() { using(); }
1.7.40
No response
Describe the bug
I have an async function
using
, but swc is omitting theawait
keyword that precedes calls tousing
.Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.7.40&code=H4sIAAAAAAAAA0ssrsxLVkgrzUsuyczPUygtzsxL16jQVKjm5VJQSM7PK87PSdXLyQeJWfNy1fJy8XIlomrJL8lILSJNS0lqcYkGVENieWJmCdRepbT8fCWQJpgwxGylpMQiJahZAEWBpXqwAAAA&config=H4sIAAAAAAAAA1VPOw7DIAzdOQXy3KFi6NA79BCIOhERBGQTqSjK3UsIpM3m9%2FOzVyElTGzgKdcyFhA1MdKJC8N5TvpTGEDjNRuyMcGtqxPv0qAdY6W2Q4GkacRUU6zuSrUEuBAYe6Jx3s52yP%2BdJvhIyHw17lY9jw6vjaK1gg%2FvpYrtl5QjHhc84GfqZedisPzqyUQLiu0LtK2NIRcBAAA%3D
SWC Info output
Expected behavior
The
await
keyword should be preserved in the output, sinceusing (expr)
is a valid function call:Actual behavior
The
await
keyword is omitted from the output:Version
1.7.40
Additional context
No response