test262/test/language/expressions/object/cpn-obj-lit-computed-proper...

40 lines
850 B
JavaScript
Raw Normal View History

2020-09-17 20:13:46 +02:00
// This file was procedurally generated from the following sources:
// - src/computed-property-names/computed-property-name-from-generator-function-declaration.case
// - src/computed-property-names/evaluation/object-literal.template
/*---
description: Computed property name from generator function (ComputedPropertyName in ObjectLiteral)
esid: prod-ComputedPropertyName
features: [computed-property-names]
flags: [generated]
info: |
ObjectLiteral:
{ PropertyDefinitionList }
PropertyDefinitionList:
PropertyDefinition
PropertyDefinition:
PropertyName: AssignmentExpression
PropertyName:
ComputedPropertyName
ComputedPropertyName:
[ AssignmentExpression ]
---*/
function * g() { return 1; }
let o = {
[g()]: 1
};
assert.sameValue(
o[g()],
1
);
2020-09-25 19:12:40 +02:00
assert.sameValue(
o[String(g())],
1
);