test262/test/language/expressions/class/private-accessor-name-static-literal-numeric-binary.js
2018-11-06 10:35:22 -05:00

55 lines
1.7 KiB
JavaScript

// This file was procedurally generated from the following sources:
// - src/accessor-names/literal-numeric-binary.case
// - src/accessor-names/default/cls-private-expr-static.template
/*---
description: Computed values as accessor property names (numeric literal in binary notation) (Class expression, static private 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;
var C = class {
static get #0b10() { return 'get string'; }
static set #0b10(param) { stringSet = param; }
static getPrivateReference() {
return this.#'2';
}
static setPrivateReference(value) {
this.#'2' = value;
}
};
assert.sameValue(C.getPrivateReference(), 'get string');
C.setPrivateReference('set string');
assert.sameValue(stringSet, 'set string');