test262/test/language/statements/class/private-accessor-name-inst-literal-string-char-escape.js
2018-11-06 10:35:22 -05:00

56 lines
1.7 KiB
JavaScript

// This file was procedurally generated from the following sources:
// - src/accessor-names/literal-string-char-escape.case
// - src/accessor-names/default/cls-private-decl-inst.template
/*---
description: Computed values as accessor property names (string literal containing a character escape sequence) (Class declaration, private instance method)
flags: [generated]
info: |
[...]
MethodDefinition[Yield, Await]:
PropertyNameClassElementName [?Yield, ?Await](
UniqueFormalParameters [~Yield, ~Await] ) {
FunctionBody [~Yield, ~Await] }
AsyncMethod[?Yield, ?Await]
get PropertyName ClassElementName [?Yield, ?Await] (){
FunctionBody [~Yield, ~Await] }
set PropertyNameClassElementName [?Yield, ?Await] (
PropertySetParameterList ) { FunctionBody [~Yield, ~Await] }
AsyncMethod [Yield, Await]:
async [no LineTerminator here] PropertyName
ClassElementName[?Yield, ?Await](
UniqueFormalParameters[~Yield, +Await] ) { AsyncFunctionBody }
12.2.6.7 Runtime Semantics: Evaluation
[...]
ComputedPropertyName : [ AssignmentExpression ]
1. Let exprValue be the result of evaluating AssignmentExpression.
2. Let propName be ? GetValue(exprValue).
3. Return ? ToPropertyKey(propName).
---*/
var stringSet;
class C {
get #'character\tescape'() { return 'get string'; }
set #'character\tescape'(param) { stringSet = param; }
getPrivateReference() {
return this[#'character escape'];
}
setPrivateReference(value) {
this[#'character escape'] = value;
}
};
var inst = new C();
assert.sameValue(inst.getPrivateReference(), 'get string');
inst.setPrivateReference('set string');
assert.sameValue(stringSet, 'set string');