This repository has been archived by the owner on May 19, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 258
Significant but hard-to-find bug in parsing arrow functions #58
Comments
Quick follow up: I've just discovered that this bug ONLY manifests itself if the |
Ok, so it only happens when flow/jsx parsing is on |
I just did a git bisect and this is the result:
I will have a look what my change broke. |
After digging around I also found this case which is not working anymore:
Because babylon with flow now sees the "valid-looking" arrow function Thinking about reverting my change and then reopening the other bug and redoing the fix with this in mind. |
2 tasks
This issue has been moved to babel/babel#6723. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
As of a recent release (Don't know when, exactly, but this issue broke code that was working fine around June 4), babylon's parsing of arrow functions has broken in a very peculiar way. When babylon encounters the following pattern:
It reports an error parsing the parenthesized arrow expression:
For example:
The contents of the condition don't seem to matter, nor does parenthesizing the entire conditional expression. However, if the parenthesis around the first arrow function are removed, or parenthesis are added to the second arrow function, or either arrow function is something other than an arrow function, it is parsed fine. This specific pattern is the only one that triggers the error.
For what it's worth, I'm running babylon via babel via webpack, but the stack trace I get is entirely from babylon.
This seems implausible, I know, so I've created a git repo which reproduces the error, available here:
https://github.com/Lucretiel/babylon-error
The specific file I'm trying to pack is index.js with no dependencies or requires. The raw output from
webpack
is in build_result.The text was updated successfully, but these errors were encountered: