Honestly, I do not know what to imagine. That's why I'm asking you. The only example I think about is this: (({})=0) or (([])=0) but I am not sure about this.
@Bergi of course. Then I do not quite understand the analysis of this expression: (({})=0) It is not entirely clear why AssignmentPattern is used here.
Well, it's simply invalid syntax. You are not allowed to put a destructuring pattern in parentheses[1]:
It is an early Reference Error[2] if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget of LeftHandSideExpression is false.
You proba...
Yeah well both errors are invalid assignment targets so it makes sense that they share a common error message (which is implementation-defined anyway!), but they are described by different early semantics rules in the spec.
Yes, in both of them "LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget of LeftHandSideExpression is false"
Hmm, I apparently miss something when parsing non-terminals. I correctly understand that if it is impossible to reach the target non-terminal without lowering additional characters, then the last non-terminal will be the one that contains the all characters.
@Bergi
That explains a lot in this case. Now I fully understood what I was asking. Thanks for the help.
@Bergi I think it’s worth adding an amendment to your answer that clarifies that ({}) is not ObjectLiteral. Question: stackoverflow.com/questions/54962846/…