| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/accessor-names/literal-string-single-quote.case |
| 3 |
// - src/accessor-names/default/obj.template |
| 4 |
/*--- |
| 5 |
description: Computed values as accessor property names (string literal using single quotes) (Object initializer) |
| 6 |
esid: sec-object-initializer-runtime-semantics-evaluation |
| 7 |
es6id: 12.2.6.8 |
| 8 |
flags: [generated] |
| 9 |
info: | |
| 10 |
ObjectLiteral : |
| 11 |
{ PropertyDefinitionList } |
| 12 |
{ PropertyDefinitionList , } |
| 13 |
|
| 14 |
1. Let obj be ObjectCreate(%ObjectPrototype%). |
| 15 |
2. Let status be the result of performing PropertyDefinitionEvaluation of |
| 16 |
PropertyDefinitionList with arguments obj and true. |
| 17 |
|
| 18 |
12.2.6.7 Runtime Semantics: Evaluation |
| 19 |
|
| 20 |
[...] |
| 21 |
|
| 22 |
ComputedPropertyName : [ AssignmentExpression ] |
| 23 |
|
| 24 |
1. Let exprValue be the result of evaluating AssignmentExpression. |
| 25 |
2. Let propName be ? GetValue(exprValue). |
| 26 |
3. Return ? ToPropertyKey(propName). |
| 27 |
---*/ |
| 28 |
|
| 29 |
var stringSet; |
| 30 |
var obj = { |
| 31 |
get ['singleQuote']() { return 'get string'; }, |
| 32 |
set ['singleQuote'](param) { stringSet = param; } |
| 33 |
}; |
| 34 |
|
| 35 |
assert.sameValue(obj['singleQuote'], 'get string'); |
| 36 |
|
| 37 |
obj['singleQuote'] = 'set string'; |
| 38 |
assert.sameValue(stringSet, 'set string'); |