esprima
esprima copied to clipboard
Invalid UpdateExpression's arguments
Invalid UpdateExpression's arguments
Esprima' UpdateExpression's argument is one of: ObjectExpression, ArrayExpression, MemberExpression, Identifier.
Consider behaviour of V8:

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
}