In the sec 11.1.5 of ECMA-262 we have the object declaration notation:
ObjectLiteral :
{ }
{ PropertyNameAndValueList }
{ PropertyNameAndValueList , }
PropertyNameAndValueList :
PropertyAssignment
PropertyNameAndValueList , PropertyAssignment
PropertyAssignment :
PropertyName : AssignmentExpression
get PropertyName ( ) { FunctionBody }
set PropertyName ( PropertySetParameterList ) { FunctionBody }
PropertyName :
IdentifierName
StringLiteral
NumericLiteral
PropertySetParameterList :
Identifier
Well, consider the following ObjectLiteral: {prop: 'prop'}. Thus we have literal of the form {PropertyName: AssignmentExpression}. Now clearly that 'prop' is AssignmentExpression. By defenition from sec 11.13, AssignmentExpression is
AssignmentExpression :
ConditionalExpression
LeftHandSideExpression = AssignmentExpression
LeftHandSideExpression AssignmentOperator AssignmentExpression
Question:
Why 'prop' is AssignmentExpression? There is no AssignmentOperator or = and 'prop' is no ConditionalExpression certanly.
{prop: 'prop'}is aPropertyNameAndValueList?'prop'is evaluated in myObjectLiteral?