mirror of https://github.com/tc39/test262.git
Refactor templates
This commit is contained in:
parent
5e217d531e
commit
f11568dbde
|
@ -1,26 +1,45 @@
|
||||||
// Copyright (C) 2017 Mike Pennisi. All rights reserved.
|
// Copyright (C) 2018 Katie Broida. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
path: language/statements/class/accessor-name-inst-
|
path: language/statements/class/private-accessor-name-inst-
|
||||||
name: Class declaration, instance method
|
name: Class declaration, private instance method
|
||||||
esid: sec-runtime-semantics-classdefinitionevaluation
|
esid: #prod-MethodDefinition
|
||||||
es6id: 14.5.14
|
|
||||||
info: |
|
info: |
|
||||||
[...]
|
[...]
|
||||||
21. For each ClassElement m in order from methods
|
MethodDefinition[Yield, Await]:
|
||||||
a. If IsStatic of m is false, then
|
PropertyNameClassElementName [?Yield, ?Await](
|
||||||
i. Let status be the result of performing PropertyDefinitionEvaluation
|
UniqueFormalParameters [~Yield, ~Await] ) {
|
||||||
for m with arguments proto and false.
|
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 }
|
||||||
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var stringSet;
|
var stringSet;
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
get /*{ declareWith }*/() { return 'get string'; }
|
get #/*{ declareWith }*/() { return 'get string'; }
|
||||||
set /*{ declareWith }*/(param) { stringSet = param; }
|
set #/*{ declareWith }*/(param) { stringSet = param; }
|
||||||
}
|
|
||||||
|
|
||||||
assert.sameValue(C.prototype[/*{ referenceWith }*/], 'get string');
|
getPrivateReference() {
|
||||||
|
return this.#/*{ referenceWith }*/;
|
||||||
|
}
|
||||||
|
|
||||||
C.prototype[/*{ referenceWith }*/] = 'set string';
|
setPrivateReference(value) {
|
||||||
|
this.#/*{ referenceWith }*/ = value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var inst = C();
|
||||||
|
|
||||||
|
assert.sameValue(inst.getPrivateReference(), 'get string');
|
||||||
|
|
||||||
|
inst.setPrivateReference('set string');
|
||||||
assert.sameValue(stringSet, 'set string');
|
assert.sameValue(stringSet, 'set string');
|
||||||
|
|
|
@ -37,10 +37,8 @@ class C {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var inst = C();
|
assert.sameValue(C.getPrivateReference(), 'get string');
|
||||||
|
|
||||||
assert.sameValue(inst.getPrivateReference(), 'get string');
|
C.setPrivateReference('set string');
|
||||||
|
|
||||||
inst.setPrivateReference('set string');
|
|
||||||
assert.sameValue(stringSet, 'set string');
|
assert.sameValue(stringSet, 'set string');
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ info: |
|
||||||
AsyncMethod[?Yield, ?Await]
|
AsyncMethod[?Yield, ?Await]
|
||||||
get PropertyName ClassElementName [?Yield, ?Await] (){
|
get PropertyName ClassElementName [?Yield, ?Await] (){
|
||||||
FunctionBody [~Yield, ~Await] }
|
FunctionBody [~Yield, ~Await] }
|
||||||
set PropertyNameClassElementName [?Yield, ?Await] (
|
set PropertyNameClassElementName [?Yield, ?Await] (
|
||||||
PropertySetParameterList ) { FunctionBody [~Yield, ~Await] }
|
PropertySetParameterList ) { FunctionBody [~Yield, ~Await] }
|
||||||
AsyncMethod [Yield, Await]:
|
AsyncMethod [Yield, Await]:
|
||||||
async [no LineTerminator here] PropertyName
|
async [no LineTerminator here] PropertyName
|
||||||
|
|
|
@ -37,9 +37,8 @@ var C = class {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var inst = C();
|
|
||||||
|
|
||||||
assert.sameValue(inst.getPrivateReference(), 'get string');
|
assert.sameValue(C.getPrivateReference(), 'get string');
|
||||||
|
|
||||||
inst.setPrivateReference('set string');
|
C.setPrivateReference('set string');
|
||||||
assert.sameValue(stringSet, 'set string');
|
assert.sameValue(stringSet, 'set string');
|
||||||
|
|
Loading…
Reference in New Issue