Skip to content

arguments is not transform correct in async function #10149

@axetroy

Description

@axetroy

Describe the bug

After the code transform, it breaks the original behavior.

Input code

var foo = {
    async bar({ name }) {
        console.log('arguments.length', arguments.length)
    }
}

foo.bar({})

Config

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.11.7&code=H4sIAAAAAAAAAytLLFJIy89XsFWo5lIAgsTiyrxkhaTEIo1qhbzE3FSFWk2oDAgk5%2BcV5%2Bek6uXkp2uoJxall%2Bam5pUU6%2BWk5qWXZKjrKKALaYJ11nLVcnEBLdEDG1urCQBsC3CYdAAAAA%3D%3D&config=H4sIAAAAAAAAA1WPSw7DIAxE95wCed1tN71DD2FRJwLxEyZSUZS7Fyikzc4z8%2ByRdyElGFbwkHsdq4iYmNKpq8PFZ3xXB0g5ZJV0zHCbqeEWLWiZunV8E8iYVsp9i%2B8DBxsC08SH57TXS%2FkvVMHFRMxXsKHoV0vXOjEqwYXX1sPxSC6xqXbNBW8YfuRsPK%2BD5udcz2kjcXwAmJf30BkBAAA%3D

SWC Info output

No response

Expected behavior

Output: 1

The arguments should get a correct value

Actual behavior

Output: 0

The arguments should be correct

Version

1.11.7

Additional context

Note: once remove async, it works fine like expect

Image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions