Invalid function parameter with async function name mistakenly produces a valid syntax #1606

Open
ariya opened this Issue Oct 29, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@ariya
Contributor

ariya commented Oct 29, 2016

Test case:

esprima.parse('async({x=y})')

Expected: An exception is thrown:

Error: Line 1: Unexpected token =

Actual output: A syntax tree:

Script {
  type: 'Program',
  body: [ ExpressionStatement { type: 'ExpressionStatement', expression: [Object] } ],
  sourceType: 'script' }

Affected version: master branch revision c634d6f0.

@ariya ariya self-assigned this Oct 29, 2016

@ariya

This comment has been minimized.

Show comment
Hide comment
@ariya

ariya Oct 29, 2016

Contributor

This is a regression introduced by the implementation (pull request #1597) of async function support (#1079). It is caused by the incomplete handling of a new cover grammar in ES2017 (known as CoverCallExpressionAndAsyncArrowHead).

Contributor

ariya commented Oct 29, 2016

This is a regression introduced by the implementation (pull request #1597) of async function support (#1079). It is caused by the incomplete handling of a new cover grammar in ES2017 (known as CoverCallExpressionAndAsyncArrowHead).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment