From dd3d13a7a83171ef1203db13e760c7a075075005 Mon Sep 17 00:00:00 2001 From: jbhoosreddy Date: Wed, 29 Aug 2018 21:04:05 -0400 Subject: [PATCH 1/6] test: Add private generator method tests (#1343) --- .../default/class-decl-method.template | 2 +- .../class-decl-private-method.template | 50 +++++++++++++++++++ .../class-decl-static-private-method.template | 48 ++++++++++++++++++ .../class-expr-private-method.template | 50 +++++++++++++++++++ .../class-expr-static-private-method.template | 48 ++++++++++++++++++ 5 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 src/generators/default/class-decl-private-method.template create mode 100644 src/generators/default/class-decl-static-private-method.template create mode 100644 src/generators/default/class-expr-private-method.template create mode 100644 src/generators/default/class-expr-static-private-method.template diff --git a/src/generators/default/class-decl-method.template b/src/generators/default/class-decl-method.template index 334145980a..a1562a76fa 100644 --- a/src/generators/default/class-decl-method.template +++ b/src/generators/default/class-decl-method.template @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- path: language/statements/class/gen-method- -name: Geenerator method as a ClassDeclaration element +name: Generator method as a ClassDeclaration element esid: prod-GeneratorMethod info: | ClassElement : diff --git a/src/generators/default/class-decl-private-method.template b/src/generators/default/class-decl-private-method.template new file mode 100644 index 0000000000..70f8505f37 --- /dev/null +++ b/src/generators/default/class-decl-private-method.template @@ -0,0 +1,50 @@ +// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/gen-method- +name: Generator private method as a ClassDeclaration element +features: [class-methods-private] +esid: prod-GeneratorPrivateMethod +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } +features: [generators] +---*/ + +var callCount = 0; + +class C { + *#gen() { + callCount += 1; + /*{ body }*/ + } + 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"); + +var iter = c.gen(); + +/*{ assertions }*/ + +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"); diff --git a/src/generators/default/class-decl-static-private-method.template b/src/generators/default/class-decl-static-private-method.template new file mode 100644 index 0000000000..b11b7e9d55 --- /dev/null +++ b/src/generators/default/class-decl-static-private-method.template @@ -0,0 +1,48 @@ +// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +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 : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } +features: [generators] +---*/ + +var callCount = 0; + +class C { + static #*gen() { + callCount += 1; + /*{ body }*/ + } + static gen() { + return C.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"); + +var iter = 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"); \ No newline at end of file diff --git a/src/generators/default/class-expr-private-method.template b/src/generators/default/class-expr-private-method.template new file mode 100644 index 0000000000..7404d7ed12 --- /dev/null +++ b/src/generators/default/class-expr-private-method.template @@ -0,0 +1,50 @@ +// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/gen-private-method- +name: Generator private method as a ClassExpression element +features: [class-methods-private] +esid: prod-GeneratorPrivateMethod +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } +features: [generators] +---*/ + +var callCount = 0; + +var C = class { + *gen() { + callCount += 1; + /*{ body }*/ + } + 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"); + +var iter = c.gen(); + +/*{ assertions }*/ + +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"); diff --git a/src/generators/default/class-expr-static-private-method.template b/src/generators/default/class-expr-static-private-method.template new file mode 100644 index 0000000000..22cd887146 --- /dev/null +++ b/src/generators/default/class-expr-static-private-method.template @@ -0,0 +1,48 @@ +// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +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 : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } +features: [generators] +---*/ + +var callCount = 0; + +var C = class { + static *gen() { + callCount += 1; + /*{ body }*/ + } + static gen() { + return C.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"); + +var iter = 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"); From e2bf6f63dc2a1a6dfaf4445d6418111e412156de Mon Sep 17 00:00:00 2001 From: jbhoosreddy Date: Wed, 29 Aug 2018 21:15:52 -0400 Subject: [PATCH 2/6] update features.txt --- features.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/features.txt b/features.txt index 36ef5360ff..1cf8f2ac43 100644 --- a/features.txt +++ b/features.txt @@ -20,12 +20,16 @@ BigInt class-fields-public class-fields-private -# Static Class Fields & Methods: +# Static Class Fields & Methods: # https://github.com/tc39/proposal-static-class-features/ class-static-fields-public class-static-fields-private class-static-methods-private +# Private methods and getter/setters +# https://github.com/tc39/proposal-private-methods +class-methods-private + # Promise.prototype.finally # https://github.com/tc39/proposal-promise-finally Promise.prototype.finally From 5a6bfb0e93148b403718afcd6f52ab898eee5a16 Mon Sep 17 00:00:00 2001 From: jbhoosreddy Date: Fri, 31 Aug 2018 00:08:44 -0400 Subject: [PATCH 3/6] add templates for async generators --- .../async-class-decl-private-method.template | 50 +++++++++++++++++++ ...-class-decl-static-private-method.template | 48 ++++++++++++++++++ .../async-class-expr-private-method.template | 50 +++++++++++++++++++ ...-class-expr-static-private-method.template | 48 ++++++++++++++++++ 4 files changed, 196 insertions(+) create mode 100644 src/async-generators/default/async-class-decl-private-method.template create mode 100644 src/async-generators/default/async-class-decl-static-private-method.template create mode 100644 src/async-generators/default/async-class-expr-private-method.template create mode 100644 src/async-generators/default/async-class-expr-static-private-method.template diff --git a/src/async-generators/default/async-class-decl-private-method.template b/src/async-generators/default/async-class-decl-private-method.template new file mode 100644 index 0000000000..a7afccda74 --- /dev/null +++ b/src/async-generators/default/async-class-decl-private-method.template @@ -0,0 +1,50 @@ +// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/async-gen-private-method- +name: Async Generator method as a ClassDeclaration element +esid: prod-AsyncGeneratorPrivateMethod +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } +features: [async-iteration, class-methods-private] +---*/ + +var callCount = 0; + +class C { + async *#gen() { + callCount += 1; + /*{ body }*/ + } + 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"); + +var iter = c.gen(); + +/*{ assertions }*/ + +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"); diff --git a/src/async-generators/default/async-class-decl-static-private-method.template b/src/async-generators/default/async-class-decl-static-private-method.template new file mode 100644 index 0000000000..eead59ceca --- /dev/null +++ b/src/async-generators/default/async-class-decl-static-private-method.template @@ -0,0 +1,48 @@ +// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/async-gen-private-method-static- +name: Static async generator method as a ClassDeclaration element +esid: prod-AsyncGeneratorPrivateMethod +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } +features: [async-iteration, class-methods-private] +---*/ + +var callCount = 0; + +class C { + static async *#gen() { + callCount += 1; + /*{ body }*/ + } + static gen() { + return 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, "#gen"), false, "test 3"); + +var iter = C.gen(); + +/*{ assertions }*/ + +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"); diff --git a/src/async-generators/default/async-class-expr-private-method.template b/src/async-generators/default/async-class-expr-private-method.template new file mode 100644 index 0000000000..2fce48c150 --- /dev/null +++ b/src/async-generators/default/async-class-expr-private-method.template @@ -0,0 +1,50 @@ +// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/async-gen-private-method- +name: Async generator method as a ClassExpression element +esid: prod-AsyncGeneratorPrivateMethod +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } +features: [async-iteration, class-methods-private] +---*/ + +var callCount = 0; + +var C = class { + async *#gen() { + callCount += 1; + /*{ body }*/ + } + 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"); + +var iter = c.gen(); + +/*{ assertions }*/ + +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"); diff --git a/src/async-generators/default/async-class-expr-static-private-method.template b/src/async-generators/default/async-class-expr-static-private-method.template new file mode 100644 index 0000000000..5a1befcfc4 --- /dev/null +++ b/src/async-generators/default/async-class-expr-static-private-method.template @@ -0,0 +1,48 @@ +// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/async-gen-private-method-static- +name: Static async generator method as a ClassExpression element +esid: prod-AsyncGeneratorPrivateMethod +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } +features: [async-iteration, class-methods-private] +---*/ + +var callCount = 0; + +var C = class { + static async *#gen() { + callCount += 1; + /*{ body }*/ + } + static gen() { + return 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, "#gen"), false, "test 3"); + +var iter = C.gen(); + +/*{ assertions }*/ + +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"); From 057cd9935d8b8d69153aaf7e7a13e16baa3b237d Mon Sep 17 00:00:00 2001 From: jbhoosreddy Date: Fri, 31 Aug 2018 19:38:59 -0400 Subject: [PATCH 4/6] @leobalter's comments --- .../async-class-decl-private-method.template | 16 +++++++------- ...-class-decl-static-private-method.template | 16 ++++++-------- .../async-class-expr-private-method.template | 16 +++++++------- ...-class-expr-static-private-method.template | 16 ++++++-------- .../class-decl-private-method.template | 19 +++++++---------- .../class-decl-static-private-method.template | 21 +++++++------------ .../class-expr-private-method.template | 21 ++++++++----------- .../class-expr-static-private-method.template | 21 +++++++------------ 8 files changed, 59 insertions(+), 87 deletions(-) diff --git a/src/async-generators/default/async-class-decl-private-method.template b/src/async-generators/default/async-class-decl-private-method.template index a7afccda74..48b7060370 100644 --- a/src/async-generators/default/async-class-decl-private-method.template +++ b/src/async-generators/default/async-class-decl-private-method.template @@ -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")'); diff --git a/src/async-generators/default/async-class-decl-static-private-method.template b/src/async-generators/default/async-class-decl-static-private-method.template index eead59ceca..ebb00653f5 100644 --- a/src/async-generators/default/async-class-decl-static-private-method.template +++ b/src/async-generators/default/async-class-decl-static-private-method.template @@ -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")'); diff --git a/src/async-generators/default/async-class-expr-private-method.template b/src/async-generators/default/async-class-expr-private-method.template index 2fce48c150..8b329c11af 100644 --- a/src/async-generators/default/async-class-expr-private-method.template +++ b/src/async-generators/default/async-class-expr-private-method.template @@ -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")'); diff --git a/src/async-generators/default/async-class-expr-static-private-method.template b/src/async-generators/default/async-class-expr-static-private-method.template index 5a1befcfc4..7a5743a64d 100644 --- a/src/async-generators/default/async-class-expr-static-private-method.template +++ b/src/async-generators/default/async-class-expr-static-private-method.template @@ -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")'); diff --git a/src/generators/default/class-decl-private-method.template b/src/generators/default/class-decl-private-method.template index 70f8505f37..7e86032a37 100644 --- a/src/generators/default/class-decl-private-method.template +++ b/src/generators/default/class-decl-private-method.template @@ -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")'); diff --git a/src/generators/default/class-decl-static-private-method.template b/src/generators/default/class-decl-static-private-method.template index b11b7e9d55..d27b4c0586 100644 --- a/src/generators/default/class-decl-static-private-method.template +++ b/src/generators/default/class-decl-static-private-method.template @@ -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"); \ No newline at end of file +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")'); diff --git a/src/generators/default/class-expr-private-method.template b/src/generators/default/class-expr-private-method.template index 7404d7ed12..5cbde34f00 100644 --- a/src/generators/default/class-expr-private-method.template +++ b/src/generators/default/class-expr-private-method.template @@ -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")'); diff --git a/src/generators/default/class-expr-static-private-method.template b/src/generators/default/class-expr-static-private-method.template index 22cd887146..7979b3e674 100644 --- a/src/generators/default/class-expr-static-private-method.template +++ b/src/generators/default/class-expr-static-private-method.template @@ -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")'); From 57fea22f70ef44e04179b50d50f34352a1e154ee Mon Sep 17 00:00:00 2001 From: jbhoosreddy Date: Tue, 4 Sep 2018 00:09:35 -0400 Subject: [PATCH 5/6] add async function syntax --- .../async-class-decl-private-method.template | 24 +++++++++++++++++++ ...-class-decl-static-private-method.template | 24 +++++++++++++++++++ .../async-class-expr-private-method.template | 24 +++++++++++++++++++ ...-class-expr-static-private-method.template | 24 +++++++++++++++++++ .../async-class-decl-private-method.template | 2 +- ...-class-decl-static-private-method.template | 2 +- .../async-class-expr-private-method.template | 2 +- ...-class-expr-static-private-method.template | 2 +- .../class-decl-private-method.template | 2 +- .../class-decl-static-private-method.template | 2 +- .../class-expr-private-method.template | 2 +- .../class-expr-static-private-method.template | 2 +- 12 files changed, 104 insertions(+), 8 deletions(-) create mode 100644 src/async-functions/syntax/async-class-decl-private-method.template create mode 100644 src/async-functions/syntax/async-class-decl-static-private-method.template create mode 100644 src/async-functions/syntax/async-class-expr-private-method.template create mode 100644 src/async-functions/syntax/async-class-expr-static-private-method.template diff --git a/src/async-functions/syntax/async-class-decl-private-method.template b/src/async-functions/syntax/async-class-decl-private-method.template new file mode 100644 index 0000000000..5a3949ab24 --- /dev/null +++ b/src/async-functions/syntax/async-class-decl-private-method.template @@ -0,0 +1,24 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/async-private-method- +name: Async private method as a ClassDeclaration element +esid: prod-AsyncMethod +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } +features: [async-functions, class-methods-private] +---*/ + +class C { async #method() { + /*{ body }*/ +}} diff --git a/src/async-functions/syntax/async-class-decl-static-private-method.template b/src/async-functions/syntax/async-class-decl-static-private-method.template new file mode 100644 index 0000000000..0bede5a459 --- /dev/null +++ b/src/async-functions/syntax/async-class-decl-static-private-method.template @@ -0,0 +1,24 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/async-private-method-static- +name: Static async private method as a ClassDeclaration element +esid: prod-AsyncMethod +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } +features: [async-functions, class-methods-private] +---*/ + +class C { static async #method() { + /*{ body }*/ +}} diff --git a/src/async-functions/syntax/async-class-expr-private-method.template b/src/async-functions/syntax/async-class-expr-private-method.template new file mode 100644 index 0000000000..8f047f74d0 --- /dev/null +++ b/src/async-functions/syntax/async-class-expr-private-method.template @@ -0,0 +1,24 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/async-private-method- +name: Async private method as a ClassExpression element +esid: prod-AsyncMethod +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } +features: [async-functions, class-methods-private] +---*/ + +var C = class { async #method() { + /*{ body }*/ +}}; diff --git a/src/async-functions/syntax/async-class-expr-static-private-method.template b/src/async-functions/syntax/async-class-expr-static-private-method.template new file mode 100644 index 0000000000..ab154f12f5 --- /dev/null +++ b/src/async-functions/syntax/async-class-expr-static-private-method.template @@ -0,0 +1,24 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/async-private-method-static- +name: Static private async method as a ClassExpression element +esid: prod-AsyncMethod +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncMethod + + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } +features: [async-functions, class-methods-private] +---*/ + +var C = class { static async #method() { + /*{ body }*/ +}}; diff --git a/src/async-generators/default/async-class-decl-private-method.template b/src/async-generators/default/async-class-decl-private-method.template index 48b7060370..44ff11ea49 100644 --- a/src/async-generators/default/async-class-decl-private-method.template +++ b/src/async-generators/default/async-class-decl-private-method.template @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// Copyright (C) 2018 Bloomberb LP. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/src/async-generators/default/async-class-decl-static-private-method.template b/src/async-generators/default/async-class-decl-static-private-method.template index ebb00653f5..9e4f7d5fc1 100644 --- a/src/async-generators/default/async-class-decl-static-private-method.template +++ b/src/async-generators/default/async-class-decl-static-private-method.template @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// Copyright (C) 2018 Bloomberg LP. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/src/async-generators/default/async-class-expr-private-method.template b/src/async-generators/default/async-class-expr-private-method.template index 8b329c11af..c2509020a5 100644 --- a/src/async-generators/default/async-class-expr-private-method.template +++ b/src/async-generators/default/async-class-expr-private-method.template @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// Copyright (C) 2018 Bloomberg LP. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/src/async-generators/default/async-class-expr-static-private-method.template b/src/async-generators/default/async-class-expr-static-private-method.template index 7a5743a64d..828930de22 100644 --- a/src/async-generators/default/async-class-expr-static-private-method.template +++ b/src/async-generators/default/async-class-expr-static-private-method.template @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// Copyright (C) 2018 Bloomberg L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/src/generators/default/class-decl-private-method.template b/src/generators/default/class-decl-private-method.template index 7e86032a37..3d5c4f6916 100644 --- a/src/generators/default/class-decl-private-method.template +++ b/src/generators/default/class-decl-private-method.template @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// Copyright (C) 2018 Bloomberg LP. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- path: language/statements/class/gen-method- diff --git a/src/generators/default/class-decl-static-private-method.template b/src/generators/default/class-decl-static-private-method.template index d27b4c0586..4a5f38b801 100644 --- a/src/generators/default/class-decl-static-private-method.template +++ b/src/generators/default/class-decl-static-private-method.template @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// Copyright (C) 2018 Bloomberg LP. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- path: language/statements/class/gen-private-method-static- diff --git a/src/generators/default/class-expr-private-method.template b/src/generators/default/class-expr-private-method.template index 5cbde34f00..cede4ddfb0 100644 --- a/src/generators/default/class-expr-private-method.template +++ b/src/generators/default/class-expr-private-method.template @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// Copyright (C) 2018 Bloomberg LP. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- path: language/expressions/class/gen-private-method- diff --git a/src/generators/default/class-expr-static-private-method.template b/src/generators/default/class-expr-static-private-method.template index 7979b3e674..eb150dfcaf 100644 --- a/src/generators/default/class-expr-static-private-method.template +++ b/src/generators/default/class-expr-static-private-method.template @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Jaideep Bhoosreddy. All rights reserved. +// Copyright (C) 2018 Bloomberg LP. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- path: language/expressions/class/gen-private-method-static- From 807f62b59b676a84463101f6ea00ef3b0cf6d7a2 Mon Sep 17 00:00:00 2001 From: jbhoosreddy Date: Tue, 4 Sep 2018 00:23:22 -0400 Subject: [PATCH 6/6] add generators async-generators syntax --- .../async-class-decl-private-method.template | 24 +++++++++++++++++++ ...-class-decl-static-private-method.template | 24 +++++++++++++++++++ .../async-class-expr-private-method.template | 24 +++++++++++++++++++ ...-class-expr-static-private-method.template | 24 +++++++++++++++++++ .../syntax/class-decl-private-method.template | 23 ++++++++++++++++++ .../class-decl-static-private-method.template | 23 ++++++++++++++++++ .../syntax/class-expr-private-method.template | 23 ++++++++++++++++++ .../class-expr-static-private-method.template | 23 ++++++++++++++++++ 8 files changed, 188 insertions(+) create mode 100644 src/async-generators/syntax/async-class-decl-private-method.template create mode 100644 src/async-generators/syntax/async-class-decl-static-private-method.template create mode 100644 src/async-generators/syntax/async-class-expr-private-method.template create mode 100644 src/async-generators/syntax/async-class-expr-static-private-method.template create mode 100644 src/generators/syntax/class-decl-private-method.template create mode 100644 src/generators/syntax/class-decl-static-private-method.template create mode 100644 src/generators/syntax/class-expr-private-method.template create mode 100644 src/generators/syntax/class-expr-static-private-method.template diff --git a/src/async-generators/syntax/async-class-decl-private-method.template b/src/async-generators/syntax/async-class-decl-private-method.template new file mode 100644 index 0000000000..b9072ff2d5 --- /dev/null +++ b/src/async-generators/syntax/async-class-decl-private-method.template @@ -0,0 +1,24 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/async-gen-private-method- +name: Async Generator private method as a ClassDeclaration element +esid: prod-AsyncGeneratorMethod +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } +features: [async-iteration, class-methods-private] +---*/ + +class C { async *#gen() { + /*{ body }*/ +}} diff --git a/src/async-generators/syntax/async-class-decl-static-private-method.template b/src/async-generators/syntax/async-class-decl-static-private-method.template new file mode 100644 index 0000000000..afa110b27c --- /dev/null +++ b/src/async-generators/syntax/async-class-decl-static-private-method.template @@ -0,0 +1,24 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/async-gen-private-method-static- +name: Static async generator private method as a ClassDeclaration element +esid: prod-AsyncGeneratorMethod +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } +features: [async-iteration, class-methods-private] +---*/ + +class C { static async *#gen() { + /*{ body }*/ +}} diff --git a/src/async-generators/syntax/async-class-expr-private-method.template b/src/async-generators/syntax/async-class-expr-private-method.template new file mode 100644 index 0000000000..78938bc4a0 --- /dev/null +++ b/src/async-generators/syntax/async-class-expr-private-method.template @@ -0,0 +1,24 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/async-gen-private-method- +name: Async generator private method as a ClassExpression element +esid: prod-AsyncGeneratorMethod +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } +features: [async-iteration, class-methods-private] +---*/ + +var C = class { async *#gen() { + /*{ body }*/ +}}; diff --git a/src/async-generators/syntax/async-class-expr-static-private-method.template b/src/async-generators/syntax/async-class-expr-static-private-method.template new file mode 100644 index 0000000000..c69608ebf4 --- /dev/null +++ b/src/async-generators/syntax/async-class-expr-static-private-method.template @@ -0,0 +1,24 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/async-gen-private-method-static- +name: Static async generator private method as a ClassExpression element +esid: prod-AsyncGeneratorMethod +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + AsyncGeneratorMethod + + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } +features: [async-iteration, class-methods-private] +---*/ + +var C = class { static async *#gen() { + /*{ body }*/ +}}; diff --git a/src/generators/syntax/class-decl-private-method.template b/src/generators/syntax/class-decl-private-method.template new file mode 100644 index 0000000000..52877753ee --- /dev/null +++ b/src/generators/syntax/class-decl-private-method.template @@ -0,0 +1,23 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/gen-private-method- +name: Generator method as a ClassDeclaration element +esid: prod-GeneratorMethod +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } +features: [generators, class-methods-private] +---*/ + +class C { *#gen() { + /*{ body }*/ +}} diff --git a/src/generators/syntax/class-decl-static-private-method.template b/src/generators/syntax/class-decl-static-private-method.template new file mode 100644 index 0000000000..cf55b4d5ac --- /dev/null +++ b/src/generators/syntax/class-decl-static-private-method.template @@ -0,0 +1,23 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/gen-private-method-static- +name: Static generator method as a ClassDeclaration element +esid: prod-GeneratorMethod +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } +features: [generators, class-methods-private] +---*/ + +class C {static *#gen() { + /*{ body }*/ +}} diff --git a/src/generators/syntax/class-expr-private-method.template b/src/generators/syntax/class-expr-private-method.template new file mode 100644 index 0000000000..db8559834c --- /dev/null +++ b/src/generators/syntax/class-expr-private-method.template @@ -0,0 +1,23 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/gen-private-method- +name: Generator private method as a ClassExpression element +esid: prod-GeneratorMethod +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } +features: [generators, class-methods-private] +---*/ + +var C = class {*#gen() { + /*{ body }*/ +}}; diff --git a/src/generators/syntax/class-expr-static-private-method.template b/src/generators/syntax/class-expr-static-private-method.template new file mode 100644 index 0000000000..b66123d79d --- /dev/null +++ b/src/generators/syntax/class-expr-static-private-method.template @@ -0,0 +1,23 @@ +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/gen-private-method-static- +name: Static generator private method as a ClassExpression element +esid: prod-GeneratorMethod +info: | + ClassElement : + static PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * # PropertyName ( UniqueFormalParameters ) { GeneratorBody } +features: [generators, class-methods-private] +---*/ + +var C = class { static *#gen() { + /*{ body }*/ +}};