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

Modify semantics to support auto-inserted parens #82

Merged
merged 1 commit into from
Apr 3, 2018

Conversation

rbuckton
Copy link
Collaborator

Fixes #81

@littledan
Copy link
Member

Thanks for this patch! Will review soon (sorry for my delay).

Copy link
Member

@littledan littledan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like, in all cases, the receiver when the decorator is applied to the descriptor is undefined (before and after the patch). Also seems like we are inserting the parens in the parenthized expression case. Everyone good with these decisions? If so, LGTM

@littledan littledan merged commit 3914af2 into tc39:master Apr 3, 2018
@Jessidhia
Copy link

It would be nice if the syntax definition could be refactored to be closer to new.

The way I understand this approach is not that it "adds parens for you", but that what's in the parens is just the optional contents of the argument list. @foo and @foo() are identical in the same way that new Foo and new Foo() are.

The way it's phrased in the grammar still sounds like @foo() is a call and @foo isn't; but neither are calls; it's just declaring a function reference and the arguments it should be called with. @(foo()) is a call.

@littledan
Copy link
Member

@Kovensky I don't quite follow. With this patch, @foo and @foo() have the same semantics. Are you saying this isn't the right call?

@Jessidhia
Copy link

Oh, no, I think this is the right semantics; it's just that, possibly because of the grammar production names, it feels like a monkey patch to the spec.

The suggestion is just to refactor the grammar productions so the parens are seen as an optional argument list instead of a "call-like" expression.

@littledan
Copy link
Member

Unfortunately, we can't just use the new grammar directly because it permits square bracket property access, which is syntactically ambiguous with computed property names.

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

Successfully merging this pull request may close these issues.

3 participants