esprima
esprima copied to clipboard
Should throw on invalid LHS in postfix operation
Esprima allow invalid LHS in both postfix and prefix operations.
Steps to reproduce
esprima.parse('function f() { (new.target)--; }')
Expected output
Should have thrown an error.
Actual output
{
"type": "Program",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "f"
},
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "UpdateExpression",
"operator": "--",
"argument": {
"type": "MetaProperty",
"meta": {
"type": "Identifier",
"name": "new"
},
"property": {
"type": "Identifier",
"name": "target"
}
},
"prefix": false
}
}
]
},
"generator": false,
"expression": false,
"async": false
}
],
"sourceType": "script"
}