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

Fix erroneous pattern parsing inside ternary expressions #2188

Merged
merged 1 commit into from
Sep 21, 2018

Conversation

IwanKaramazow
Copy link
Contributor

Fixes #2155

The problem:

true ? (Update({...a, b: 1}), None) : x;

We "over"-parse spread operators inside patterns for better errors.
Because of the parens, semicolon : and ... now being a valid codepath, the lexer triggers an injection of an ES6_FUN token. This is clearly not an es6 style function expression.
As soon as a ... is reached with a closing }, we know that we definitely don't have an es6 function expression. By exiting the lexer's es6-procedure at this stage, the parser continues it's normal behaviour and parses the correct expression.

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

Successfully merging this pull request may close these issues.

None yet

3 participants