| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/accessor-names/literal-string-single-quote.case |
| 3 |
// - src/accessor-names/default/cls-expr-inst.template |
| 4 |
/*--- |
| 5 |
description: Computed values as accessor property names (string literal using single quotes) (Class expression, instance method) |
| 6 |
esid: sec-runtime-semantics-classdefinitionevaluation |
| 7 |
es6id: 14.5.14 |
| 8 |
flags: [generated] |
| 9 |
info: | |
| 10 |
[...] |
| 11 |
21. For each ClassElement m in order from methods |
| 12 |
a. If IsStatic of m is false, then |
| 13 |
i. Let status be the result of performing PropertyDefinitionEvaluation |
| 14 |
for m with arguments proto and false. |
| 15 |
|
| 16 |
12.2.6.7 Runtime Semantics: Evaluation |
| 17 |
|
| 18 |
[...] |
| 19 |
|
| 20 |
ComputedPropertyName : [ AssignmentExpression ] |
| 21 |
|
| 22 |
1. Let exprValue be the result of evaluating AssignmentExpression. |
| 23 |
2. Let propName be ? GetValue(exprValue). |
| 24 |
3. Return ? ToPropertyKey(propName). |
| 25 |
---*/ |
| 26 |
|
| 27 |
var stringSet; |
| 28 |
|
| 29 |
var C = class { |
| 30 |
get 'singleQuote'() { return 'get string'; } |
| 31 |
set 'singleQuote'(param) { stringSet = param; } |
| 32 |
}; |
| 33 |
|
| 34 |
assert.sameValue(C.prototype['singleQuote'], 'get string'); |
| 35 |
|
| 36 |
C.prototype['singleQuote'] = 'set string'; |
| 37 |
assert.sameValue(stringSet, 'set string'); |