Open
Description
I noticed a parse error when parsing an object literal containing an arrow function if any properties are defined after the arrow function.
({ f: x => x }) // no error
({ x: null, f: x => x }) // no error
({ f: (x => x), x: null }) // no error
({ x: true ? 1 : 0, y: null }) // no error
({ f: x => x, x: null }) // ColonToken {tokenSpan = TokenPn 163 9 16, tokenComment = []}
Since the third example parses without error, my suspicion is that the,
in the failing example is being parsed as a comma operator and thus the colon after x
is unexpected.
The behavior also appears to be restricted to arrow functions as the fourth example contains an expression which doesn't cause a failure.
Metadata
Metadata
Assignees
Labels
No labels