Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Postfix operator on property access of arrow function call #6397

Closed
p51lee opened this issue Nov 10, 2022 · 3 comments
Closed

[Bug]: Postfix operator on property access of arrow function call #6397

p51lee opened this issue Nov 10, 2022 · 3 comments
Labels
Milestone

Comments

@p51lee
Copy link

p51lee commented Nov 10, 2022

Describe the bug

input.js terminates without error but the output code

// output.js
function(x) {
    return 0;
}().x--;

throws SyntaxError.

Input code

( x => 0 ) ( ) . x -- ;

Config

No response

Playground link

https://play.swc.rs/?version=1.3.14&code=H4sIAAAAAAAAA9NQqFCwtVMwUNBU0ABiPSBXV1fBWgEAsCfsmRgAAAA%3D&config=H4sIAAAAAAAAA0WMTQrEIAxG75K1286id5hDBCctFv9IUhgR714tlu7C915ehUMsrBUyshCPS0pU%2FMMKZAOKZZcVTNf6tKEXagYUeScdiiyd%2BZSEJjUQXHRbGSWbQmYSeRHG3T9m66GQfucYKmjJdAc%2F0N7G%2FHPynaLySe0Cj9ke9LUAAAA%3D

Expected behavior

Input code is terminated without error:

$ node input.js # no error

Actual behavior

Output code throws SyntaxError:

$ node output.js
output.js:1
function(x) {
^^^^^^^^

SyntaxError: Function statements require a function name
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1088:15)
    at Module._compile (node:internal/modules/cjs/loader:1123:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.11.0

Version

1.3.14 (default SWC playground)

Additional context

Note that this is a different issue with #6353.
#6353 is about a property access of async function without function call and this issue is about a property access of function call.

@p51lee p51lee added the C-bug label Nov 10, 2022
@magic-akari
Copy link
Member

This issue has been fixed in #6359.
The new version is not released.

@kdy1
Copy link
Member

kdy1 commented Nov 12, 2022

I'll release a new version soon. Thank you @magic-akari

@kdy1 kdy1 closed this as completed Nov 12, 2022
@kdy1 kdy1 modified the milestones: Planned, v1.3.15 Nov 12, 2022
@swc-bot
Copy link
Collaborator

swc-bot commented Dec 12, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

4 participants