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

Unterminated JSX contents on generic arrow function as field of parenthesized object literal #392

Closed
magnushiie opened this issue Mar 2, 2017 · 1 comment · Fixed by #475

Comments

@magnushiie
Copy link

magnushiie commented Mar 2, 2017

Babylon gives Unterminated JSX contents error when an arrow field is wrapped in an object literal which is wrapped in parentheses.

Input Code

Smallest example I could extract:

({ id: <T>(value) => value });

The real-world example would be (that's why the parentheses are necessary):

const functionReturningIdentityAsAField = () => ({ id: <T>(value: T): T => value });

Babylon/Babel Configuration

{
  plugins: [
    "jsx",
    "flow"
  ]
}

Expected Behavior

Parse without errors.

Current Behavior

  throw err;
  ^

SyntaxError: Unterminated JSX contents (2:29)
    at Parser.pp$5.raise (D:\Projects\Test\babylon_bug\node_modules\babylon\lib\index.js:4373:13)
    at Parser.pp$9.jsxReadToken (D:\Projects\Test\babylon_bug\node_modules\babylon\lib\index.js:6653:12)
    at Parser.<anonymous> (D:\Projects\Test\babylon_bug\node_modules\babylon\lib\index.js:7028:21)
    at Parser.readToken (D:\Projects\Test\babylon_bug\node_modules\babylon\lib\index.js:5853:22)
    at Parser.nextToken (D:\Projects\Test\babylon_bug\node_modules\babylon\lib\index.js:764:19)
    at Parser.next (D:\Projects\Test\babylon_bug\node_modules\babylon\lib\index.js:689:10)
    at Parser.eat (D:\Projects\Test\babylon_bug\node_modules\babylon\lib\index.js:696:12)
    at Parser.pp.expect (D:\Projects\Test\babylon_bug\node_modules\babylon\lib\index.js:1704:15)
    at Parser.pp$3.parseParenAndDistinguishExpression (D:\Projects\Test\babylon_bug\node_modules\babylon\lib\
index.js:3767:8)
    at Parser.pp$3.parseExprAtom (D:\Projects\Test\babylon_bug\node_modules\babylon\lib\index.js:3642:19)

Your Environment

software version
Babylon 6.16.1
node 7.5.0
Operating System windows 10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants