Skip to content
Snippets Groups Projects
Commit f11568db authored by Katie Broida's avatar Katie Broida Committed by Rick Waldron
Browse files

Refactor templates

parent 5e217d53
No related branches found
No related tags found
No related merge requests found
// 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.
/*---
path: language/statements/class/accessor-name-inst-
name: Class declaration, instance method
esid: sec-runtime-semantics-classdefinitionevaluation
es6id: 14.5.14
path: language/statements/class/private-accessor-name-inst-
name: Class declaration, private instance method
esid: #prod-MethodDefinition
info: |
[...]
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing PropertyDefinitionEvaluation
for m with arguments proto and false.
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 }
---*/
var stringSet;
class C {
get /*{ declareWith }*/() { return 'get string'; }
set /*{ declareWith }*/(param) { stringSet = param; }
}
get #/*{ declareWith }*/() { return 'get string'; }
set #/*{ declareWith }*/(param) { stringSet = param; }
getPrivateReference() {
return this.#/*{ referenceWith }*/;
}
setPrivateReference(value) {
this.#/*{ referenceWith }*/ = value;
}
};
var inst = C();
assert.sameValue(C.prototype[/*{ referenceWith }*/], 'get string');
assert.sameValue(inst.getPrivateReference(), 'get string');
C.prototype[/*{ referenceWith }*/] = 'set string';
inst.setPrivateReference('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');
inst.setPrivateReference('set string');
C.setPrivateReference('set string');
assert.sameValue(stringSet, 'set string');
......@@ -13,7 +13,7 @@ info: |
AsyncMethod[?Yield, ?Await]
get PropertyName ClassElementName [?Yield, ?Await] (){
FunctionBody [~Yield, ~Await] }
set PropertyNameClassElementName [?Yield, ?Await] (
set PropertyNameClassElementName [?Yield, ?Await] (
PropertySetParameterList ) { FunctionBody [~Yield, ~Await] }
AsyncMethod [Yield, Await]:
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');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment