See ECMAScript section 11.1.5 defining how the ObjectLiteral
production is parsed.
In particular:
PropertyNameAndValueList
, PropertyName
: AssignmentExpression
is evaluated as follows:
Evaluate PropertyNameAndValueList.
Evaluate PropertyName.
Evaluate AssignmentExpression.
...
Where (1) is a recursive definition.
This means the leftmost item in an object literal will get evaluated first, and so {foo: 2, bar: 1}
is indeed spec-mandated.