Hi all, Embarrassingly, I'm struggling to follow the spec through a simple assignment expression. :-) If someone would bear with me and explain the below, I'd be very grateful.
I'm looking at a simple assignment: `x = y`. I have no trouble with the runtime semantics, but I'm having trouble with the syntax productions, specifically how `y` matches *AssignmentExpression*. Details of what (I think) I know and where I've gotten lost: In [Assignment Operators][1], I can see that `x = y` is an [*AssignmentExpression*][2] matching the second-to-last bullet: > *AssignmentExpression*: > > * *ConditionalExpression* > * *YieldExpression* > * *ArrowFunction* > * *AsyncArrowFunction* > * *LeftHandSideExpression* = *AssignmentExpression* > * *LeftHandSideExpression* *AssignmentOperator* *AssignmentExpression* So far so good. `x` would be the *LeftHandSideExpression* and `y` would be the *AssignmentExpression* in that production. And I'm fine with `x`. `x` is a [*LeftHandSideExpression*][3] and I can follow through [*NewExpression*][4] to [*MemberExpression*][5] to [*PrimaryExpression*][6] to [*IdentifierReference*][7]. But looking at the syntax for *AssignmentExpression* above, I can't see how `y` matches it. `y` is an *IdentifierReference*, right? Starting from the six productions above, I can't get to *IdentifierReference*, or to any other production that seems to me to match `y`. It seems like *PrimaryExpression* should be on that list. But it isn't, and I'm sure it isn't for a reason. It's a dead simple thing, clearly (and embarrassingly) there's just some fundamental point or concept I'm missing. Thanks in advance, -- T.J. Crowder [1]: https://tc39.github.io/ecma262/#sec-assignment-operators [2]: https://tc39.github.io/ecma262/#prod-AssignmentExpression [3]: https://tc39.github.io/ecma262/#prod-LeftHandSideExpression [4]: https://tc39.github.io/ecma262/#prod-NewExpression [5]: https://tc39.github.io/ecma262/#prod-MemberExpression [6]: https://tc39.github.io/ecma262/#prod-PrimaryExpression [7]: https://tc39.github.io/ecma262/#prod-IdentifierReference
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

