Skip to content
This repository was archived by the owner on May 19, 2018. It is now read-only.
/ babylon Public archive
This repository was 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

@magnushiie

Description

@magnushiie

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions