What's a valid left-hand-side expression in JavaScript grammar?

Viewed 8406

Okay, we all know what the valid left-hand-side expressions are. Kind of.*

But, looking at the definition from the ECMA-Script standard, I'm very confused:

LeftHandSideExpression :
    NewExpression
    CallExpression

Is that just an error in the definition, or am I getting something wrong here? I mean, doesn't that actually mean that

new Object = 1; // NewExpression AssignmentOperator PrimaryExpression
function () { return foo; }() = 1;// CallExpression AssignmentOperator PrimaryExpression

are supposed to be valid assignment expressions?


* From my humble understanding, this would make much more sense:

LeftHandSideExpression :
    Identifier
    MemberExpression [ Expression ]
    MemberExpression . IdentifierName
    CallExpression [ Expression ]
    CallExpression . IdentifierName

2 Answers
Related