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

Optional call grammar #12

Closed
waldemarhorwat opened this issue Jul 18, 2017 · 8 comments
Closed

Optional call grammar #12

waldemarhorwat opened this issue Jul 18, 2017 · 8 comments

Comments

@waldemarhorwat
Copy link

The grammar allows
a(b)?.(c)
but prohibits
a?.(b)

Is that intentional?

@jridgewell
Copy link
Member

That's explicitly allowed.

https://github.com/tc39/proposal-optional-chaining#semantics

a?.()        // a is invoked if not null/undefined

@waldemarhorwat
Copy link
Author

The example allows it, but the grammar in the proposal doesn't allow it.

@jridgewell
Copy link
Member

@claudepache
Copy link
Collaborator

@waldemarhorwat It’s a bug. The following rule is missing:

CallExpression[Yield] :
    ...
    MemberExpression[?Yield] OptionalChainingOperator Arguments[?Yield]
    ...

@rattrayalex
Copy link

This is off-topic on the question at hand, but relates to the title of the thread – where can one read about the decision to go with maybeFn?.(arg) instead of maybeFn?(arg)?

It was implied elsewhere that this debate had been had; it might be helpful to the community to have the explanation somewhere (perhaps I simply haven't found it).

@jridgewell
Copy link
Member

where can one read about the decision to go with maybeFn?.(arg) instead of maybeFn?(arg)?

#5 (comment)

@Mouvedia
Copy link

@rattrayalex that's because there was no real debate and both issues were closed too abruptly.

@claudepache
Copy link
Collaborator

@waldemarhorwat The bug is fixed with the latest update. Thanks for the careful reading.

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

No branches or pull requests

5 participants