esprima icon indicating copy to clipboard operation
esprima copied to clipboard

Invalid UpdateExpression's arguments

Open wind-of opened this issue 3 years ago • 0 comments

Invalid UpdateExpression's arguments

Esprima' UpdateExpression's argument is one of: ObjectExpression, ArrayExpression, MemberExpression, Identifier.

Consider behaviour of V8: image

Should be: Argument of UpdateExpression is one of: Identifier, MemberExpression

Steps to reproduce

esprima.parse('--[]') // or --{}, []--, (++[]), etc.

Expected output

Expected "Invalid left-hand side expression in prefix operation"

Actual output

{
  "type": "UpdateExpression",
  "operator": "--",
  "argument": {
    "type": "ArrayExpression",
    "elements": []
  },
  "prefix": true
}

Relevant references

wind-of avatar Jun 10 '22 19:06 wind-of