Skip to content

Conversation

@joshvera
Copy link
Contributor

@joshvera joshvera commented Dec 7, 2018

Constrain new expressions to constructable_expression and increase the precedence over call expressions.

@joshvera joshvera merged commit 1fe4e29 into master Dec 7, 2018
@joshvera joshvera deleted the remove-calls-from-new-expressions branch December 7, 2018 18:44
@maxbrunsfeld
Copy link
Contributor

🤘 great improvement.

@maxbrunsfeld maxbrunsfeld mentioned this pull request Sep 14, 2020
maxbrunsfeld added a commit that referenced this pull request Sep 15, 2020
This avoids the premature parsing decision that happened in the last commit.
However, we now get a conflict because of the '?.' token, for the following
token sequence:

new foo ?.

One one hand, the '?.' token may be part of a member_expression or
subscript_expression. In that case, we want to SHIFT the '?.' token
before creating the 'new_expression' node, in order to group things
like this:

'new' ( expression '?.' identifier)   or
      |                           |
      ----- member_expression ----

On the other hand, the '?.' token may be part of a 'call_expression',
in which case, the parser thinks we would want to create the
'new_expression' first, so as to group things like this:

( 'new' expression ) '?.' arguments
|                  |
-- new_expression --

This second conflicting interpretation arises because 'new_expression'
currently has *higher* precedence than 'call_expression' - we set the
precedences this way in PR #89.
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