Why does the JS parser require grouping parens after an (empty) arrow-function short-circuit?
Seems like the arrow-function syntax should be detected as an irreducible token.
This code:
( someFunc || ()=>{} )()
Generates a syntax error:
Uncaught SyntaxError: Malformed arrow function parameter list
The fix is to add grouping parens, but I don't understand why:
( someFunc || (()=>{}) )()
I'd also be curious to see what code the parser is seeing this as. In other words, what code would you need to write to generate that exact error. It's not doing a lookahead, clearly, so it's choking somewhere between the || and the closing grouping paren (antepenultimate char).