@leobalter's comments

This commit is contained in:
jbhoosreddy 2018-08-31 19:38:59 -04:00
parent 5a6bfb0e93
commit 057cd9935d
8 changed files with 59 additions and 87 deletions

View File

@ -26,17 +26,15 @@ class C {
callCount += 1;
/*{ body }*/
}
gen() {
return this.#gen();
}
get gen() { return this.#gen; }
}
const c = new C();
// Test the private fields do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
var iter = c.gen();
@ -45,6 +43,6 @@ var iter = c.gen();
assert.sameValue(callCount, 1);
// Test the private fields do not appear as properties after set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');

View File

@ -16,7 +16,7 @@ info: |
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
features: [async-iteration, class-methods-private]
features: [async-iteration, class-static-methods-private]
---*/
var callCount = 0;
@ -26,15 +26,12 @@ class C {
callCount += 1;
/*{ body }*/
}
static gen() {
return C.#gen();
}
static get gen() { return this.#gen; }
}
// Test the private fields do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
var iter = C.gen();
@ -43,6 +40,5 @@ var iter = C.gen();
assert.sameValue(callCount, 1);
// Test the private fields do not appear as properties after set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');

View File

@ -26,17 +26,15 @@ var C = class {
callCount += 1;
/*{ body }*/
}
gen() {
return this.#gen();
}
get gen() { return this.#gen; }
}
const c = new C();
// Test the private fields do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
var iter = c.gen();
@ -45,6 +43,6 @@ var iter = c.gen();
assert.sameValue(callCount, 1);
// Test the private fields do not appear as properties after set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');

View File

@ -16,7 +16,7 @@ info: |
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
features: [async-iteration, class-methods-private]
features: [async-iteration, class-static-methods-private]
---*/
var callCount = 0;
@ -26,15 +26,12 @@ var C = class {
callCount += 1;
/*{ body }*/
}
static gen() {
return C.#gen();
}
static get gen() { return this.#gen; }
}
// Test the private fields do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
var iter = C.gen();
@ -43,6 +40,5 @@ var iter = C.gen();
assert.sameValue(callCount, 1);
// Test the private fields do not appear as properties after set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');

View File

@ -3,7 +3,6 @@
/*---
path: language/statements/class/gen-method-
name: Generator private method as a ClassDeclaration element
features: [class-methods-private]
esid: prod-GeneratorPrivateMethod
info: |
ClassElement :
@ -16,7 +15,7 @@ info: |
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
features: [generators]
features: [generators, class-methods-private]
---*/
var callCount = 0;
@ -26,17 +25,15 @@ class C {
callCount += 1;
/*{ body }*/
}
gen() {
return this.#gen();
}
get gen() { return this.#gen; }
}
const c = new C();
// Test the private fields do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
var iter = c.gen();
@ -45,6 +42,6 @@ var iter = c.gen();
assert.sameValue(callCount, 1);
// Test the private fields do not appear as properties after set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');

View File

@ -3,7 +3,6 @@
/*---
path: language/statements/class/gen-private-method-static-
name: Static generator private method as a ClassDeclaration element
features: [class-methods-private]
esid: prod-GeneratorPrivateMethod
info: |
ClassElement :
@ -16,33 +15,29 @@ info: |
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
features: [generators]
features: [generators, class-static-methods-private]
---*/
var callCount = 0;
class C {
static #*gen() {
static *#gen() {
callCount += 1;
/*{ body }*/
}
static gen() {
return C.gen();
}
static get gen() { return this.#gen; }
}
var gen = C.gen;
// Test the private fields do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
var iter = gen();
var iter = C.gen();
/*{ assertions }*/
assert.sameValue(callCount, 1);
// Test the private fields do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');

View File

@ -3,7 +3,6 @@
/*---
path: language/expressions/class/gen-private-method-
name: Generator private method as a ClassExpression element
features: [class-methods-private]
esid: prod-GeneratorPrivateMethod
info: |
ClassElement :
@ -16,27 +15,25 @@ info: |
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
features: [generators]
features: [generators, class-methods-private]
---*/
var callCount = 0;
var C = class {
*gen() {
*#gen() {
callCount += 1;
/*{ body }*/
}
gen() {
return this.#gen();
}
get gen() { return this.#gen; }
}
const c = new C();
// Test the private fields do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');
var iter = c.gen();
@ -45,6 +42,6 @@ var iter = c.gen();
assert.sameValue(callCount, 1);
// Test the private fields do not appear as properties after set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")');

View File

@ -3,7 +3,6 @@
/*---
path: language/expressions/class/gen-private-method-static-
name: Static generator private method as a ClassExpression element
features: [class-methods-private]
esid: prod-GeneratorPrivateMethod
info: |
ClassElement :
@ -16,33 +15,29 @@ info: |
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
features: [generators]
features: [generators, class-static-methods-private]
---*/
var callCount = 0;
var C = class {
static *gen() {
static *#gen() {
callCount += 1;
/*{ body }*/
}
static gen() {
return C.gen();
}
static get gen() { return this.#gen; }
}
var gen = C.gen;
// Test the private fields do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');
var iter = gen();
var iter = C.gen();
/*{ assertions }*/
assert.sameValue(callCount, 1);
// Test the private fields do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")');
assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")');