Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Fix support for flow optional parameters in arrow functions #19

Merged
merged 1 commit into from
Jun 22, 2016
Merged

Fix support for flow optional parameters in arrow functions #19

merged 1 commit into from
Jun 22, 2016

Conversation

danez
Copy link
Member

@danez danez commented Apr 10, 2016

This fixes cases like this:

var f = (x?) => {}

The main issue was that parseMaybeConditional was detecting the question mark as start of a ternary operator, and failed because it obviously is not one.

To fix it parts of parseMaybeConditional was split into parseConditional and then overwritten in the flow plugin. There the main implementation is called, but syntax errors are catched and the state reseted to the question mark. The question mark can then be handled in parseParenItem.
The rest of the changes is to ensure that the optional operator only works in arrow functions.

Fixes T7096

This overwrites the conditional handling in babylon for flow to support
optional parameters in arrow functions.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants