diff --git a/src/arguments/args-trailing-comma-multiple.case b/src/arguments/args-trailing-comma-multiple.case index 6fec35a0cc..b62a9d544d 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 1eb48aa0f3..267dca0311 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 33eceeb586..a9c2063e65 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 0000000000..420d9fdfa1 --- /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 c8cd3ec3ba..d54dffb941 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 246b59921e..ddccb89cc6 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 0647ade7f9..900a42086e 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 bc726b3453..477dbd560f 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 a196a6dc95..f89be065aa 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 75d27616b0..3009158423 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 f0eac2cff4..bbc94205fe 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 0000000000..fcc7403c8e --- /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 0000000000..89f9c0051f --- /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 0000000000..1b25c82453 --- /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 0000000000..4f15350cf2 --- /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 0000000000..2473d27f43 --- /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 0000000000..ed95c0d283 --- /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 9f0b4bddf5..383e93de17 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 4bcf442bb5..0566239b24 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 0000000000..4800d06afa --- /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 0000000000..8fc0fe2b94 --- /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 0000000000..85d742bece --- /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 0000000000..5a3ed59da8 --- /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 0000000000..c2b341e910 --- /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 0000000000..51893c71d8 --- /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'); diff --git a/test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/async-gen-meth-args-trailing-comma-multiple.js similarity index 83% rename from test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-multiple.js rename to test/language/arguments-object/async-gen-meth-args-trailing-comma-multiple.js index 656e979764..be05746612 100644 --- a/test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/async-gen-meth-args-trailing-comma-multiple.js @@ -23,9 +23,18 @@ 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 ---*/ var callCount = 0; diff --git a/test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-null.js b/test/language/arguments-object/async-gen-meth-args-trailing-comma-null.js similarity index 83% rename from test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-null.js rename to test/language/arguments-object/async-gen-meth-args-trailing-comma-null.js index 0bdc228f9b..ca865707cd 100644 --- a/test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-null.js +++ b/test/language/arguments-object/async-gen-meth-args-trailing-comma-null.js @@ -23,9 +23,18 @@ 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 ---*/ var callCount = 0; diff --git a/test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/async-gen-meth-args-trailing-comma-single-args.js similarity index 83% rename from test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-single-args.js rename to test/language/arguments-object/async-gen-meth-args-trailing-comma-single-args.js index 905ca395fe..5e924c9749 100644 --- a/test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/async-gen-meth-args-trailing-comma-single-args.js @@ -23,9 +23,18 @@ 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 ---*/ var callCount = 0; diff --git a/test/language/arguments-object/async-gen-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/async-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..844bd1bf02 --- /dev/null +++ b/test/language/arguments-object/async-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/async-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + 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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + +var callCount = 0; +var obj = { + async *method() { + 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); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/async-gen-meth-args-trailing-comma-undefined.js similarity index 83% rename from test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-undefined.js rename to test/language/arguments-object/async-gen-meth-args-trailing-comma-undefined.js index b9fc31fcbe..0a4a31c33e 100644 --- a/test/language/expressions/object/method-definition/async-gen-meth-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/async-gen-meth-args-trailing-comma-undefined.js @@ -23,9 +23,18 @@ 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 ---*/ var callCount = 0; diff --git a/test/language/expressions/async-generator/named-args-trailing-comma-multiple.js b/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-multiple.js similarity index 80% rename from test/language/expressions/async-generator/named-args-trailing-comma-multiple.js rename to test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-multiple.js index 00dc217d68..dec759604b 100644 --- a/test/language/expressions/async-generator/named-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-multiple.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/expressions/async-generator/named-args-trailing-comma-null.js b/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-null.js similarity index 80% rename from test/language/expressions/async-generator/named-args-trailing-comma-null.js rename to test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-null.js index f6f8ad42ca..e8bf7ccf8c 100644 --- a/test/language/expressions/async-generator/named-args-trailing-comma-null.js +++ b/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-null.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/expressions/async-generator/named-args-trailing-comma-single-args.js b/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-single-args.js similarity index 80% rename from test/language/expressions/async-generator/named-args-trailing-comma-single-args.js rename to test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-single-args.js index 9fd49fb9c2..65acaa2555 100644 --- a/test/language/expressions/async-generator/named-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-single-args.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-spread-operator.js b/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..778e5af647 --- /dev/null +++ b/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-spread-operator.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/async-gen-named-func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g() { + 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); + callCount = callCount + 1; +}; + +ref(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generator/named-args-trailing-comma-undefined.js b/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-undefined.js similarity index 80% rename from test/language/expressions/async-generator/named-args-trailing-comma-undefined.js rename to test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-undefined.js index 349642e230..1663c9cf96 100644 --- a/test/language/expressions/async-generator/named-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-undefined.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/statements/async-generator/args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-multiple.js similarity index 80% rename from test/language/statements/async-generator/args-trailing-comma-multiple.js rename to test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-multiple.js index 3fa5bf10c1..0c5639d302 100644 --- a/test/language/statements/async-generator/args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-multiple.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/statements/async-generator/args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-null.js similarity index 80% rename from test/language/statements/async-generator/args-trailing-comma-null.js rename to test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-null.js index e909f6fd29..b185793749 100644 --- a/test/language/statements/async-generator/args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-null.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/statements/async-generator/args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-single-args.js similarity index 79% rename from test/language/statements/async-generator/args-trailing-comma-single-args.js rename to test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-single-args.js index d66c25ded3..639972cc31 100644 --- a/test/language/statements/async-generator/args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-single-args.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..d08e957e1d --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-spread-operator.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/async-gen-func-decl.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (async generator function declaration) +esid: sec-asyncgenerator-definitions-instantiatefunctionobject +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody, + scope, strict). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +async function* ref() { + 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); + callCount = callCount + 1; +} + +ref(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/statements/async-generator/args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-undefined.js similarity index 80% rename from test/language/statements/async-generator/args-trailing-comma-undefined.js rename to test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-undefined.js index 087c872f78..c47802160d 100644 --- a/test/language/statements/async-generator/args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-undefined.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/statements/class/async-gen-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-multiple.js similarity index 88% rename from test/language/statements/class/async-gen-meth-args-trailing-comma-multiple.js rename to test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-multiple.js index 9ee31b06bf..d56da3e3ab 100644 --- a/test/language/statements/class/async-gen-meth-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-multiple.js @@ -41,9 +41,18 @@ 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 ---*/ var callCount = 0; diff --git a/test/language/statements/class/async-gen-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-null.js similarity index 87% rename from test/language/statements/class/async-gen-meth-args-trailing-comma-null.js rename to test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-null.js index 33833dcd73..6ad1eece4d 100644 --- a/test/language/statements/class/async-gen-meth-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-null.js @@ -41,9 +41,18 @@ 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 ---*/ var callCount = 0; diff --git a/test/language/statements/class/async-gen-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-single-args.js similarity index 87% rename from test/language/statements/class/async-gen-meth-args-trailing-comma-single-args.js rename to test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-single-args.js index b3e6e0f98d..570239a20f 100644 --- a/test/language/statements/class/async-gen-meth-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-single-args.js @@ -41,9 +41,18 @@ 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 ---*/ var callCount = 0; diff --git a/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..88f47fe20b --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-async-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + +var callCount = 0; +class C { + async *method() { + 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); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/statements/class/async-gen-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-undefined.js similarity index 88% rename from test/language/statements/class/async-gen-meth-args-trailing-comma-undefined.js rename to test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-undefined.js index 9b9c4a3c3a..3b4961173c 100644 --- a/test/language/statements/class/async-gen-meth-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-undefined.js @@ -41,9 +41,18 @@ 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 ---*/ var callCount = 0; diff --git a/test/language/statements/class/async-gen-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-multiple.js similarity index 88% rename from test/language/statements/class/async-gen-meth-static-args-trailing-comma-multiple.js rename to test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-multiple.js index fbbe19913c..33cdf03bf5 100644 --- a/test/language/statements/class/async-gen-meth-static-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-multiple.js @@ -41,9 +41,18 @@ 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 ---*/ diff --git a/test/language/statements/class/async-gen-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-null.js similarity index 87% rename from test/language/statements/class/async-gen-meth-static-args-trailing-comma-null.js rename to test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-null.js index d91abd06bc..379f9b264d 100644 --- a/test/language/statements/class/async-gen-meth-static-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-null.js @@ -41,9 +41,18 @@ 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 ---*/ diff --git a/test/language/statements/class/async-gen-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-single-args.js similarity index 87% rename from test/language/statements/class/async-gen-meth-static-args-trailing-comma-single-args.js rename to test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-single-args.js index 1e583efe98..f55fff88a8 100644 --- a/test/language/statements/class/async-gen-meth-static-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-single-args.js @@ -41,9 +41,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..142be7e350 --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-async-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class expression generator method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [async-iteration] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +class C { + static async *method() { + 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); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/statements/class/async-gen-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-undefined.js similarity index 88% rename from test/language/statements/class/async-gen-meth-static-args-trailing-comma-undefined.js rename to test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-undefined.js index d3938284ea..13f8e74847 100644 --- a/test/language/statements/class/async-gen-meth-static-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-undefined.js @@ -41,9 +41,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..13f5254232 --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-async-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (static class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + +var callCount = 0; +class C { + async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..ba6a16f760 --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-async-private-gen-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (static class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + +var callCount = 0; +class C { + async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..24056047cd --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-async-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (static class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + +var callCount = 0; +class C { + async * #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..d13153726a --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-async-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + +var callCount = 0; +class C { + async * #method() { + 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); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..b1d278fb83 --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-async-private-gen-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (static class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + +var callCount = 0; +class C { + async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..fe1fb91631 --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-async-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (static class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-static-methods-private] +flags: [generated, async] +info: | + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..820d5f8c94 --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-async-private-gen-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (static class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-static-methods-private] +flags: [generated, async] +info: | + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..6b1dd042b6 --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-async-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (static class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-static-methods-private] +flags: [generated, async] +info: | + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static async * #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..96e160c8e6 --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-async-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-static-methods-private] +flags: [generated, async] +info: | + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +class C { + static async * #method() { + 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); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..0bdd947fa3 --- /dev/null +++ b/test/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-async-private-gen-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (static class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-static-methods-private] +flags: [generated, async] +info: | + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-multiple.js index 40b7ba0388..9e8a6588ac 100644 --- a/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-multiple.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-null.js index 10418ef791..0eaa49ab2c 100644 --- a/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-null.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-single-args.js index 0b8bd096f7..e7dc8eb9f7 100644 --- a/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-single-args.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..3cced1b4d2 --- /dev/null +++ b/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class declaration generator method) +esid: sec-arguments-exotic-objects +features: [generators] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +class C { + *method() { + 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); + callCount = callCount + 1; + } +} + +C.prototype.method(42, ...[1], ...arr,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-undefined.js index 7d870499a0..bc2059b237 100644 --- a/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-undefined.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-multiple.js index d1596fe2c9..ba48dcf86f 100644 --- a/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-multiple.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-null.js index c8f32457bb..28bb31bb1b 100644 --- a/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-null.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-single-args.js index ec4204c8c2..fc97367fdd 100644 --- a/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-single-args.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..a81986055a --- /dev/null +++ b/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class declaration generator method) +esid: sec-arguments-exotic-objects +features: [generators] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +class C { + static *method() { + 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); + callCount = callCount + 1; + } +} + +C.method(42, ...[1], ...arr,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-undefined.js index 5a6faf8284..37db035f50 100644 --- a/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-undefined.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-meth-args-trailing-comma-multiple.js index 2fd2c18f52..7aed4d5b39 100644 --- a/test/language/arguments-object/cls-decl-meth-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-decl-meth-args-trailing-comma-multiple.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-meth-args-trailing-comma-null.js index f8ad3d0387..864f1095b3 100644 --- a/test/language/arguments-object/cls-decl-meth-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-decl-meth-args-trailing-comma-null.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-meth-args-trailing-comma-single-args.js index 8c5c84e307..2d35ffbf0f 100644 --- a/test/language/arguments-object/cls-decl-meth-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-decl-meth-args-trailing-comma-single-args.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..b46143174c --- /dev/null +++ b/test/language/arguments-object/cls-decl-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class declaration method) +esid: sec-arguments-exotic-objects +flags: [generated] +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. + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +class C { + method() { + 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); + callCount = callCount + 1; + } +} + +C.prototype.method(42, ...[1], ...arr,); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-meth-args-trailing-comma-undefined.js index 2369485c96..dfc0bf6724 100644 --- a/test/language/arguments-object/cls-decl-meth-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-decl-meth-args-trailing-comma-undefined.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-multiple.js index 41eb07215d..d66a236c73 100644 --- a/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-multiple.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-null.js index d33ef1805f..c27573ddab 100644 --- a/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-null.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-single-args.js index dca6c135ce..c23e46c92a 100644 --- a/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-single-args.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..3fa249696e --- /dev/null +++ b/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class declaration method) +esid: sec-arguments-exotic-objects +flags: [generated] +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. + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +class C { + static method() { + 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); + callCount = callCount + 1; + } +} + +C.method(42, ...[1], ...arr,); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-undefined.js index dbdbfea745..1e6beb8e30 100644 --- a/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-decl-meth-static-args-trailing-comma-undefined.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..3c7862feee --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, 'TC39',).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..0f2b6cb70d --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-private-gen-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, null,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..1f55965f24 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + * #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..455524f8cf --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +class C { + * #method() { + 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); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, ...[1], ...arr,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..1cf9aa310b --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-private-gen-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, undefined,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..933ff600f5 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, 'TC39',).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..0b8f386919 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-private-gen-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, null,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..d4d696ae4f --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static * #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..f08bf5d2c9 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +class C { + static * #method() { + 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); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, ...[1], ...arr,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..4af64924d9 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-private-gen-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (class declaration private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, undefined,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..713c5e7673 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-multiple.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-private-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (class declaration private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, 'TC39',); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..6ee179287f --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-null.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-private-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (class declaration private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, null,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..8ceaec2136 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-single-args.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-private-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (class declaration private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..af04762cc6 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-private-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class declaration private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +class C { + #method() { + 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); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, ...[1], ...arr,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..11a8ad097f --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-meth-args-trailing-comma-undefined.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-private-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (class declaration private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +} + +new C().method(42, undefined,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..56af8bda25 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-private-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (static class declaration private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, 'TC39',); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..335c7caf62 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-null.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-private-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (static class declaration private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, null,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..0764771043 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-private-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (static class declaration private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..52d53b5999 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-decl-private-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class declaration private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +class C { + static #method() { + 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); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, ...[1], ...arr,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..2e968648f6 --- /dev/null +++ b/test/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-private-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (static class declaration private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +class C { + static #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +} + +C.method(42, undefined,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/async-generator/args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-multiple.js similarity index 80% rename from test/language/expressions/async-generator/args-trailing-comma-multiple.js rename to test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-multiple.js index e9c6dbee3f..a3195b8b5a 100644 --- a/test/language/expressions/async-generator/args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-multiple.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/expressions/async-generator/args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-null.js similarity index 80% rename from test/language/expressions/async-generator/args-trailing-comma-null.js rename to test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-null.js index 855395b654..bb27920f3b 100644 --- a/test/language/expressions/async-generator/args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-null.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/expressions/async-generator/args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-single-args.js similarity index 79% rename from test/language/expressions/async-generator/args-trailing-comma-single-args.js rename to test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-single-args.js index fdda70572a..cf364ae8c0 100644 --- a/test/language/expressions/async-generator/args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-single-args.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..0a9dd7c1c7 --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-spread-operator.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/async-gen-func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*() { + 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); + callCount = callCount + 1; +}; + +ref(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generator/args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-undefined.js similarity index 80% rename from test/language/expressions/async-generator/args-trailing-comma-undefined.js rename to test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-undefined.js index 5869273810..6687e264db 100644 --- a/test/language/expressions/async-generator/args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-undefined.js @@ -18,9 +18,18 @@ 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 ---*/ diff --git a/test/language/expressions/class/async-gen-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-multiple.js similarity index 88% rename from test/language/expressions/class/async-gen-meth-args-trailing-comma-multiple.js rename to test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-multiple.js index f1b4d919ea..392d0f57da 100644 --- a/test/language/expressions/class/async-gen-meth-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-multiple.js @@ -42,9 +42,18 @@ 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 ---*/ diff --git a/test/language/expressions/class/async-gen-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-null.js similarity index 88% rename from test/language/expressions/class/async-gen-meth-args-trailing-comma-null.js rename to test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-null.js index 017d66fda8..85743ac0fa 100644 --- a/test/language/expressions/class/async-gen-meth-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-null.js @@ -42,9 +42,18 @@ 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 ---*/ diff --git a/test/language/expressions/class/async-gen-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-single-args.js similarity index 88% rename from test/language/expressions/class/async-gen-meth-args-trailing-comma-single-args.js rename to test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-single-args.js index 788ece51ca..05770208d9 100644 --- a/test/language/expressions/class/async-gen-meth-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-single-args.js @@ -42,9 +42,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..959566cacc --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-async-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + async *method() { + 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); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/test/language/expressions/class/async-gen-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-undefined.js similarity index 88% rename from test/language/expressions/class/async-gen-meth-args-trailing-comma-undefined.js rename to test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-undefined.js index da98971f97..f475eb54cd 100644 --- a/test/language/expressions/class/async-gen-meth-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-undefined.js @@ -42,9 +42,18 @@ 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 ---*/ diff --git a/test/language/expressions/class/async-gen-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-multiple.js similarity index 88% rename from test/language/expressions/class/async-gen-meth-static-args-trailing-comma-multiple.js rename to test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-multiple.js index 5cf7bfcd83..c2366f26c0 100644 --- a/test/language/expressions/class/async-gen-meth-static-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-multiple.js @@ -42,9 +42,18 @@ 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 ---*/ diff --git a/test/language/expressions/class/async-gen-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-null.js similarity index 88% rename from test/language/expressions/class/async-gen-meth-static-args-trailing-comma-null.js rename to test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-null.js index d8bf42cdbf..e6e9cc5797 100644 --- a/test/language/expressions/class/async-gen-meth-static-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-null.js @@ -42,9 +42,18 @@ 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 ---*/ diff --git a/test/language/expressions/class/async-gen-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-single-args.js similarity index 88% rename from test/language/expressions/class/async-gen-meth-static-args-trailing-comma-single-args.js rename to test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-single-args.js index afa2552bb3..d13f43fb28 100644 --- a/test/language/expressions/class/async-gen-meth-static-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-single-args.js @@ -42,9 +42,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..af23784747 --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-async-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + static async *method() { + 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); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/class/async-gen-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-undefined.js similarity index 88% rename from test/language/expressions/class/async-gen-meth-static-args-trailing-comma-undefined.js rename to test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-undefined.js index d058cc877f..c0811d66bf 100644 --- a/test/language/expressions/class/async-gen-meth-static-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-undefined.js @@ -42,9 +42,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..b652733edd --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-async-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (class expression async private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..a977180760 --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-async-private-gen-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (class expression async private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..30ec4e3312 --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-async-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (class expression async private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + async * #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..c4dc3b6c2d --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-async-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class expression async private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + async * #method() { + 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); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..77481ea515 --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-async-private-gen-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (class expression async private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..aa28936852 --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (static class expression async private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-static-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..4f5de1e307 --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (static class expression async private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-static-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..8a852bc9ea --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (static class expression async private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-static-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static async * #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..cf8c66bec8 --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class expression async private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-static-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + static async * #method() { + 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); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, ...[1], ...arr,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..023d3c3fc6 --- /dev/null +++ b/test/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (static class expression async private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [async-iteration, class, class-static-methods-private] +flags: [generated, async] +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). + [...] + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static async * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-multiple.js index a610b95abf..e4de074c3e 100644 --- a/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-multiple.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-null.js index 2ab35290e0..dd017cff0c 100644 --- a/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-null.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-single-args.js index f31fdf2e87..4c0b362cec 100644 --- a/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-single-args.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..1aa6ecbd6b --- /dev/null +++ b/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class expression generator method) +esid: sec-arguments-exotic-objects +features: [generators] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + *method() { + 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); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, ...[1], ...arr,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-undefined.js index d3fc23b2c0..b6cf5c3090 100644 --- a/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-undefined.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-multiple.js index ce7c6b5d1d..4c1440677e 100644 --- a/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-multiple.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-null.js index 363673d50c..71862647e2 100644 --- a/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-null.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-single-args.js index 9bcb935bcf..8e2ff437ea 100644 --- a/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-single-args.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..3dc818badd --- /dev/null +++ b/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class expression generator method) +esid: sec-arguments-exotic-objects +features: [generators] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + static *method() { + 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); + callCount = callCount + 1; + } +}; + +C.method(42, ...[1], ...arr,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-undefined.js index 170e6f894c..6a53c69c03 100644 --- a/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-undefined.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-meth-args-trailing-comma-multiple.js index 1a0fcf7785..2bcc643b0d 100644 --- a/test/language/arguments-object/cls-expr-meth-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-expr-meth-args-trailing-comma-multiple.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-meth-args-trailing-comma-null.js index 04d0bf5e83..d74388db9a 100644 --- a/test/language/arguments-object/cls-expr-meth-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-expr-meth-args-trailing-comma-null.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-meth-args-trailing-comma-single-args.js index 841ed2e637..cee020ece4 100644 --- a/test/language/arguments-object/cls-expr-meth-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-expr-meth-args-trailing-comma-single-args.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..0847a9765e --- /dev/null +++ b/test/language/arguments-object/cls-expr-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class expression method) +esid: sec-arguments-exotic-objects +flags: [generated] +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. + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + method() { + 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); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, ...[1], ...arr,); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-meth-args-trailing-comma-undefined.js index f96b481511..66715913a7 100644 --- a/test/language/arguments-object/cls-expr-meth-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-expr-meth-args-trailing-comma-undefined.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-multiple.js index 6b92f2abfa..30e35d5c3e 100644 --- a/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-multiple.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-null.js index 6dc103bcc1..1d4e7607b5 100644 --- a/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-null.js +++ b/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-null.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-single-args.js index 02910ed585..b9c677fa4e 100644 --- a/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-single-args.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..e12037e08f --- /dev/null +++ b/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class expression method) +esid: sec-arguments-exotic-objects +flags: [generated] +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. + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + static method() { + 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); + callCount = callCount + 1; + } +}; + +C.method(42, ...[1], ...arr,); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-undefined.js index 8aa68aa06b..cec597366f 100644 --- a/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/cls-expr-meth-static-args-trailing-comma-undefined.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..68a61dcbd0 --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, 'TC39',).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..798d20cea8 --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-private-gen-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, null,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..ab3ed64d95 --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + * #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..40f3587901 --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-private-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + * #method() { + 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); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, ...[1], ...arr,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..af8d174c5e --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-private-gen-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, undefined,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..eabd7523cc --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (static class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, 'TC39',).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..51cc974ad3 --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-private-gen-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (static class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, null,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..61dc7e1a2f --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (static class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static * #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..2c00fdc98d --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-private-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + static * #method() { + 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); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, ...[1], ...arr,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..ec420d59e9 --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-private-gen-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (static class expression private generator method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [generators, class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static * #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, undefined,).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..743e68fe78 --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-multiple.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-private-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (class expression private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, 'TC39',); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..0b62f94efc --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-null.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-private-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (class expression private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, null,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..a0b41850ed --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-single-args.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-private-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (class expression private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..cbca766be9 --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-private-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (class expression private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + #method() { + 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); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, ...[1], ...arr,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..481c0323c4 --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-meth-args-trailing-comma-undefined.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-private-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (class expression private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(42, undefined,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-multiple.js b/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..95b139c69d --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-private-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple args (static class expression private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, 'TC39',); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-null.js b/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..cf655d52d8 --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-null.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-private-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (static class expression private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, null,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-single-args.js b/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..805be95fcc --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-private-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (static class expression private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static #method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-spread-operator.js b/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..a6419f4c0a --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/cls-expr-private-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (static class expression private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var C = class { + static #method() { + 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); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, ...[1], ...arr,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-undefined.js b/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..953572992d --- /dev/null +++ b/test/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-private-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (static class expression private method) +esid: sec-argument-lists-runtime-semantics-argumentlistevaluation +features: [class, class-static-methods-private] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ + + +var callCount = 0; +var C = class { + static #method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(42, undefined,); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/func-decl-args-trailing-comma-multiple.js b/test/language/arguments-object/func-decl-args-trailing-comma-multiple.js index 5914d38a2f..72a253cf82 100644 --- a/test/language/arguments-object/func-decl-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/func-decl-args-trailing-comma-multiple.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/func-decl-args-trailing-comma-null.js b/test/language/arguments-object/func-decl-args-trailing-comma-null.js index 5eccfc29de..561cf50616 100644 --- a/test/language/arguments-object/func-decl-args-trailing-comma-null.js +++ b/test/language/arguments-object/func-decl-args-trailing-comma-null.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/func-decl-args-trailing-comma-single-args.js b/test/language/arguments-object/func-decl-args-trailing-comma-single-args.js index fd0d787d3c..c918249243 100644 --- a/test/language/arguments-object/func-decl-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/func-decl-args-trailing-comma-single-args.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/func-decl-args-trailing-comma-spread-operator.js b/test/language/arguments-object/func-decl-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..c435c01928 --- /dev/null +++ b/test/language/arguments-object/func-decl-args-trailing-comma-spread-operator.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/func-decl.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (function declaration) +esid: sec-arguments-exotic-objects +flags: [generated] +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. + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +function ref() { + 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); + callCount = callCount + 1; +} + +ref(42, ...[1], ...arr,); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/test/language/arguments-object/func-decl-args-trailing-comma-undefined.js b/test/language/arguments-object/func-decl-args-trailing-comma-undefined.js index a4158e2241..87d4384488 100644 --- a/test/language/arguments-object/func-decl-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/func-decl-args-trailing-comma-undefined.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/func-expr-args-trailing-comma-multiple.js b/test/language/arguments-object/func-expr-args-trailing-comma-multiple.js index a40af7de8c..4d0a9f8a64 100644 --- a/test/language/arguments-object/func-expr-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/func-expr-args-trailing-comma-multiple.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/func-expr-args-trailing-comma-null.js b/test/language/arguments-object/func-expr-args-trailing-comma-null.js index d6b035aaf1..8f510f0d61 100644 --- a/test/language/arguments-object/func-expr-args-trailing-comma-null.js +++ b/test/language/arguments-object/func-expr-args-trailing-comma-null.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/func-expr-args-trailing-comma-single-args.js b/test/language/arguments-object/func-expr-args-trailing-comma-single-args.js index 21aa7b209f..fd7c8a7868 100644 --- a/test/language/arguments-object/func-expr-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/func-expr-args-trailing-comma-single-args.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/func-expr-args-trailing-comma-spread-operator.js b/test/language/arguments-object/func-expr-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..b1b80b2ef0 --- /dev/null +++ b/test/language/arguments-object/func-expr-args-trailing-comma-spread-operator.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (function expression) +esid: sec-arguments-exotic-objects +flags: [generated] +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. + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function() { + 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); + callCount = callCount + 1; +}; + +ref(42, ...[1], ...arr,); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/test/language/arguments-object/func-expr-args-trailing-comma-undefined.js b/test/language/arguments-object/func-expr-args-trailing-comma-undefined.js index 66e01cc6c1..7bf644a2e8 100644 --- a/test/language/arguments-object/func-expr-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/func-expr-args-trailing-comma-undefined.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-func-decl-args-trailing-comma-multiple.js b/test/language/arguments-object/gen-func-decl-args-trailing-comma-multiple.js index b73ad96bf1..733b493a5a 100644 --- a/test/language/arguments-object/gen-func-decl-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/gen-func-decl-args-trailing-comma-multiple.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-func-decl-args-trailing-comma-null.js b/test/language/arguments-object/gen-func-decl-args-trailing-comma-null.js index c252c630fa..f5d20ba1d3 100644 --- a/test/language/arguments-object/gen-func-decl-args-trailing-comma-null.js +++ b/test/language/arguments-object/gen-func-decl-args-trailing-comma-null.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-func-decl-args-trailing-comma-single-args.js b/test/language/arguments-object/gen-func-decl-args-trailing-comma-single-args.js index 7f328db1d6..445f5cb356 100644 --- a/test/language/arguments-object/gen-func-decl-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/gen-func-decl-args-trailing-comma-single-args.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-func-decl-args-trailing-comma-spread-operator.js b/test/language/arguments-object/gen-func-decl-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..e79d575859 --- /dev/null +++ b/test/language/arguments-object/gen-func-decl-args-trailing-comma-spread-operator.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/gen-func-decl.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (generator function declaration) +esid: sec-arguments-exotic-objects +features: [generators] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +function* ref() { + 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); + callCount = callCount + 1; +} + +ref(42, ...[1], ...arr,).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/test/language/arguments-object/gen-func-decl-args-trailing-comma-undefined.js b/test/language/arguments-object/gen-func-decl-args-trailing-comma-undefined.js index 61582fcbec..acd5c905a9 100644 --- a/test/language/arguments-object/gen-func-decl-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/gen-func-decl-args-trailing-comma-undefined.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-func-expr-args-trailing-comma-multiple.js b/test/language/arguments-object/gen-func-expr-args-trailing-comma-multiple.js index c232b3da19..c4be7c1cb8 100644 --- a/test/language/arguments-object/gen-func-expr-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/gen-func-expr-args-trailing-comma-multiple.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-func-expr-args-trailing-comma-null.js b/test/language/arguments-object/gen-func-expr-args-trailing-comma-null.js index 6b2e6fa82e..677074fc76 100644 --- a/test/language/arguments-object/gen-func-expr-args-trailing-comma-null.js +++ b/test/language/arguments-object/gen-func-expr-args-trailing-comma-null.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-func-expr-args-trailing-comma-single-args.js b/test/language/arguments-object/gen-func-expr-args-trailing-comma-single-args.js index 716b6adcce..33257606d6 100644 --- a/test/language/arguments-object/gen-func-expr-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/gen-func-expr-args-trailing-comma-single-args.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-func-expr-args-trailing-comma-spread-operator.js b/test/language/arguments-object/gen-func-expr-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..a267f22dc5 --- /dev/null +++ b/test/language/arguments-object/gen-func-expr-args-trailing-comma-spread-operator.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/gen-func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (generator function expression) +esid: sec-arguments-exotic-objects +features: [generators] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*() { + 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); + callCount = callCount + 1; +}; + +ref(42, ...[1], ...arr,).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/test/language/arguments-object/gen-func-expr-args-trailing-comma-undefined.js b/test/language/arguments-object/gen-func-expr-args-trailing-comma-undefined.js index 05bb70f7a7..c4d2fee975 100644 --- a/test/language/arguments-object/gen-func-expr-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/gen-func-expr-args-trailing-comma-undefined.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-meth-args-trailing-comma-multiple.js b/test/language/arguments-object/gen-meth-args-trailing-comma-multiple.js index 8450db7438..1f447b823d 100644 --- a/test/language/arguments-object/gen-meth-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/gen-meth-args-trailing-comma-multiple.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-meth-args-trailing-comma-null.js b/test/language/arguments-object/gen-meth-args-trailing-comma-null.js index c908637d24..36e6770980 100644 --- a/test/language/arguments-object/gen-meth-args-trailing-comma-null.js +++ b/test/language/arguments-object/gen-meth-args-trailing-comma-null.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-meth-args-trailing-comma-single-args.js b/test/language/arguments-object/gen-meth-args-trailing-comma-single-args.js index 4b0be137b8..eb369b6274 100644 --- a/test/language/arguments-object/gen-meth-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/gen-meth-args-trailing-comma-single-args.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/gen-meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..c6973097ae --- /dev/null +++ b/test/language/arguments-object/gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (generator method) +esid: sec-arguments-exotic-objects +features: [generators] +flags: [generated] +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. + + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var obj = { + *method() { + 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); + callCount = callCount + 1; + } +}; + +obj.method(42, ...[1], ...arr,).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/test/language/arguments-object/gen-meth-args-trailing-comma-undefined.js b/test/language/arguments-object/gen-meth-args-trailing-comma-undefined.js index 16a8223c65..20d1a4acf4 100644 --- a/test/language/arguments-object/gen-meth-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/gen-meth-args-trailing-comma-undefined.js @@ -16,9 +16,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/meth-args-trailing-comma-multiple.js b/test/language/arguments-object/meth-args-trailing-comma-multiple.js index 61870a87e9..b922d2f39c 100644 --- a/test/language/arguments-object/meth-args-trailing-comma-multiple.js +++ b/test/language/arguments-object/meth-args-trailing-comma-multiple.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/meth-args-trailing-comma-null.js b/test/language/arguments-object/meth-args-trailing-comma-null.js index 27c6ca0ff4..6606883f37 100644 --- a/test/language/arguments-object/meth-args-trailing-comma-null.js +++ b/test/language/arguments-object/meth-args-trailing-comma-null.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/meth-args-trailing-comma-single-args.js b/test/language/arguments-object/meth-args-trailing-comma-single-args.js index 039e1e19f9..7299f005b3 100644 --- a/test/language/arguments-object/meth-args-trailing-comma-single-args.js +++ b/test/language/arguments-object/meth-args-trailing-comma-single-args.js @@ -14,9 +14,18 @@ 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 ---*/ diff --git a/test/language/arguments-object/meth-args-trailing-comma-spread-operator.js b/test/language/arguments-object/meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..79eb6cafa1 --- /dev/null +++ b/test/language/arguments-object/meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-spread-operator.case +// - src/arguments/default/meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using spread args (method) +esid: sec-arguments-exotic-objects +flags: [generated] +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. + + Trailing comma in the arguments list + + Left-Hand-Side Expressions + + Arguments : + ( ) + ( ArgumentList ) + ( ArgumentList , ) + + ArgumentList : + AssignmentExpression + ... AssignmentExpression + ArgumentList , AssignmentExpression + ArgumentList , ... AssignmentExpression +---*/ +var arr = [2, 3]; + + + +var callCount = 0; +var obj = { + method() { + 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); + callCount = callCount + 1; + } +}; + +obj.method(42, ...[1], ...arr,); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/arguments-object/meth-args-trailing-comma-undefined.js b/test/language/arguments-object/meth-args-trailing-comma-undefined.js index 6b9bf88ea4..5387e94596 100644 --- a/test/language/arguments-object/meth-args-trailing-comma-undefined.js +++ b/test/language/arguments-object/meth-args-trailing-comma-undefined.js @@ -14,9 +14,18 @@ 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 ---*/