diff --git a/src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template b/src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..3d3bbfaaf63b3b3b300950df53917f68eb1f98cc --- /dev/null +++ b/src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template @@ -0,0 +1,57 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/dstr-async-private-gen-meth-dflt- +name: private class expression async generator method (default parameters) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +class C { + async * #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template b/src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..dd431d635da8df1b1329c7dd2c276f7fcbdf09a0 --- /dev/null +++ b/src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template @@ -0,0 +1,57 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/dstr-async-private-gen-meth-static-dflt- +name: private static class expression async generator method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [class, class-static-methods-private, async-iteration] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +class C { + static async * #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template b/src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..39f44b4a434759bce98da0e6e216c9a5e9185cec --- /dev/null +++ b/src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template @@ -0,0 +1,57 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/dstr-async-private-gen-meth-static- +name: private static class expression async generator method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [class, class-static-methods-private, async-iteration] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +class C { + static async * #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-decl-async-private-gen-meth.template b/src/dstr-binding/default/cls-decl-async-private-gen-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..6072ee707badf76f04990d4ae48c5fbafab9ab28 --- /dev/null +++ b/src/dstr-binding/default/cls-decl-async-private-gen-meth.template @@ -0,0 +1,57 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/dstr-async-private-gen-meth- +name: private class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +class C { + async * #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template b/src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..48914f6caf86493e1ea5d7bd9697c284d5c15e62 --- /dev/null +++ b/src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template @@ -0,0 +1,74 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/dstr-private-gen-meth-dflt- +name: private class expression method (default parameters) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + * #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template b/src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..667c0abc4a3ddc5191a6f3ef6a7c0e6a8459aa38 --- /dev/null +++ b/src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template @@ -0,0 +1,74 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/dstr-private-gen-meth-static-dflt- +name: private static class expression generator method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + static * #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-private-gen-meth-static.template b/src/dstr-binding/default/cls-decl-private-gen-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..0768037c061ad76b04f96ab487eb6c4bfe5435aa --- /dev/null +++ b/src/dstr-binding/default/cls-decl-private-gen-meth-static.template @@ -0,0 +1,74 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/dstr-private-gen-meth-static- +name: private static class expression generator method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + static * #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(/*{ vals }*/).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-private-gen-meth.template b/src/dstr-binding/default/cls-decl-private-gen-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..e4b3a1f1ad0a955586e3f3a6c8e1db5f0ec1d20b --- /dev/null +++ b/src/dstr-binding/default/cls-decl-private-gen-meth.template @@ -0,0 +1,74 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/dstr-private-gen-meth- +name: private class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + * #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(/*{ vals }*/).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-private-meth-dflt.template b/src/dstr-binding/default/cls-decl-private-meth-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..b69eb1f7082d784e1f41d217556dbc08a6f5818c --- /dev/null +++ b/src/dstr-binding/default/cls-decl-private-meth-dflt.template @@ -0,0 +1,72 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/dstr-private-meth-dflt- +name: private class expression method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-private-meth-static-dflt.template b/src/dstr-binding/default/cls-decl-private-meth-static-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..380d0c6bac5581c364b0c0309af9e3278a2a7109 --- /dev/null +++ b/src/dstr-binding/default/cls-decl-private-meth-static-dflt.template @@ -0,0 +1,72 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/dstr-private-meth-static-dflt- +name: private static class expression method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + static #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-private-meth-static.template b/src/dstr-binding/default/cls-decl-private-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..bcf1dfd3d1dc4dc3eabf2dfe95b6b9a39e1eb08c --- /dev/null +++ b/src/dstr-binding/default/cls-decl-private-meth-static.template @@ -0,0 +1,72 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/dstr-private-meth-static- +name: private static class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [class, class-static-methods-private, destructuring-binding] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + static #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(/*{ vals }*/); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-private-meth.template b/src/dstr-binding/default/cls-decl-private-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..fd44964fbc95edf6fbfe0fcb929b817e3987ba6c --- /dev/null +++ b/src/dstr-binding/default/cls-decl-private-meth.template @@ -0,0 +1,72 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/dstr-private-meth- +name: private class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [class, class-methods-private, destructuring-binding] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(/*{ vals }*/); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template b/src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..1b9fbb0d63ead554f66029a31d6fbe1536f14dd2 --- /dev/null +++ b/src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template @@ -0,0 +1,58 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/dstr-async-private-gen-meth-dflt- +name: private class expression async generator method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + async * #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template b/src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..87d74e51388bbf3cc9e41ccaf08a794cebd149a4 --- /dev/null +++ b/src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template @@ -0,0 +1,58 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/dstr-async-private-gen-meth-static-dflt- +name: private static class expression async generator method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + static async * #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template b/src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..66c01f3c29cf2a341c971d28dfae9fb7d5ca91cd --- /dev/null +++ b/src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template @@ -0,0 +1,58 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/dstr-async-private-gen-meth-static- +name: private static class expression async generator method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + static async * #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-expr-async-private-gen-meth.template b/src/dstr-binding/default/cls-expr-async-private-gen-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..89aec57a6a54a782367040dc24e8a5be330988ad --- /dev/null +++ b/src/dstr-binding/default/cls-expr-async-private-gen-meth.template @@ -0,0 +1,58 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/dstr-async-private-gen-meth- +name: private class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + async * #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template b/src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..e0657f8fc2fffaa034edb7baab902e89b6c35f16 --- /dev/null +++ b/src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template @@ -0,0 +1,76 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/dstr-private-gen-meth-dflt- +name: private class expression method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + * #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template b/src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..3a8c8dabcf050b4136e0e5a846318830e4ae423f --- /dev/null +++ b/src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template @@ -0,0 +1,76 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/dstr-private-gen-meth-static-dflt- +name: private static class expression generator method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static * #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-private-gen-meth-static.template b/src/dstr-binding/default/cls-expr-private-gen-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..971b5fe726f14138fb9eb90c0595772814081905 --- /dev/null +++ b/src/dstr-binding/default/cls-expr-private-gen-meth-static.template @@ -0,0 +1,76 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/dstr-private-gen-meth-static- +name: private static class expression generator method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static * #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(/*{ vals }*/).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-private-gen-meth.template b/src/dstr-binding/default/cls-expr-private-gen-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..fa1343f423ffb585954760a640e5bfd5171a45ee --- /dev/null +++ b/src/dstr-binding/default/cls-expr-private-gen-meth.template @@ -0,0 +1,76 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/dstr-private-gen-meth- +name: private class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + * #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(/*{ vals }*/).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-private-meth-dflt.template b/src/dstr-binding/default/cls-expr-private-meth-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..9be9a7625588abbd60e1565b9ad9d1cbf11d0bec --- /dev/null +++ b/src/dstr-binding/default/cls-expr-private-meth-dflt.template @@ -0,0 +1,73 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/dstr-private-meth-dflt- +name: private class expression method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-private-meth-static-dflt.template b/src/dstr-binding/default/cls-expr-private-meth-static-dflt.template new file mode 100644 index 0000000000000000000000000000000000000000..af8fb29214600e39626ea3cd244f23489f2df9f6 --- /dev/null +++ b/src/dstr-binding/default/cls-expr-private-meth-static-dflt.template @@ -0,0 +1,73 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/dstr-private-meth-static-dflt- +name: private static class expression method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static #method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-private-meth-static.template b/src/dstr-binding/default/cls-expr-private-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..ccaec8e2024109dde912a489b10d3aa3c85843fb --- /dev/null +++ b/src/dstr-binding/default/cls-expr-private-meth-static.template @@ -0,0 +1,73 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/dstr-private-meth-static- +name: private static class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(/*{ vals }*/); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-private-meth.template b/src/dstr-binding/default/cls-expr-private-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..065c11441f76ea795ca276f374b6503bc6051ab6 --- /dev/null +++ b/src/dstr-binding/default/cls-expr-private-meth.template @@ -0,0 +1,73 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/dstr-private-meth- +name: private class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + #method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(/*{ vals }*/); +assert.sameValue(callCount, 1, 'method invoked exactly once');