diff --git a/src/arguments/args-trailing-comma-multiple.case b/src/arguments/args-trailing-comma-multiple.case index 6fec35a0cc660bc5684a71904918c5efb469fbbf..b62a9d544dceb35d1b2dae895a5b7518a2b0820b 100644 --- a/src/arguments/args-trailing-comma-multiple.case +++ b/src/arguments/args-trailing-comma-multiple.case @@ -4,13 +4,21 @@ /*--- desc: A trailing comma should not increase the arguments.length, using multiple args template: default -esid: prod-Arguments info: | Trailing comma in the arguments list - 12.3 Left-Hand-Side Expressions + Left-Hand-Side Expressions - Arguments[Yield, Await] : ( ArgumentList[?Yield, ?Await] , ) + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression ---*/ //- args diff --git a/src/arguments/args-trailing-comma-null.case b/src/arguments/args-trailing-comma-null.case index 1eb48aa0f36942182c0718ecefb8ec64f33bb8b9..267dca0311c9400ac155f8832b5999d2a9922fe8 100644 --- a/src/arguments/args-trailing-comma-null.case +++ b/src/arguments/args-trailing-comma-null.case @@ -3,13 +3,21 @@ /*--- desc: A trailing comma after null should not increase the arguments.length template: default -esid: prod-Arguments info: | Trailing comma in the arguments list - 12.3 Left-Hand-Side Expressions + Left-Hand-Side Expressions - Arguments[Yield, Await] : ( ArgumentList[?Yield, ?Await] , ) + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression ---*/ //- args diff --git a/src/arguments/args-trailing-comma-single-args.case b/src/arguments/args-trailing-comma-single-args.case index 33eceeb5862d631511bef5af95dc5238f102bf0f..a9c2063e657e5872158a8368d457e26945556b26 100644 --- a/src/arguments/args-trailing-comma-single-args.case +++ b/src/arguments/args-trailing-comma-single-args.case @@ -4,13 +4,21 @@ /*--- desc: A trailing comma should not increase the arguments.length, using a single arg template: default -esid: prod-Arguments info: | Trailing comma in the arguments list - 12.3 Left-Hand-Side Expressions + Left-Hand-Side Expressions - Arguments[Yield, Await] : ( ArgumentList[?Yield, ?Await] , ) + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression ---*/ //- args diff --git a/src/arguments/args-trailing-comma-spread-operator.case b/src/arguments/args-trailing-comma-spread-operator.case new file mode 100644 index 0000000000000000000000000000000000000000..420d9fdfa16b296560f3086972d04ab04fbd9173 --- /dev/null +++ b/src/arguments/args-trailing-comma-spread-operator.case @@ -0,0 +1,34 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: A trailing comma should not increase the arguments.length, using spread args +template: default +info: | + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + +//- setup +var arr = [2, 3]; + +//- args +42, ...[1], ...arr, +//- body +assert.sameValue(arguments.length, 4); +assert.sameValue(arguments[0], 42); +assert.sameValue(arguments[1], 1); +assert.sameValue(arguments[2], 2); +assert.sameValue(arguments[3], 3); diff --git a/src/arguments/args-trailing-comma-undefined.case b/src/arguments/args-trailing-comma-undefined.case index c8cd3ec3bab8b9d29cd2d43d4afcefe737756a98..d54dffb9413b170810cbb19407f35831c32d78ae 100644 --- a/src/arguments/args-trailing-comma-undefined.case +++ b/src/arguments/args-trailing-comma-undefined.case @@ -3,13 +3,21 @@ /*--- desc: A trailing comma after undefined should not increase the arguments.length template: default -esid: prod-Arguments info: | Trailing comma in the arguments list - 12.3 Left-Hand-Side Expressions + Left-Hand-Side Expressions - Arguments[Yield, Await] : ( ArgumentList[?Yield, ?Await] , ) + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression ---*/ //- args diff --git a/src/arguments/default/async-gen-func-decl.template b/src/arguments/default/async-gen-func-decl.template index 246b59921ec1297333e869854bde931c081a13f8..ddccb89cc6e50c7044fe125f2efe5a42190fb79b 100644 --- a/src/arguments/default/async-gen-func-decl.template +++ b/src/arguments/default/async-gen-func-decl.template @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/statements/async-generator/ +path: language/arguments-object/cls-decl-async-gen-func- name: async generator function declaration esid: sec-asyncgenerator-definitions-instantiatefunctionobject info: | diff --git a/src/arguments/default/async-gen-func-expr.template b/src/arguments/default/async-gen-func-expr.template index 0647ade7f9dd030da19f2044d773d71babd26caf..900a42086e89cc65324ab9396a3cb529943ee6e9 100644 --- a/src/arguments/default/async-gen-func-expr.template +++ b/src/arguments/default/async-gen-func-expr.template @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/expressions/async-generator/ +path: language/arguments-object/cls-expr-async-gen-func- name: async generator function expression esid: sec-asyncgenerator-definitions-evaluation info: | diff --git a/src/arguments/default/async-gen-meth.template b/src/arguments/default/async-gen-meth.template index bc726b34531b8e45723814b80c388f9342f41740..477dbd560f75f8e17c88fe64ba0af3b3b71fc003 100644 --- a/src/arguments/default/async-gen-meth.template +++ b/src/arguments/default/async-gen-meth.template @@ -1,7 +1,7 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/expressions/object/method-definition/async-gen-meth- +path: language/arguments-object/async-gen-meth- name: async generator method esid: sec-asyncgenerator-definitions-propertydefinitionevaluation info: | diff --git a/src/arguments/default/async-gen-named-func-expr.template b/src/arguments/default/async-gen-named-func-expr.template index a196a6dc954e61f6d4964290990898ec03a19a69..f89be065aa06583fb32efd5d127c53cf292e8396 100644 --- a/src/arguments/default/async-gen-named-func-expr.template +++ b/src/arguments/default/async-gen-named-func-expr.template @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/expressions/async-generator/named- +path: language/arguments-object/async-gen-named-func-expr- name: async generator named function expression esid: sec-asyncgenerator-definitions-evaluation info: | diff --git a/src/arguments/default/cls-decl-async-gen-meth-static.template b/src/arguments/default/cls-decl-async-gen-meth-static.template index 75d27616b06d33ffee9b10e89fa29f5cce9947e4..3009158423bc0732f43f9d89c82dbf5c8af93ec1 100644 --- a/src/arguments/default/cls-decl-async-gen-meth-static.template +++ b/src/arguments/default/cls-decl-async-gen-meth-static.template @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/statements/class/async-gen-meth-static- +path: language/arguments-object/cls-decl-async-gen-meth-static- name: static class expression generator method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | diff --git a/src/arguments/default/cls-decl-async-gen-meth.template b/src/arguments/default/cls-decl-async-gen-meth.template index f0eac2cff4c726d6bf96c7ccad911d4e65b812a1..bbc94205fee00a6d70881a17e06777f0d2167fb0 100644 --- a/src/arguments/default/cls-decl-async-gen-meth.template +++ b/src/arguments/default/cls-decl-async-gen-meth.template @@ -1,7 +1,7 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/statements/class/async-gen-meth- +path: language/arguments-object/cls-decl-async-gen-meth- name: class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | diff --git a/src/arguments/default/cls-decl-async-private-gen-meth-static.template b/src/arguments/default/cls-decl-async-private-gen-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..fcc7403c8e4c6c4c6b7fab8c07067b427ba0d8b8 --- /dev/null +++ b/src/arguments/default/cls-decl-async-private-gen-meth-static.template @@ -0,0 +1,39 @@ +// 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/arguments-object/cls-decl-async-private-gen-meth-static- +name: static class expression private generator method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +info: | + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression + + +flags: [async] +features: [async-iteration, class, class-static-methods-private] +---*/ + +var callCount = 0; +class C { + static async * #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(/*{ args }*/).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/arguments/default/cls-decl-async-private-gen-meth.template b/src/arguments/default/cls-decl-async-private-gen-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..89f9c0051fa7248611c08f17d5a097301de4b125 --- /dev/null +++ b/src/arguments/default/cls-decl-async-private-gen-meth.template @@ -0,0 +1,56 @@ +// 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/arguments-object/cls-decl-async-private-gen-meth- +name: static class declaration private generator method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +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] +features: [async-iteration, class, class-methods-private] +---*/ + +var callCount = 0; +class C { + async * #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(/*{ args }*/).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/arguments/default/cls-decl-private-gen-meth-static.template b/src/arguments/default/cls-decl-private-gen-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..1b25c82453b76644d10cd177be8d7e205511c02e --- /dev/null +++ b/src/arguments/default/cls-decl-private-gen-meth-static.template @@ -0,0 +1,31 @@ +// 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/arguments-object/cls-decl-private-gen-meth-static- +name: class declaration private generator method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +features: [generators, class, class-static-methods-private] +---*/ + +var callCount = 0; +class C { + static * #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-decl-private-gen-meth.template b/src/arguments/default/cls-decl-private-gen-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..4f15350cf2e66c2aca166e70e9c9a378afa43004 --- /dev/null +++ b/src/arguments/default/cls-decl-private-gen-meth.template @@ -0,0 +1,31 @@ +// 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/arguments-object/cls-decl-private-gen-meth- +name: class declaration private generator method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +features: [generators, class, class-methods-private] +---*/ + +var callCount = 0; +class C { + * #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-decl-private-meth-static.template b/src/arguments/default/cls-decl-private-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..2473d27f43dc9c5184367d93994ca4f0bc8671af --- /dev/null +++ b/src/arguments/default/cls-decl-private-meth-static.template @@ -0,0 +1,31 @@ +// 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/arguments-object/cls-decl-private-meth-static- +name: static class declaration private method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +features: [class, class, class-static-methods-private] +---*/ + +var callCount = 0; +class C { + static #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(/*{ args }*/); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-decl-private-meth.template b/src/arguments/default/cls-decl-private-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..ed95c0d28366bbf9996f8263748a28b63ef20739 --- /dev/null +++ b/src/arguments/default/cls-decl-private-meth.template @@ -0,0 +1,31 @@ +// 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/arguments-object/cls-decl-private-meth- +name: class declaration private method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +features: [class, class, class-methods-private] +---*/ + +var callCount = 0; +class C { + #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(/*{ args }*/); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-expr-async-gen-meth-static.template b/src/arguments/default/cls-expr-async-gen-meth-static.template index 9f0b4bddf52d83ff1ca99d609b59d07cb1365310..383e93de1781e7b25ae115998071d116d53d46f6 100644 --- a/src/arguments/default/cls-expr-async-gen-meth-static.template +++ b/src/arguments/default/cls-expr-async-gen-meth-static.template @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/expressions/class/async-gen-meth-static- +path: language/arguments-object/cls-expr-async-gen-meth-static- name: static class expression async generator method esid: sec-class-definitions-runtime-semantics-evaluation info: | diff --git a/src/arguments/default/cls-expr-async-gen-meth.template b/src/arguments/default/cls-expr-async-gen-meth.template index 4bcf442bb5a8007b08bbdb1848ae6898d3f2065f..0566239b2451225145e43b1e51ac98d8ed0e1f00 100644 --- a/src/arguments/default/cls-expr-async-gen-meth.template +++ b/src/arguments/default/cls-expr-async-gen-meth.template @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/expressions/class/async-gen-meth- +path: language/arguments-object/cls-expr-async-gen-meth- name: class expression async generator method esid: sec-class-definitions-runtime-semantics-evaluation info: | diff --git a/src/arguments/default/cls-expr-async-private-gen-meth-static.template b/src/arguments/default/cls-expr-async-private-gen-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..4800d06afabf7713d2c1097e280b5018b840b80f --- /dev/null +++ b/src/arguments/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/arguments-object/cls-expr-async-private-gen-meth-static- +name: static class expression async private generator method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +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] +features: [async-iteration, class, class-static-methods-private] +---*/ + +var callCount = 0; +var C = class { + static async * #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(/*{ args }*/).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/arguments/default/cls-expr-async-private-gen-meth.template b/src/arguments/default/cls-expr-async-private-gen-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..8fc0fe2b94b4f345dc4cc45397b67c5db4d1f5dc --- /dev/null +++ b/src/arguments/default/cls-expr-async-private-gen-meth.template @@ -0,0 +1,59 @@ +// 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/arguments-object/cls-expr-async-private-gen-meth- +name: class expression async private generator method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +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] +features: [async-iteration, class, class-methods-private] +---*/ + +var callCount = 0; +var C = class { + async * #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(/*{ args }*/).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/src/arguments/default/cls-expr-private-gen-meth-static.template b/src/arguments/default/cls-expr-private-gen-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..85d742bece443f0c662b90226f9f404623c2cb10 --- /dev/null +++ b/src/arguments/default/cls-expr-private-gen-meth-static.template @@ -0,0 +1,31 @@ +// 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/arguments-object/cls-expr-private-gen-meth-static- +name: static class expression private generator method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +features: [generators, class, class-static-methods-private] +---*/ + +var callCount = 0; +var C = class { + static * #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-expr-private-gen-meth.template b/src/arguments/default/cls-expr-private-gen-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..5a3ed59da8fc4123ff1768c19606e14e98498cc5 --- /dev/null +++ b/src/arguments/default/cls-expr-private-gen-meth.template @@ -0,0 +1,31 @@ +// 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/arguments-object/cls-expr-private-gen-meth- +name: class expression private generator method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +features: [generators, class, class-methods-private] +---*/ + +var callCount = 0; +var C = class { + * #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-expr-private-meth-static.template b/src/arguments/default/cls-expr-private-meth-static.template new file mode 100644 index 0000000000000000000000000000000000000000..c2b341e910585bc9ce900d8217fb64f6ca78e9a7 --- /dev/null +++ b/src/arguments/default/cls-expr-private-meth-static.template @@ -0,0 +1,31 @@ +// 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/arguments-object/cls-expr-private-meth-static- +name: static class expression private method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +features: [class, class-static-methods-private] +---*/ + +var callCount = 0; +var C = class { + static #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(/*{ args }*/); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-expr-private-meth.template b/src/arguments/default/cls-expr-private-meth.template new file mode 100644 index 0000000000000000000000000000000000000000..51893c71d87b10cf7b503d9244d7a6546eeffa72 --- /dev/null +++ b/src/arguments/default/cls-expr-private-meth.template @@ -0,0 +1,31 @@ +// 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/arguments-object/cls-expr-private-meth- +name: class expression private method +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +features: [class, class-methods-private] +---*/ + +var callCount = 0; +var C = class { + #method() { + /*{ body }*/ + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(/*{ args }*/); + +assert.sameValue(callCount, 1, 'method invoked exactly once');