clarify what are the "circumstances" for refining the interpretation of `LeftHandSideExpression`
In 13.15.5 Destructuring Assignment, we have:
"In certain circumstances when processing an instance of the production AssignmentExpression : LeftHandSideExpression = AssignmentExpression the interpretation of LeftHandSideExpression is refined using the following grammar: ..."
But I couldn't find where these circumstances are explained. Have I missed it?
If my understand is correct, then in a context like the one below, the refinement should apply:
let o = { x: "s", y: 0 };
({x: v, y: w} = o);
In one case or another, the spec should clarify — if isn't yet doing so — what the circumstances in question are; if this is already clarified and I've missed it, it might be worth to link the clarification in section 13.15.5.
See 13.15.1 Static Semantics: Early Errors.
The circumstance is when the LeftHandSideExpression (of the AssignmentExpression) is either an ObjectLiteral or an ArrayLiteral.
And the 'refinement' is that the LeftHandSideExpression must cover an AssignmentPattern.
If my understand is correct, then in a context like the one below, the refinement should apply:
let o = { x: "s", y: 0 }; ({x: v, y: w} = o);
Yes, I think so. {x: v, y: w} is initially parsed as a LeftHandSideExpression (consisting of an ObjectLiteral), and then as an AssignmentPattern (consisting of an ObjectAssignmentPattern).
Thanks for clarifying @jmdyck! I'm leaving this open nevertheless in case the editors would consider an explicit pointer for the explanation of the circumstances.