Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Should this be valid code? #89

Closed
leobalter opened this issue Jun 6, 2019 · 2 comments
Closed

Should this be valid code? #89

leobalter opened this issue Jun 6, 2019 · 2 comments
Labels

Comments

@leobalter
Copy link
Member

new new class {}()?.constructor?.(); (equivalent to new new class {}().constructor();)

When reading the proposed syntax grammar, this seems correct, but it's one of the few errors I found when parsing with Babel.

Is that an error from Babel or the actual code?

@claudepache
Copy link
Collaborator

new new class {}()?.constructor?.(); is equivalent to new FOO?.constructor?.(), which should be a syntax error. Indeed, we don’t support “optional new”, my main reason being that the expected complication of the grammar largely outweighs the (lack of) use cases. See #22.

@claudepache
Copy link
Collaborator

Closing per housekeeping.

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

No branches or pull requests

2 participants