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]: Name property - temporarily named operands of logical operators #14995

Open
1 task
p51lee opened this issue Sep 30, 2022 · 1 comment
Open
1 task

[Bug]: Name property - temporarily named operands of logical operators #14995

p51lee opened this issue Sep 30, 2022 · 1 comment

Comments

@p51lee
Copy link

p51lee commented Sep 30, 2022

💻

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

/* This category applies to class and generator */
let x = 0 || class { } ;
let y = 0 || function*() { } ;
let z = 1 && class { } ;
let w = 1 && function*() { } ;
let p = null ?? class { } ;
let r = null ?? function*() { } ;

Configuration file name

No response

Configuration

No response

Current and expected behavior

Hello, I've read the comment that Babel doesn't aim at perfectly matching the spec. Just in case, I'll let you know the rest of the name property issues I found.
Also, I divided these name property issues into several cases because I think these cases are from distinct reasons.

Running the input code,
x.name should be '' but it is '_class' in the transpiled code.
y.name should be '' but it is '_callee' in the transpiled code.
z.name should be '' but it is '_class2' in the transpiled code.
w.name should be '' but it is '_callee2' in the transpiled code.
w.name should be '' but it is '_class3' in the transpiled code.
w.name should be '' but it is '_callee3' in the transpiled code.

node
Welcome to Node.js v18.10.0.
Type ".help" for more information.
> let x = 0 || class { } ;
undefined
> let y = 0 || function*() { } ;
undefined
> let z = 1 && class { } ;
undefined
> let w = 1 && function*() { } ;
undefined
> let p = null ?? class { } ;
undefined
> let r = null ?? function*() { } ;
undefined
> x.name
''
> y.name
''
> z.name
''
> w.name
''
> p.name
''
> r.name
''

Environment

Reproductions on Babel's own REPL

Possible solution

No response

Additional context

No response

@babel-bot
Copy link
Collaborator

Hey @p51lee! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants