diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/arguments-object | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/arguments-object')
269 files changed, 12262 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/arguments-object/10.5-1-s-strict.js b/js/src/tests/test262/language/arguments-object/10.5-1-s-strict.js new file mode 100644 index 0000000000..29b2673432 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.5-1-s-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.5-1-s +description: Strict Mode - arguments object is immutable +flags: [onlyStrict] +---*/ + + +assert.throws(SyntaxError, function() { + (function fun() { + eval("arguments = 10"); + })(30); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.5-1gs-strict.js b/js/src/tests/test262/language/arguments-object/10.5-1gs-strict.js new file mode 100644 index 0000000000..9baf855e42 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.5-1gs-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.5-1gs +description: Strict Mode - arguments cannot be assigned to in a strict function +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + + +function f_10_5_1_gs(){ + arguments = 7; +} diff --git a/js/src/tests/test262/language/arguments-object/10.5-7-b-1-s-strict.js b/js/src/tests/test262/language/arguments-object/10.5-7-b-1-s-strict.js new file mode 100644 index 0000000000..6b8ce48b9c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.5-7-b-1-s-strict.js @@ -0,0 +1,16 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.5-7-b-1-s +description: Strict Mode - arguments object is immutable in eval'ed functions +flags: [onlyStrict] +---*/ + + +assert.throws(SyntaxError, function() { + eval("(function _10_5_7_b_1_fun() { arguments = 10;} ());"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.5-7-b-2-s.js b/js/src/tests/test262/language/arguments-object/10.5-7-b-2-s.js new file mode 100644 index 0000000000..02a96e8ce6 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.5-7-b-2-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.5-7-b-2-s +description: Arguments object index assignment is allowed +---*/ + + function _10_5_7_b_2_fun() { + arguments[7] = 12; + return arguments[7] === 12; + }; + +assert(_10_5_7_b_2_fun(30), '_10_5_7_b_2_fun(30) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.5-7-b-3-s.js b/js/src/tests/test262/language/arguments-object/10.5-7-b-3-s.js new file mode 100644 index 0000000000..3aede65c47 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.5-7-b-3-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.5-7-b-3-s +description: > + Adding property to the arguments object successful under strict mode +---*/ + + function _10_5_7_b_3_fun() { + arguments[1] = 12; + return arguments[0] === 30 && arguments[1] === 12; + }; + +assert(_10_5_7_b_3_fun(30), '_10_5_7_b_3_fun(30) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.5-7-b-4-s.js b/js/src/tests/test262/language/arguments-object/10.5-7-b-4-s.js new file mode 100644 index 0000000000..3eab81bce3 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.5-7-b-4-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.5-7-b-4-s +description: > + Deleting property of the arguments object successful under strict mode +---*/ + + function _10_5_7_b_4_fun() { + var _10_5_7_b_4_1 = arguments[0] === 30 && arguments[1] === 12; + delete arguments[1]; + var _10_5_7_b_4_2 = arguments[0] === 30 && typeof arguments[1] === "undefined"; + return _10_5_7_b_4_1 && _10_5_7_b_4_2; + }; + +assert(_10_5_7_b_4_fun(30, 12), '_10_5_7_b_4_fun(30, 12) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-10-c-ii-1-s-strict.js b/js/src/tests/test262/language/arguments-object/10.6-10-c-ii-1-s-strict.js new file mode 100644 index 0000000000..6c23403ce6 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-10-c-ii-1-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-10-c-ii-1-s +description: > + arguments[i] remains same after changing actual parameters in + strict mode +flags: [onlyStrict] +---*/ + + function foo(a,b,c) + { + a = 1; b = 'str'; c = 2.1; + return (arguments[0] === 10 && arguments[1] === 'sss' && arguments[2] === 1); + } + +assert(foo(10, 'sss', 1), 'foo(10, "sss", 1) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-10-c-ii-1.js b/js/src/tests/test262/language/arguments-object/10.6-10-c-ii-1.js new file mode 100644 index 0000000000..e70b410abf --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-10-c-ii-1.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-10-c-ii-1 +description: arguments[i] change with actual parameters +flags: [noStrict] +---*/ + + function foo(a,b,c) + { + a = 1; b = 'str'; c = 2.1; + if(arguments[0] === 1 && arguments[1] === 'str' && arguments[2] === 2.1) + return true; + } + +assert(foo(10,'sss',1), 'foo(10,"sss",1) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-10-c-ii-2.js b/js/src/tests/test262/language/arguments-object/10.6-10-c-ii-2.js new file mode 100644 index 0000000000..1a63d5e555 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-10-c-ii-2.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-10-c-ii-2 +description: arguments[i] map to actual parameter +flags: [noStrict] +---*/ + + function foo(a,b,c) + { + arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1; + if(1 === a && 'str' === b && 2.1 === c) + return true; + } + +assert(foo(10,'sss',1), 'foo(10,"sss",1) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-11-b-1.js b/js/src/tests/test262/language/arguments-object/10.6-11-b-1.js new file mode 100644 index 0000000000..0f58985b30 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-11-b-1.js @@ -0,0 +1,53 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-11-b-1 +description: > + Arguments Object has index property '0' as its own property, it + shoulde be writable, enumerable, configurable and does not invoke + the setter defined on Object.prototype[0] (Step 11.b) +---*/ + + var data = "data"; + var getFunc = function () { + return data; + }; + + var setFunc = function (value) { + data = value; + }; + + Object.defineProperty(Object.prototype, "0", { + get: getFunc, + set: setFunc, + configurable: true + }); + + var argObj = (function () { return arguments })(1); + + var verifyValue = false; + verifyValue = (argObj[0] === 1); + + var verifyEnumerable = false; + for (var p in argObj) { + if (p === "0" && argObj.hasOwnProperty("0")) { + verifyEnumerable = true; + } + } + + var verifyWritable = false; + argObj[0] = 1001; + verifyWritable = (argObj[0] === 1001); + + var verifyConfigurable = false; + delete argObj[0]; + verifyConfigurable = argObj.hasOwnProperty("0"); + +assert(verifyValue, 'verifyValue !== true'); +assert(verifyWritable, 'verifyWritable !== true'); +assert(verifyEnumerable, 'verifyEnumerable !== true'); +assert.sameValue(verifyConfigurable, false, 'verifyConfigurable'); +assert.sameValue(data, "data", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-12-1.js b/js/src/tests/test262/language/arguments-object/10.6-12-1.js new file mode 100644 index 0000000000..daeeed45a5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-12-1.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-12-1 +description: Accessing callee property of Arguments object is allowed +flags: [noStrict] +---*/ + +function testcase() { + arguments.callee; + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-12-2.js b/js/src/tests/test262/language/arguments-object/10.6-12-2.js new file mode 100644 index 0000000000..d5c24aa17d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-12-2.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-12-2 +description: arguments.callee has correct attributes +flags: [noStrict] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(arguments,"callee"); + + assert.sameValue(desc.configurable, true, 'desc.configurable'); + assert.sameValue(desc.enumerable, false, 'desc.enumerable'); + assert.sameValue(desc.writable, true, 'desc.writable'); + assert.sameValue(desc.hasOwnProperty('get'), false, 'desc.hasOwnProperty("get")'); + assert.sameValue(desc.hasOwnProperty('set'), false, 'desc.hasOwnProperty("set")'); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-13-a-1.js b/js/src/tests/test262/language/arguments-object/10.6-13-a-1.js new file mode 100644 index 0000000000..558cd58b5a --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-13-a-1.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-13-a-1 +description: > + In non-strict mode, arguments object should have its own 'callee' + property defined (Step 13.a) +flags: [noStrict] +---*/ + + Object.defineProperty(Object.prototype, "callee", { + value: 1, + writable: false, + configurable: true + }); + + var argObj = (function () { return arguments })(); + + var verifyValue = false; + verifyValue = typeof argObj.callee === "function"; + + var verifyWritable = false; + argObj.callee = 1001; + verifyWritable = (argObj.callee === 1001); + + var verifyEnumerable = false; + for (var p in argObj) { + if (p === "callee" && argObj.hasOwnProperty("callee")) { + verifyEnumerable = true; + } + } + + var verifyConfigurable = false; + delete argObj.callee; + verifyConfigurable = argObj.hasOwnProperty("callee"); + +assert(verifyValue, 'verifyValue !== true'); +assert(verifyWritable, 'verifyWritable !== true'); +assert.sameValue(verifyEnumerable, false, 'verifyEnumerable'); +assert.sameValue(verifyConfigurable, false, 'verifyConfigurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-13-a-2.js b/js/src/tests/test262/language/arguments-object/10.6-13-a-2.js new file mode 100644 index 0000000000..0b931d001a --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-13-a-2.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-13-a-2 +description: A direct call to arguments.callee.caller should work +flags: [noStrict] +features: [caller] +---*/ + + var called = false; + + function test1(flag) { + if (flag!==true) { + test2(); + } else { + called = true; + } + } + + function test2() { + if(arguments.callee.caller===undefined) { + called=true; // Extension not supported - fake it + } else { + arguments.callee.caller(true); + } + } + + test1(); + +assert(called, 'called !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-13-a-3.js b/js/src/tests/test262/language/arguments-object/10.6-13-a-3.js new file mode 100644 index 0000000000..ebe4e1b5f5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-13-a-3.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-13-a-3 +description: An indirect call to arguments.callee.caller should work +flags: [noStrict] +features: [caller] +---*/ + + var called = false; + + function test1(flag) { + if (flag!==true) { + test2(); + } else { + called = true; + } + } + + function test2() { + if (arguments.callee.caller===undefined) { + called = true; //Extension not supported - fake it + } else { + var explicit = arguments.callee.caller; + explicit(true); + } + } + + test1(); + +assert(called, 'called !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-13-c-1-s-strict.js b/js/src/tests/test262/language/arguments-object/10.6-13-c-1-s-strict.js new file mode 100644 index 0000000000..b75ab83e8e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-13-c-1-s-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-13-c-1-s +description: > + Accessing callee property of Arguments object throws TypeError in + strict mode +flags: [onlyStrict] +---*/ + + +assert.throws(TypeError, function() { + arguments.callee; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-13-c-2-s.js b/js/src/tests/test262/language/arguments-object/10.6-13-c-2-s.js new file mode 100644 index 0000000000..1344ab2735 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-13-c-2-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-13-c-2-s +description: arguments.callee is exists +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(arguments,"callee"); + assert.notSameValue(desc, undefined); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-13-c-3-s-strict.js b/js/src/tests/test262/language/arguments-object/10.6-13-c-3-s-strict.js new file mode 100644 index 0000000000..93c0b6c8a2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-13-c-3-s-strict.js @@ -0,0 +1,23 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-13-c-3-s +description: arguments.callee is non-configurable in strict mode +flags: [onlyStrict] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(arguments,"callee"); + + assert.sameValue(desc.configurable, false, 'desc.configurable'); + assert.sameValue(desc.enumerable, false, 'desc.enumerable'); + assert.sameValue(desc.hasOwnProperty('value'), false, 'desc.hasOwnProperty("value")'); + assert.sameValue(desc.hasOwnProperty('writable'), false, 'desc.hasOwnProperty("writable")'); + assert.sameValue(desc.hasOwnProperty('get'), true, 'desc.hasOwnProperty("get")'); + assert.sameValue(desc.hasOwnProperty('set'), true, 'desc.hasOwnProperty("set")'); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-14-c-1-s.js b/js/src/tests/test262/language/arguments-object/10.6-14-c-1-s.js new file mode 100644 index 0000000000..71652d3e59 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-14-c-1-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-14-c-1-s +description: > + [[Enumerable]] attribute value in 'callee' is false +---*/ + + var argObj = function () { + return arguments; + } (); + + var verifyEnumerable = false; + for (var _10_6_14_c_1 in argObj) { + if (argObj.hasOwnProperty(_10_6_14_c_1) && _10_6_14_c_1 === "callee") { + verifyEnumerable = true; + } + } + +assert.sameValue(verifyEnumerable, false, 'verifyEnumerable'); +assert(argObj.hasOwnProperty("callee"), 'argObj.hasOwnProperty("callee") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-14-c-4-s-strict.js b/js/src/tests/test262/language/arguments-object/10.6-14-c-4-s-strict.js new file mode 100644 index 0000000000..97974d6dc5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-14-c-4-s-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-14-c-4-s +description: > + Strict Mode - TypeError is thrown when accessing the [[Set]] + attribute in 'callee' under strict mode +flags: [onlyStrict] +---*/ + + var argObj = function () { + return arguments; + } (); +assert.throws(TypeError, function() { + argObj.callee = {}; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-2gs-strict.js b/js/src/tests/test262/language/arguments-object/10.6-2gs-strict.js new file mode 100644 index 0000000000..b358a4a312 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-2gs-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-2gs +description: > + Strict Mode - arguments.callee cannot be accessed in a strict + function +flags: [onlyStrict] +---*/ + +function f_10_6_1_gs(){ + return arguments.callee; +} + +assert.throws(TypeError, function() { + f_10_6_1_gs(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-5-1.js b/js/src/tests/test262/language/arguments-object/10.6-5-1.js new file mode 100644 index 0000000000..1dc26213af --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-5-1.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-5-1 +description: > + [[Prototype]] property of Arguments is set to Object prototype + object +---*/ + +function testcase() { + assert.sameValue(Object.getPrototypeOf(arguments), Object.getPrototypeOf({})); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-6-1.js b/js/src/tests/test262/language/arguments-object/10.6-6-1.js new file mode 100644 index 0000000000..57f9c26f34 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-6-1.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-6-1 +description: "'length property of arguments object exists" +---*/ + +function testcase() { + + var desc = Object.getOwnPropertyDescriptor(arguments,"length"); + assert.notSameValue(desc, undefined); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-6-2.js b/js/src/tests/test262/language/arguments-object/10.6-6-2.js new file mode 100644 index 0000000000..4b41d05664 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-6-2.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-6-2 +description: "'length' property of arguments object has correct attributes" +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(arguments,"length"); + + assert.sameValue(desc.configurable, true, 'desc.configurable'); + assert.sameValue(desc.enumerable, false, 'desc.enumerable'); + assert.sameValue(desc.writable, true, 'desc.writable'); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-6-3-s.js b/js/src/tests/test262/language/arguments-object/10.6-6-3-s.js new file mode 100644 index 0000000000..0d22242015 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-6-3-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-6-3 +description: > + 'length' property of arguments object for 0 argument function + exists +---*/ + +function testcase() { + assert.sameValue(arguments.length, 0); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-6-3.js b/js/src/tests/test262/language/arguments-object/10.6-6-3.js new file mode 100644 index 0000000000..40b738b292 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-6-3.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-6-3 +description: > + 'length' property of arguments object for 0 argument function + exists +flags: [noStrict] +---*/ + +function testcase() { + var arguments= undefined; + (function () { assert.sameValue(arguments.length, 0); })(); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-6-4-s.js b/js/src/tests/test262/language/arguments-object/10.6-6-4-s.js new file mode 100644 index 0000000000..c416a75811 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-6-4-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-6-4 +description: > + 'length' property of arguments object for 0 argument function call + is 0 even with formal parameters +---*/ + +function testcase(a,b,c) { + assert.sameValue(arguments.length, 0); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-6-4.js b/js/src/tests/test262/language/arguments-object/10.6-6-4.js new file mode 100644 index 0000000000..2b53085c06 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-6-4.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-6-4 +description: > + 'length' property of arguments object for 0 argument function call + is 0 even with formal parameters +flags: [noStrict] +---*/ + +function testcase() { + var arguments= undefined; + (function (a,b,c) { assert.sameValue(arguments.length, 0); })(); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/10.6-7-1.js b/js/src/tests/test262/language/arguments-object/10.6-7-1.js new file mode 100644 index 0000000000..f889e467ce --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/10.6-7-1.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-7-1 +description: > + Arguments Object has length as its own property and does not + invoke the setter defined on Object.prototype.length (Step 7) +---*/ + + var data = "data"; + var getFunc = function () { + return 12; + }; + + var setFunc = function (value) { + data = value; + }; + + Object.defineProperty(Object.prototype, "length", { + get: getFunc, + set: setFunc, + configurable: true + }); + + var verifyValue = false; + var argObj = (function () { return arguments })(); + verifyValue = (argObj.length === 0); + + var verifyWritable = false; + argObj.length = 1001; + verifyWritable = (argObj.length === 1001); + + var verifyEnumerable = false; + for (var p in argObj) { + if (p === "length") { + verifyEnumerable = true; + } + } + + var verifyConfigurable = false; + delete argObj.length; + verifyConfigurable = argObj.hasOwnProperty("length"); + +assert(verifyValue, 'verifyValue !== true'); +assert(verifyWritable, 'verifyWritable !== true'); +assert.sameValue(verifyEnumerable, false, 'verifyEnumerable'); +assert.sameValue(verifyConfigurable, false, 'verifyConfigurable'); +assert.sameValue(data, "data", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.1.6_A1_T2.js b/js/src/tests/test262/language/arguments-object/S10.1.6_A1_T2.js new file mode 100644 index 0000000000..f7f57505d9 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.1.6_A1_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The activation object is initialised with a property with name arguments + and attributes {DontDelete} +es5id: 10.1.6_A1_T2 +description: Checking funtion which returns property "arguments" +---*/ + +var ARG_STRING = "value of the argument property"; + +function f1() { + this.constructor.prototype.arguments = ARG_STRING; + return arguments; +} + +//CHECK#1 +if ((new f1(1,2,3,4,5)).length !== 5) + throw new Test262Error('#1: (new f1(1,2,3,4,5)).length===5, where f1 returns "arguments" that is set to "'+ ARG_STRING + '"'); + +//CHECK#2 +if ((new f1(1,2,3,4,5))[3] !== 4) + throw new Test262Error('#2: (new f1(1,2,3,4,5))[3]===4, where f1 returns "arguments" that is set to "'+ ARG_STRING + '"'); + +//CHECK#3 +var x = new f1(1,2,3,4,5); +if (delete x[3] !== true) + throw new Test262Error('#3.1: Function parameters have attribute {DontDelete}'); + +if (x[3] === 4) + throw new Test262Error('#3.2: Function parameters have attribute {DontDelete}'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A1.js b/js/src/tests/test262/language/arguments-object/S10.6_A1.js new file mode 100644 index 0000000000..0ab1510810 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A1.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When control enters an execution context for function code, + an arguments object is created and initialised +es5id: 10.6_A1 +description: Executing function which uses arguments object +---*/ + +//CHECK#1 +function f1(){ + return arguments; +} + +try{ + var x = f1(); +} +catch(e){ + throw new Test262Error("#1: arguments doesn't exists"); +} + +//CHECK#2 +var f2 = function(){ + return arguments; +} + +try{ + var x = f2(); +} +catch(e){ + throw new Test262Error("#2: arguments doesn't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A2.js b/js/src/tests/test262/language/arguments-object/S10.6_A2.js new file mode 100644 index 0000000000..1e1d556032 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The value of the internal [[Prototype]] property of the + created arguments object is the original Object prototype object, the one + that is the initial value of Object.prototype +es5id: 10.6_A2 +description: Checking arguments.constructor.prototype===Object.prototype +---*/ + +//CHECK#1 +function f1(){ + return arguments.constructor.prototype; +} +try{ + if(f1() !== Object.prototype){ + throw new Test262Error('#1: arguments.constructor.prototype === Object.prototype'); + } +} +catch(e){ + throw new Test262Error("#1: arguments doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.constructor.prototype;}; +try{ + if(f2() !== Object.prototype){ + throw new Test262Error('#2: arguments.constructor.prototype === Object.prototype'); + } +} +catch(e){ + throw new Test262Error("#2: arguments doesn't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A3_T1.js b/js/src/tests/test262/language/arguments-object/S10.6_A3_T1.js new file mode 100644 index 0000000000..a8de822572 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A3_T1.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + A property is created with name callee with property + attributes { DontEnum } and no others +es5id: 10.6_A3_T1 +description: Checking existence of arguments.callee property +---*/ + +//CHECK#1 +function f1(){ + return arguments.hasOwnProperty("callee"); +} +try{ + if(f1() !== true){ + throw new Test262Error("#1: arguments object doesn't contains property 'callee'"); + } +} +catch(e){ + throw new Test262Error("#1: arguments object doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.hasOwnProperty("callee");}; +try{ + if(f2() !== true){ + throw new Test262Error("#2: arguments object doesn't contains property 'callee'"); + } +} +catch(e){ + throw new Test262Error("#2: arguments object doesn't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A3_T2.js b/js/src/tests/test262/language/arguments-object/S10.6_A3_T2.js new file mode 100644 index 0000000000..04aa017116 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A3_T2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + A property is created with name callee with property + attributes { DontEnum } and no others +es5id: 10.6_A3_T2 +description: Checking if enumerating the arguments.callee property fails +---*/ + +//CHECK#1 +function f1(){ + for(var x in arguments){ + if (x === "callee"){ + return false; + } + } + return true; +} + +try{ + if(!f1()){ + throw new Test262Error("#1: A property callee don't have attribute { DontEnum }"); + } +} +catch(e){ + throw new Test262Error("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + for(var x in arguments){ + if (x === "callee"){ + return false; + } + } + return true; +} + +try{ + if(!f2()){ + throw new Test262Error("#2: A property callee don't have attribute { DontEnum }"); + } +} +catch(e){ + throw new Test262Error("#2: arguments object don't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A3_T3.js b/js/src/tests/test262/language/arguments-object/S10.6_A3_T3.js new file mode 100644 index 0000000000..60fe503a59 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A3_T3.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + A property is created with name callee with property + attributes { DontEnum } and no others +es5id: 10.6_A3_T3 +description: Checking if deleting arguments.callee property fails +flags: [noStrict] +---*/ + +//CHECK#1 +function f1(){ + return (delete arguments.callee); +} + +try{ + if(!f1()){ + throw new Test262Error("#1: A property callee have attribute { DontDelete }"); + } +} +catch(e){ + throw new Test262Error("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + return (delete arguments.callee); +} + +try{ + if(!f2()){ + throw new Test262Error("#2: A property callee have attribute { DontDelete }"); + } +} +catch(e){ + throw new Test262Error("#2: arguments object don't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A3_T4.js b/js/src/tests/test262/language/arguments-object/S10.6_A3_T4.js new file mode 100644 index 0000000000..94f11c97f2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A3_T4.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + A property is created with name callee with property + attributes { DontEnum } and no others +es5id: 10.6_A3_T4 +description: Overriding arguments.callee property +flags: [noStrict] +---*/ + +var str = "something different"; +//CHECK#1 +function f1(){ + arguments.callee = str; + return arguments; +} + +try{ + if(f1().callee !== str){ + throw new Test262Error("#1: A property callee have attribute { ReadOnly }"); + } +} +catch(e){ + throw new Test262Error("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + arguments.callee = str; + return arguments; + } +try{ + if(f2().callee !== str){ + throw new Test262Error("#2: A property callee have attribute { ReadOnly }"); + } +} +catch(e){ + throw new Test262Error("#2: arguments object don't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A4.js b/js/src/tests/test262/language/arguments-object/S10.6_A4.js new file mode 100644 index 0000000000..53571ea055 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A4.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The initial value of the created property callee is the + Function object being executed +es5id: 10.6_A4 +description: Checking that arguments.callee === function object +flags: [noStrict] +---*/ + +//CHECK#1 +function f1(){ + return arguments.callee; +} + +try{ + if(f1 !== f1()){ + throw new Test262Error('#1: arguments.callee === f1'); + } +} +catch(e){ + throw new Test262Error("#1: arguments object doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.callee;}; + +try{ + if(f2 !== f2()){ + throw new Test262Error('#2: arguments.callee === f2'); + } +} +catch(e){ + throw new Test262Error("#1: arguments object doesn't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A5_T1.js b/js/src/tests/test262/language/arguments-object/S10.6_A5_T1.js new file mode 100644 index 0000000000..c30519e05e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A5_T1.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + A property is created with name length with property + attributes { DontEnum } and no others +es5id: 10.6_A5_T1 +description: Checking existence of arguments.length property +---*/ + +//CHECK#1 +function f1(){ + return arguments.hasOwnProperty("length"); +} +try{ + if(f1() !== true){ + throw new Test262Error("#1: arguments object doesn't contains property 'length'"); + } +} +catch(e){ + throw new Test262Error("#1: arguments object doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.hasOwnProperty("length");}; +try{ + if(f2() !== true){ + throw new Test262Error("#2: arguments object doesn't contains property 'length'"); + } +} +catch(e){ + throw new Test262Error("#2: arguments object doesn't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A5_T2.js b/js/src/tests/test262/language/arguments-object/S10.6_A5_T2.js new file mode 100644 index 0000000000..e6cb62bb46 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A5_T2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + A property is created with name length with property + attributes { DontEnum } and no others +es5id: 10.6_A5_T2 +description: Checking if enumerating the arguments.length property fails +---*/ + +//CHECK#1 +function f1(){ + for(var x in arguments){ + if (x === "length"){ + return false; + } + } + return true; +} + +try{ + if(!f1()){ + throw new Test262Error("#1: A property length don't have attribute { DontEnum }"); + } +} +catch(e){ + throw new Test262Error("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + for(var x in arguments){ + if (x === "length"){ + return false; + } + } + return true; +} + +try{ + if(!f2()){ + throw new Test262Error("#2: A property length don't have attribute { DontEnum }"); + } +} +catch(e){ + throw new Test262Error("#2: arguments object don't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A5_T3.js b/js/src/tests/test262/language/arguments-object/S10.6_A5_T3.js new file mode 100644 index 0000000000..e3bc814660 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A5_T3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + A property is created with name length with property + attributes { DontEnum } and no others +es5id: 10.6_A5_T3 +description: Checking if deleting arguments.length property fails +---*/ + +//CHECK#1 +function f1(){ + return (delete arguments.length); +} + +try{ + if(!f1()){ + throw new Test262Error("#1: A property length have attribute { DontDelete }"); + } +} +catch(e){ + throw new Test262Error("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + return (delete arguments.length); +} + +try{ + if(!f2()){ + throw new Test262Error("#2: A property length have attribute { DontDelete }"); + } +} +catch(e){ + throw new Test262Error("#2: arguments object don't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A5_T4.js b/js/src/tests/test262/language/arguments-object/S10.6_A5_T4.js new file mode 100644 index 0000000000..d3583df422 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A5_T4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + A property is created with name length with property + attributes { DontEnum } and no others +es5id: 10.6_A5_T4 +description: Overriding arguments.length property +---*/ + +var str = "something different"; +//CHECK#1 +function f1(){ + arguments.length = str; + return arguments; +} + +try{ + if(f1().length !== str){ + throw new Test262Error("#1: A property length have attribute { ReadOnly }"); + } +} +catch(e){ + throw new Test262Error("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + arguments.length = str; + return arguments; + }; +try{ + if(f2().length !== str){ + throw new Test262Error("#2: A property length have attribute { ReadOnly }"); + } +} +catch(e){ + throw new Test262Error("#2: arguments object don't exists"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A6.js b/js/src/tests/test262/language/arguments-object/S10.6_A6.js new file mode 100644 index 0000000000..8e9ffe3cdb --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A6.js @@ -0,0 +1,68 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The initial value of the created property length is the number + of actual parameter values supplied by the caller +es5id: 10.6_A6 +description: Create function, that returned arguments.length +---*/ + +function f1(){ + return arguments.length; +} + +//CHECK#1 +if(!(f1() === 0)){ + throw new Test262Error('#1: argument.length === 0'); +} + +//CHECK#2 +if(!(f1(0) === 1)){ + throw new Test262Error('#2: argument.length === 1'); +} + +//CHECK#3 +if(!(f1(0, 1) === 2)){ + throw new Test262Error('#3: argument.length === 2'); +} + +//CHECK#4 +if(!(f1(0, 1, 2) === 3)){ + throw new Test262Error('#4: argument.length === 3'); +} + +//CHECK#5 +if(!(f1(0, 1, 2, 3) === 4)){ + throw new Test262Error('#5: argument.length === 4'); +} + +var f2 = function(){return arguments.length;}; + +//CHECK#6 +if(!(f2() === 0)){ + throw new Test262Error('#6: argument.length === 0'); +} + +//CHECK#7 +if(!(f2(0) === 1)){ + throw new Test262Error('#7: argument.length === 1'); +} + +//CHECK#8 +if(!(f2(0, 1) === 2)){ + throw new Test262Error('#8: argument.length === 2'); +} + +//CHECK#9 +if(!(f2(0, 1, 2) === 3)){ + throw new Test262Error('#9: argument.length === 3'); +} + +//CHECK#10 +if(!(f2(0, 1, 2, 3) === 4)){ + throw new Test262Error('#10: argument.length === 4'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/S10.6_A7.js b/js/src/tests/test262/language/arguments-object/S10.6_A7.js new file mode 100644 index 0000000000..0a22e7112c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/S10.6_A7.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Get arguments of function +es5id: 10.6_A7 +description: Use property arguments +---*/ + +function f1() { + return arguments; +} + +//CHECK#1-5 +for(var i = 1; i < 5; i++){ + if (f1(1,2,3,4,5)[i] !== (i+1)) + throw new Test262Error("#"+i+": Returning function's arguments work wrong, f1(1,2,3,4,5)["+i+"] !== "+(i+1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/arguments-caller.js b/js/src/tests/test262/language/arguments-object/arguments-caller.js new file mode 100644 index 0000000000..5276952550 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/arguments-caller.js @@ -0,0 +1,14 @@ +// Copyright (c) 2016 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arguments-exotic-objects +description: arguments.caller does not exist +---*/ + +function getArguments() { + return arguments; +} +assert.sameValue(Object.getOwnPropertyDescriptor(getArguments(), 'caller'), undefined, 'arguments.caller does not exist'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..84b745a698 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/async-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +var obj = { + async *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..7c59db0f4b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/async-gen-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +var obj = { + async *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..6f43609fc0 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/async-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +var obj = { + async *method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(42,).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..607eef915b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,60 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..b0cabe0ac6 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/async-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/async-gen-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +var obj = { + async *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..905b3ae824 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-multiple.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/async-gen-named-func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; +}; + +ref(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-null.js new file mode 100644 index 0000000000..5ebac2ff7e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-null.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/async-gen-named-func-expr.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; +}; + +ref(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..641a08a94c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-single-args.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/async-gen-named-func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; +}; + +ref(42,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..5f16f6e707 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-spread-operator.js @@ -0,0 +1,53 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..0eaa11cb5a --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/async-gen-named-func-expr-args-trailing-comma-undefined.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/async-gen-named-func-expr.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; +}; + +ref(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/browser.js b/js/src/tests/test262/language/arguments-object/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/browser.js diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..5229f519f4 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-multiple.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/async-gen-func-decl.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +// Stores a reference `ref` for case evaluation +async function* ref() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; +} + +ref(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-null.js new file mode 100644 index 0000000000..b81596454a --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-null.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/async-gen-func-decl.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +async function* ref() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; +} + +ref(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..560af6e844 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-single-args.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/async-gen-func-decl.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +// Stores a reference `ref` for case evaluation +async function* ref() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; +} + +ref(42,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..ad895f5d22 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-spread-operator.js @@ -0,0 +1,52 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..a2b5b4cc25 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-undefined.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/async-gen-func-decl.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +async function* ref() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; +} + +ref(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..c38d172b25 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-async-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +class C { + async *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..031939ce32 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-async-gen-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +class C { + async *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..8fac0d78c5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-async-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +class C { + async *method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..6ece8ba21d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,78 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..1119a6812d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-async-gen-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +class C { + async *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..32053bcf61 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-async-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 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; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..6215495a3c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-async-gen-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 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; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..af9d5ef2c5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-async-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +class C { + static async *method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..cf63b04f37 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..d0b44c992e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-async-gen-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 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; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..b3350dd996 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,75 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..b55faa8fc0 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,75 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..c267618428 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,74 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..18f20b6678 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..e7bf8e0c42 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,75 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..7c17a6a375 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,56 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..4dc426ad1d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,56 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..44b9b24fe4 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,55 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..404a0c93f8 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,60 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..c3bac83420 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,56 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..7ef0401a22 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +class C { + *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } +} + +C.prototype.method(42, 'TC39',).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..4fff6d029d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-gen-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +class C { + *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } +} + +C.prototype.method(42, null,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..214d652bda --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +class C { + *method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +} + +C.prototype.method(42,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..bd32f75bbc --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,55 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..ec9fbe921d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-gen-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +class C { + *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } +} + +C.prototype.method(42, undefined,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..84fbdab101 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +class C { + static *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } +} + +C.method(42, 'TC39',).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..49d4e14594 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-gen-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +class C { + static *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } +} + +C.method(42, null,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..62ec275158 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +class C { + static *method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +} + +C.method(42,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..09d2269e0b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,55 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..9039ea2ad6 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-gen-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +class C { + static *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } +} + +C.method(42, undefined,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..c5a0276747 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-multiple.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +class C { + method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } +} + +C.prototype.method(42, 'TC39',); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..f5042adb09 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-null.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +class C { + method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } +} + +C.prototype.method(42, null,); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..429e9358aa --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-single-args.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +class C { + method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +} + +C.prototype.method(42,); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..0cfa422b0b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-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-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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..abb7380be4 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-meth-args-trailing-comma-undefined.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +class C { + method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } +} + +C.prototype.method(42, undefined,); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..5dca46e339 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-decl-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +class C { + static method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } +} + +C.method(42, 'TC39',); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..d3beb7c09c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-null.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-decl-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +class C { + static method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } +} + +C.method(42, null,); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..113fd6f98b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-decl-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +class C { + static method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +} + +C.method(42,); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..b0cb1b1c6b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-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-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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..100cd25594 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-decl-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +class C { + static method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } +} + +C.method(42, undefined,); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..adad33d366 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..926a6877c1 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..f14bdf279e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,51 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..88e9e652a2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,56 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..bde3b71ec1 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..6c05f361b7 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..87149d6768 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..3e203c2969 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,51 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..cc06b87808 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,56 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..075b303965 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..8ebe343f23 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-multiple.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..e11834be6f --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-null.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..3190e3ce15 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-single-args.js @@ -0,0 +1,51 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..8aae75ff6e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,56 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..845dbd4b38 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-args-trailing-comma-undefined.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..da69fa67bb --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..80ec052852 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-null.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..b3332fbe2c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,51 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..ca2cbd696e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,56 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..624ae70fe3 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..907f2d5de6 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-multiple.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/async-gen-func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; +}; + +ref(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-null.js new file mode 100644 index 0000000000..c389f1ec4c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-null.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/async-gen-func-expr.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; +}; + +ref(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..4a5d11c495 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-single-args.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/async-gen-func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; +}; + +ref(42,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..a4a64f3722 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-spread-operator.js @@ -0,0 +1,53 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..1f42ccbde8 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-func-args-trailing-comma-undefined.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/async-gen-func-expr.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; +}; + +ref(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..596a517ba3 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-async-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 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; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..4766ae650d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-async-gen-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 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; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..a06bf5723b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-async-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +var C = class { + async *method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..86fbb5e4f5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,81 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..d0002fde3b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-async-gen-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 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; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..c6b3065922 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-async-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 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; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, 'TC39',).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..23cbbd7e2c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-async-gen-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 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; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, null,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..99a763eb76 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-async-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +var C = class { + static async *method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..292829d569 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..2608243b16 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-async-gen-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 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; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, undefined,).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..3b8f44b995 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,78 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..6c87a97faa --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,78 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..d1e0518e07 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..1b2532dba4 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,82 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..07befbe246 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,78 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..8bf6c86666 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..5b7b6a9d78 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..2e93f650e2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,76 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..863740aae5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,81 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..482a65094b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..00f5d8ba64 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +var C = class { + *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, 'TC39',).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..e926bf1519 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +var C = class { + *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, null,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..1aef6d81a1 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +var C = class { + *method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +}; + +C.prototype.method(42,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..b8350f3254 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,55 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..b0cbac8aa0 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +var C = class { + *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, undefined,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..bf3b368677 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 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; + } +}; + +C.method(42, 'TC39',).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..0f36f0a3e8 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 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; + } +}; + +C.method(42, null,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..0fbd0feaa6 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +var C = class { + static *method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +}; + +C.method(42,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..385b91cbb0 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,55 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..6da48e7783 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 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; + } +}; + +C.method(42, undefined,).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..3ce5995992 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-multiple.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +var C = class { + method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, 'TC39',); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..b90750d256 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-null.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +var C = class { + method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, null,); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..565edee983 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-single-args.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +var C = class { + method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +}; + +C.prototype.method(42,); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..b5de137fb0 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-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-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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..b109368ca1 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-meth-args-trailing-comma-undefined.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +var C = class { + method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, undefined,); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..f40b112d39 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/cls-expr-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 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; + } +}; + +C.method(42, 'TC39',); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..9dd835d53c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-null.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/cls-expr-meth-static.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 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; + } +}; + +C.method(42, null,); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..0ec9e3c32f --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/cls-expr-meth-static.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +var C = class { + static method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +}; + +C.method(42,); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..cc20dae198 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-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-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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..72eb7b0373 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/cls-expr-meth-static.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 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; + } +}; + +C.method(42, undefined,); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..30263921b8 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..be66c8cb0e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-null.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..386cc3cdbd --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,51 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..bbd54a77ef --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,56 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..63c0b2cf48 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..1d9414d51d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..3004a677e5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-null.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..3db27dc9d2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,51 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..7bef7101c0 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,56 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..2941427504 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..75c3fd6008 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-multiple.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..63dfae4c7f --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-null.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..e765abf38f --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-single-args.js @@ -0,0 +1,51 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..be0e710490 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,56 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..72921299be --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-args-trailing-comma-undefined.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..76d51727b0 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-multiple.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-null.js new file mode 100644 index 0000000000..8740be5a75 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-null.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..c57738eb10 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-single-args.js @@ -0,0 +1,51 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..d558881f8c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-spread-operator.js @@ -0,0 +1,56 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..d086cde834 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-undefined.js @@ -0,0 +1,52 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..7abaf595f2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-multiple.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/func-decl.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +// Stores a reference `ref` for case evaluation +function ref() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; +} + +ref(42, 'TC39',); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-null.js new file mode 100644 index 0000000000..6fad5d1790 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-null.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/func-decl.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +function ref() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; +} + +ref(42, null,); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..51dd22f9de --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-single-args.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/func-decl.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +// Stores a reference `ref` for case evaluation +function ref() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; +} + +ref(42,); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..440f108e6c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/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/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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..a8e41aa8c7 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-undefined.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/func-decl.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +function ref() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; +} + +ref(42, undefined,); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..1da786248e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-multiple.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; +}; + +ref(42, 'TC39',); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-null.js new file mode 100644 index 0000000000..884f8678f5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-null.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/func-expr.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; +}; + +ref(42, null,); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..2a0eb9ef34 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-single-args.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; +}; + +ref(42,); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..44fe6aaba3 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/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/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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..125da8af4d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/func-expr-args-trailing-comma-undefined.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/func-expr.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; +}; + +ref(42, undefined,); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..dda181a561 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-multiple.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/gen-func-decl.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +// Stores a reference `ref` for case evaluation +function* ref() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; +} + +ref(42, 'TC39',).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-null.js new file mode 100644 index 0000000000..692dc2bead --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-null.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/gen-func-decl.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +function* ref() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; +} + +ref(42, null,).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..d52b9511e2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-single-args.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/gen-func-decl.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +// Stores a reference `ref` for case evaluation +function* ref() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; +} + +ref(42,).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..2902610c09 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-func-decl-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/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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..d71738560d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-func-decl-args-trailing-comma-undefined.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/gen-func-decl.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +function* ref() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; +} + +ref(42, undefined,).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..cf8011a2d5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-multiple.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/gen-func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; +}; + +ref(42, 'TC39',).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-null.js new file mode 100644 index 0000000000..353c546a5d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-null.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/gen-func-expr.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; +}; + +ref(42, null,).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..2c9b1325a1 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-single-args.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/gen-func-expr.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; +}; + +ref(42,).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..adad4b86ad --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-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/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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..eaf9e6b91b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-func-expr-args-trailing-comma-undefined.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/gen-func-expr.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; +}; + +ref(42, undefined,).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..243eee0936 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-multiple.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +var obj = { + *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } +}; + +obj.method(42, 'TC39',).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..95dd6f1e44 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-null.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/gen-meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +var obj = { + *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } +}; + +obj.method(42, null,).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..11dc64ead7 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-single-args.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/gen-meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +var obj = { + *method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +}; + +obj.method(42,).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..e481dd7a1e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-spread-operator.js @@ -0,0 +1,55 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..048712a34b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/gen-meth-args-trailing-comma-undefined.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/gen-meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +var obj = { + *method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } +}; + +obj.method(42, undefined,).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/Symbol.iterator.js b/js/src/tests/test262/language/arguments-object/mapped/Symbol.iterator.js new file mode 100644 index 0000000000..698d83cf3f --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/Symbol.iterator.js @@ -0,0 +1,23 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 9.4.4.7 S22 +description: > + Mapped arguments exotic objects should implement the Array iterator + protocol. +includes: [propertyHelper.js] +flags: [noStrict] +features: [Symbol.iterator] +---*/ + +(function() { + var descriptor = Object.getOwnPropertyDescriptor(arguments, Symbol.iterator); + + assert.sameValue(arguments[Symbol.iterator], [][Symbol.iterator]); + + verifyNotEnumerable(Array.prototype, Symbol.iterator); + verifyWritable(Array.prototype, Symbol.iterator); + verifyConfigurable(Array.prototype, Symbol.iterator); +}()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/browser.js b/js/src/tests/test262/language/arguments-object/mapped/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/browser.js diff --git a/js/src/tests/test262/language/arguments-object/mapped/enumerable-configurable-accessor-descriptor.js b/js/src/tests/test262/language/arguments-object/mapped/enumerable-configurable-accessor-descriptor.js new file mode 100644 index 0000000000..bb2a5cb390 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/enumerable-configurable-accessor-descriptor.js @@ -0,0 +1,46 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +description: > + Index gets unmapped when redefined with accessor. Unmapped index is created. +info: | + [[DefineOwnProperty]] ( P, Desc ) + + [...] + 6. Let allowed be ? OrdinaryDefineOwnProperty(args, P, newArgDesc). + 7. If allowed is false, return false. + 8. If isMapped is true, then + a. If IsAccessorDescriptor(Desc) is true, then + i. Call map.[[Delete]](P). + [...] + 9. Return true. +flags: [noStrict] +---*/ + +(function(a) { + let setCalls = 0; + Object.defineProperty(arguments, "0", { + set(_v) { setCalls += 1; }, + enumerable: true, + configurable: true, + }); + + arguments[0] = "foo"; + + assert.sameValue(setCalls, 1); + assert.sameValue(a, 0); + assert.sameValue(arguments[0], undefined); + + + Object.defineProperty(arguments, "1", { + get: () => "bar", + enumerable: true, + configurable: true, + }); + + assert.sameValue(arguments[1], "bar"); +})(0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js new file mode 100644 index 0000000000..67c909fb28 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapped value is not changed when property was made non-configurable. +flags: [noStrict] +---*/ + +function argumentsNonConfigurable(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); +} +argumentsNonConfigurable(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js new file mode 100644 index 0000000000..12cbcb5170 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, variable is + changed with SetMutableBinding. +flags: [noStrict] +---*/ + +function argumentsAndSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndSetMutableBinding(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js new file mode 100644 index 0000000000..2cedf2ae79 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, arguments property + is changed with [[DefineOwnProperty]]. +flags: [noStrict] +---*/ + +function argumentsAndDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + Object.defineProperty(arguments, "0", {value: 2}); + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndDefineOwnProperty(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js new file mode 100644 index 0000000000..1f26fc78c5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, arguments property + is changed with [[Set]]. +flags: [noStrict] +---*/ + +function argumentsAndSet(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + arguments[0] = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndSet(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js new file mode 100644 index 0000000000..ac0eac446e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, arguments property + was not deleted. [[Delete]] operation returns false. +flags: [noStrict] +---*/ + +function argumentsAndDelete(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + assert.sameValue(delete arguments[0], false); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); +} +argumentsAndDelete(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js new file mode 100644 index 0000000000..f4df9a1c20 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, arguments property + was not deleted. Variable is changed with SetMutableBinding. +flags: [noStrict] +---*/ + +function argumentsAndDeleteSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Precondition: Delete is unsuccessful and doesn't affect mapping. + assert.sameValue(delete arguments[0], false); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndDeleteSetMutableBinding(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js new file mode 100644 index 0000000000..e1b8775385 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, arguments property + was not deleted. Arguments property is changed with + [[DefineOwnProperty]]. +flags: [noStrict] +---*/ + +function argumentsAndDeleteDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Precondition: Delete is unsuccessful and doesn't affect mapping. + assert.sameValue(delete arguments[0], false); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + Object.defineProperty(arguments, "0", {value: 2}); + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndDeleteDefineOwnProperty(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js new file mode 100644 index 0000000000..21dfa0d645 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, arguments property + was not deleted. Arguments property is changed with + [[Set]]. +flags: [noStrict] +---*/ + +function argumentsAndDeleteSet(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Precondition: Delete is unsuccessful and doesn't affect mapping. + assert.sameValue(delete arguments[0], false); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + arguments[0] = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndDeleteSet(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js new file mode 100644 index 0000000000..2b964aa3db --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapped arguments property is changed to non-configurable and + non-writable. Perform property attribute changes with a single + [[DefineOwnProperty]] call. Mapped values are unchanged, mapping + itself is removed. +flags: [noStrict] +---*/ + +function argumentsNonConfigurableAndNonWritable(a) { + Object.defineProperty(arguments, "0", {configurable: false, writable: false}); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Postcondition: Arguments mapping is removed. + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 1); +} +argumentsNonConfigurableAndNonWritable(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js new file mode 100644 index 0000000000..cf93842382 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapped arguments property is changed to non-configurable and + non-writable. Perform property attribute changes with two + consecutive [[DefineOwnProperty]] calls. Mapped values are + unchanged, mapping itself is removed. +flags: [noStrict] +---*/ + +function argumentsNonConfigurableThenNonWritable(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + Object.defineProperty(arguments, "0", {writable: false}); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Postcondition: Arguments mapping is removed. + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 1); +} +argumentsNonConfigurableThenNonWritable(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js new file mode 100644 index 0000000000..243e8b3958 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js @@ -0,0 +1,30 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapped arguments property is changed to non-configurable and + non-writable. Perform property attribute changes with two + [[DefineOwnProperty]] calls. Add intervening call to + SetMutableBinding. +flags: [noStrict] +---*/ + +function argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + a = 2; + Object.defineProperty(arguments, "0", {writable: false}); + assert.sameValue(a, 2); + // `arguments[0] === 1` per ES2015, Rev 38, April 14, 2015 Final Draft. + // Specification bug: https://bugs.ecmascript.org/show_bug.cgi?id=4371 + assert.sameValue(arguments[0], 2); + + // Postcondition: Arguments mapping is removed. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 2); +} +argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js new file mode 100644 index 0000000000..77cb38fe5b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapped arguments property is changed to non-configurable and + non-writable. Perform property attribute changes with two + [[DefineOwnProperty]] calls. Add intervening call to [[Set]]. +flags: [noStrict] +---*/ + +function argumentsNonConfigurableThenNonWritableWithInterveningSet(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + arguments[0] = 2; + Object.defineProperty(arguments, "0", {writable: false}); + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); + + // Postcondition: Arguments mapping is removed. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 2); +} +argumentsNonConfigurableThenNonWritableWithInterveningSet(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js new file mode 100644 index 0000000000..450c6bb79e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapped arguments property is changed to non-configurable and + non-writable. Perform property attribute changes with two + [[DefineOwnProperty]] calls. Add intervening call to + [[DefineOwnProperty]]. +flags: [noStrict] +---*/ + +function argumentsNonConfigurableThenNonWritableWithDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + Object.defineProperty(arguments, "0", {value: 2}); + Object.defineProperty(arguments, "0", {writable: false}); + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); + + // Postcondition: Arguments mapping is removed. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 2); +} +argumentsNonConfigurableThenNonWritableWithDefineOwnProperty(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js new file mode 100644 index 0000000000..4255e6ae6a --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, arguments property + was not deleted. [[Delete]] operations throws TypeError if called + from strict-mode code. +flags: [noStrict] +---*/ + +function argumentsAndStrictDelete(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + var args = arguments; + assert.throws(TypeError, function() { "use strict"; delete args[0]; }); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); +} +argumentsAndStrictDelete(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js new file mode 100644 index 0000000000..1786e32a2c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, arguments property + was not deleted. [[Delete]] operations throws TypeError if called + from strict-mode code. Variable is changed with SetMutableBinding. +flags: [noStrict] +---*/ + +function argumentsAndStrictDeleteSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Precondition: Delete is unsuccessful and doesn't affect mapping. + var args = arguments; + assert.throws(TypeError, function() { "use strict"; delete args[0]; }); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndStrictDeleteSetMutableBinding(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js new file mode 100644 index 0000000000..5f328c2ebd --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, arguments property + was not deleted. [[Delete]] operations throws TypeError if called + from strict-mode code. Arguments property is changed with + [[DefineOwnProperty]]. +flags: [noStrict] +---*/ + +function argumentsAndStrictDeleteDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Precondition: Delete is unsuccessful and doesn't affect mapping. + var args = arguments; + assert.throws(TypeError, function() { "use strict"; delete args[0]; }); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + Object.defineProperty(arguments, "0", {value: 2}); + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndStrictDeleteDefineOwnProperty(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js new file mode 100644 index 0000000000..bb2440ee8c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapping works when property is non-configurable, arguments property + was not deleted. [[Delete]] operations throws TypeError if called + from strict-mode code. Arguments property is changed with [[Set]]. +flags: [noStrict] +---*/ + +function argumentsAndStrictDeleteSet(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Precondition: Delete is unsuccessful and doesn't affect mapping. + var args = arguments; + assert.throws(TypeError, function() { "use strict"; delete args[0]; }); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + arguments[0] = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndStrictDeleteSet(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js new file mode 100644 index 0000000000..7b6f7df047 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapped arguments property is changed to non-writable and + non-configurable. Perform property attribute changes with two + consecutive [[DefineOwnProperty]] calls. Mapped values are + unchanged, mapping itself is removed. +flags: [noStrict] +---*/ + +function argumentsNonWritableThenNonConfigurable(a) { + Object.defineProperty(arguments, "0", {writable: false}); + Object.defineProperty(arguments, "0", {configurable: false}); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Postcondition: Arguments mapping is removed. + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 1); +} +argumentsNonWritableThenNonConfigurable(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js new file mode 100644 index 0000000000..86fc445420 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapped arguments property is changed to non-writable and + non-configurable. Perform property attribute changes with two + [[DefineOwnProperty]] calls. Add intervening call to + SetMutableBinding. +flags: [noStrict] +---*/ + +function argumentsNonWritableThenNonConfigurableWithInterveningSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {writable: false}); + a = 2; + Object.defineProperty(arguments, "0", {configurable: false}); + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 1); + + // Postcondition: Arguments mapping is removed. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 1); +} +argumentsNonWritableThenNonConfigurableWithInterveningSetMutableBinding(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js new file mode 100644 index 0000000000..7ab519c589 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapped arguments property is changed to non-writable and + non-configurable. Perform property attribute changes with two + [[DefineOwnProperty]] calls. Add intervening call to [[Set]]. +flags: [noStrict] +---*/ + +function argumentsNonWritableThenNonConfigurableWithInterveningSet(a) { + Object.defineProperty(arguments, "0", {writable: false}); + arguments[0] = 2; + Object.defineProperty(arguments, "0", {configurable: false}); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Postcondition: Arguments mapping is removed. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 1); +} +argumentsNonWritableThenNonConfigurableWithInterveningSet(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js new file mode 100644 index 0000000000..5c3033d9c7 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Mapped arguments object with non-configurable property +description: > + Mapped arguments property is changed to non-writable and + non-configurable. Perform property attribute changes with two + [[DefineOwnProperty]] calls. Add intervening call to + [[DefineOwnProperty]]. +flags: [noStrict] +---*/ + +function argumentsNonWritableThenNonConfigurableWithInterveningDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {writable: false}); + Object.defineProperty(arguments, "0", {value: 2}); + Object.defineProperty(arguments, "0", {configurable: false}); + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 2); + + // Postcondition: Arguments mapping is removed. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 2); +} +argumentsNonWritableThenNonConfigurableWithInterveningDefineOwnProperty(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js new file mode 100644 index 0000000000..96c801884c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js @@ -0,0 +1,24 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments object with non-configurable property property descriptor behavior +info: | + Descriptor of a mapped value is updated when property is made non-configurable. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function argumentsNonConfigurable(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +argumentsNonConfigurable(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-define-failure.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-define-failure.js new file mode 100644 index 0000000000..0552fa5d5b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-define-failure.js @@ -0,0 +1,45 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +description: > + OrdinaryDefineOwnProperty returning `false` doesn't leave `arguments` in a + corrupted state, for both mapped and unmapped indices. +info: | + [[DefineOwnProperty]] ( P, Desc ) + + [...] + 6. Let allowed be ? OrdinaryDefineOwnProperty(args, P, newArgDesc). + 7. If allowed is false, return false. +flags: [noStrict] +---*/ + +(function(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + assert.throws(TypeError, () => { + Object.defineProperty(arguments, "0", {configurable: true}); + }); + + a = 2; + assert.sameValue(arguments[0], 2); + + + Object.defineProperty(arguments, "1", { + get: () => 3, + configurable: false, + }); + + assert.throws(TypeError, () => { + Object.defineProperty(arguments, "1", {value: "foo"}); + }); + + assert.sameValue(arguments[1], 3); + assert.throws(TypeError, () => { + "use strict"; + delete arguments[1]; + }); +})(0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js new file mode 100644 index 0000000000..b9362ce5e2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change with non-configurable property +info: | + Mapping keep working when property is set to non-configurable and its + value is changed using arguments[i] where "i" is the argument index. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function argumentsAndSetByIndex(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + arguments[0] = 2; + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + assert.sameValue(a, 2); + verifyEnumerable(arguments, "0"); + verifyWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +argumentsAndSetByIndex(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js new file mode 100644 index 0000000000..8c4406354e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change with non-configurable property +info: | + Mapping keep working when property is set to non-configurable and its + value is changed using [[DefineOwnProperty]]. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function setArgumentValueWithDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + Object.defineProperty(arguments, "0", {value: 2}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + assert.sameValue(a, 2); + verifyEnumerable(arguments, "0"); + verifyWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +setArgumentValueWithDefineOwnProperty(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js new file mode 100644 index 0000000000..31e05a5cdc --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js @@ -0,0 +1,27 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Property descriptor of mapped arguments object with non-configurable property +info: | + Mapping keep working when property is set to non-configurable, and its + descriptor needs to change properly. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function argumentsAndSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + a = 2; + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyEnumerable(arguments, "0"); + verifyWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +argumentsAndSetMutableBinding(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-basic.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-basic.js new file mode 100644 index 0000000000..8a38cd3c81 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-basic.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change with non-configurable, non-enumerable and non-writable property +info: | + Mapping stop working when property is set to non-writable. The + descriptor's enumerable property is the one set before the mapping removal. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {configurable: false, enumerable: false, writable: false}); + + // Postcondition: Arguments mapping is removed. + a = 2; + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js new file mode 100644 index 0000000000..b05b87d839 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js @@ -0,0 +1,38 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-configurable, non-enumerable and non-writable +info: | + Change the descriptor using [[DefineOwnProperty]] to {configurable: false, enumerable: false}, + set arguments[0] = 2 and then change property descriptor to {writable: false}. + The descriptor's enumerable property is the one set before the mapping removal. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {configurable: false, enumerable: false}); + arguments[0] = 2; + Object.defineProperty(arguments, "0", {writable: false}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + assert.sameValue(a, 2); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js new file mode 100644 index 0000000000..fc16bd65fd --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js @@ -0,0 +1,38 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-configurable, non-enumerable and non-writable +info: | + Change the descriptor using [[DefineOwnProperty]] to + {configurable: false, enumerable: false}, set a = 2 and then + change property descriptor to {writable: false}. The descriptor's enumerable + property need to be the one set before the mapping removal. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {configurable: false, enumerable: false}); + a = 2; + Object.defineProperty(arguments, "0", {writable: false}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-basic.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-basic.js new file mode 100644 index 0000000000..05af46635e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-basic.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change with non-configurable and non-writable property +info: | + Mapping stop working when property is set to non-writable. The + descriptor's value need to be the one set before the property be configured as + writable: false. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {configurable: false, writable: false}); + + // Postcondition: Arguments mapping is removed. + a = 2; + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js new file mode 100644 index 0000000000..9bebd16e5a --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js @@ -0,0 +1,36 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change with non-configurable and non-writable property +info: | + Mapping stop working when property is set to non-writable. Change the + descriptor with two [[DefineOwnProperty]] calls. The descriptor's value need to be + the one set before the property be configured as writable: false. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + Object.defineProperty(arguments, "0", {writable: false}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 2; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js new file mode 100644 index 0000000000..6b02f43ab0 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js @@ -0,0 +1,39 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-configurable and non-writable +info: | + Mapping just stop working when property is set to non-writable. Change the + descriptor using [[DefineOwnProperty]] to {configurable: false}, set arguments[0] = 2 + and then change property descriptor to {writable: false}. + The descriptor's value need to be the one set before the property be + configured as {writable: false}. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + arguments[0] = 2; + Object.defineProperty(arguments, "0", {writable: false}); + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + assert.sameValue(a, 2) + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js new file mode 100644 index 0000000000..144e7c87c5 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js @@ -0,0 +1,38 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-configurable and non-writable +info: | + Mapping just stop working when property is set to non-writable. Change the + descriptor using [[DefineOwnProperty]] to {configurable: false}, set a = 2 and then + change property descriptor to {writable: false}. The descriptor's value is + the one set before the property be configured as {writable: false}. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + a = 2; + Object.defineProperty(arguments, "0", {writable: false}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-basic.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-basic.js new file mode 100644 index 0000000000..554337b45b --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-basic.js @@ -0,0 +1,38 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-writable and non-configurable +info: | + Mapping stop working when property is set to non-writable. Here we change the + descriptor using [[DefineOwnProperty]] to {writable: false} and then + change property descriptor to {configurable: false} in sequence. + The property descriptor need to be the one set before the property be + configured as {writable: false}. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {writable: false}); + Object.defineProperty(arguments, "0", {configurable: false}); + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. Descriptors need to be the same + // as above. + a = 2; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-arguments.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-arguments.js new file mode 100644 index 0000000000..f63482657f --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-arguments.js @@ -0,0 +1,39 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-writable and non-configurable +info: | + Mapping stop working when property is set to non-writable. Change the + descriptor using [[DefineOwnProperty]] to {writable: false}, set argument[0] = 2 and then + change property descriptor to {configurable: false}. + The descriptor's value is the one set before the property be + configured as {writable: false} because mapping was removed. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {writable: false}); + arguments[0] = 2; + Object.defineProperty(arguments, "0", {configurable: false}); + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + assert.sameValue(a, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-param.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-param.js new file mode 100644 index 0000000000..b6675a369e --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-param.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-writable and non-configurable +info: | + Mapping just stop working when property is set to non-writable. Change the + descriptor using [[DefineOwnProperty]] to {writable: false}, set a = 2 and then + change property descriptor to {configurable: false}. + The descriptor's value is the one set before the property be + configured as {writable: false} because mapping was removed. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {writable: false}); + a = 2; + Object.defineProperty(arguments, "0", {configurable: false}); + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-basic.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-basic.js new file mode 100644 index 0000000000..d7dfa208aa --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-basic.js @@ -0,0 +1,37 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-writable and non-configurable +info: | + Change the descriptor using [[DefineOwnProperty]] to + {writable: false, enumerable: false} and then + change property descriptor to {configurable: false}. + The descriptor's enumerable property continue with its configured value + even if mapping stops. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {writable: false, enumerable: false}); + Object.defineProperty(arguments, "0", {configurable: false}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 2; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js new file mode 100644 index 0000000000..0d4e45544c --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js @@ -0,0 +1,36 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable +info: | + Change the descriptor using [[DefineOwnProperty]] to {writable: false, enumerable: false}, + set argument[0] = 2 and then change property descriptor to {configurable: false}. + The descriptor's enumerable property continues with its configured value. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {writable: false, enumerable: false}); + arguments[0] = 2; + Object.defineProperty(arguments, "0", {configurable: false}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-define-property.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-define-property.js new file mode 100644 index 0000000000..f1a54030ac --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-define-property.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable +info: | + Change the descriptor using [[DefineOwnProperty]] to + {writable: false, enumerable: false}, change argument[0] + value to 2 using [[DefineOwnProperty]] and then + change property descriptor to {configurable: false}. + The descriptor's enumerable property continues with its configured value. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {writable: false, enumerable: false, value: 2, configurable: false}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + assert.sameValue(arguments[0], 2); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js new file mode 100644 index 0000000000..0ed3c85043 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js @@ -0,0 +1,37 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable +info: | + Change the descriptor using [[DefineOwnProperty]] to + {writable: false, enumerable: false}, set a = 2 and then + change property descriptor to {configurable: false}. + The descriptor's enumerable property continue with its configured value. +flags: [noStrict] +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +includes: [propertyHelper.js] +---*/ + +function fn(a) { + Object.defineProperty(arguments, "0", {writable: false, enumerable: false}); + a = 2; + Object.defineProperty(arguments, "0", {configurable: false}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/mapped/shell.js b/js/src/tests/test262/language/arguments-object/mapped/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/shell.js diff --git a/js/src/tests/test262/language/arguments-object/mapped/writable-enumerable-configurable-descriptor.js b/js/src/tests/test262/language/arguments-object/mapped/writable-enumerable-configurable-descriptor.js new file mode 100644 index 0000000000..01e9f2fb2f --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/mapped/writable-enumerable-configurable-descriptor.js @@ -0,0 +1,47 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arguments-exotic-objects-defineownproperty-p-desc +description: > + Index stays mapped when redefined with complete descriptor, which differs only + by the [[Value]] field. Unmapped index is created. +info: | + [[DefineOwnProperty]] ( P, Desc ) + + [...] + 6. Let allowed be ? OrdinaryDefineOwnProperty(args, P, newArgDesc). + 7. If allowed is false, return false. + 8. If isMapped is true, then + [...] + b. Else, + i. If Desc.[[Value]] is present, then + 1. Let setStatus be Set(map, P, Desc.[[Value]], false). + 2. Assert: setStatus is true because formal parameters mapped by argument objects are always writable. + 9. Return true. +flags: [noStrict] +---*/ + +(function(a) { + Object.defineProperty(arguments, "0", { + value: "foo", + writable: true, + enumerable: true, + configurable: true, + }); + + assert.sameValue(a, "foo"); + assert.sameValue(arguments[0], "foo"); + + + Object.defineProperty(arguments, "1", { + value: "bar", + writable: true, + enumerable: true, + configurable: true, + }); + + assert.sameValue(arguments[1], "bar"); +})(0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-multiple.js b/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-multiple.js new file mode 100644 index 0000000000..a789a8b229 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-multiple.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-multiple.case +// - src/arguments/default/meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using multiple 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 callCount = 0; +var obj = { + method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], 'TC39'); + callCount = callCount + 1; + } +}; + +obj.method(42, 'TC39',); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-null.js b/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-null.js new file mode 100644 index 0000000000..f59faa7e97 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-null.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-null.case +// - src/arguments/default/meth.template +/*--- +description: A trailing comma after null should not increase the arguments.length (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 callCount = 0; +var obj = { + method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], null); + callCount = callCount + 1; + } +}; + +obj.method(42, null,); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-single-args.js b/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-single-args.js new file mode 100644 index 0000000000..69965a5fbb --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-single-args.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-single-args.case +// - src/arguments/default/meth.template +/*--- +description: A trailing comma should not increase the arguments.length, using a single arg (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 callCount = 0; +var obj = { + method() { + assert.sameValue(arguments.length, 1); + assert.sameValue(arguments[0], 42); + callCount = callCount + 1; + } +}; + +obj.method(42,); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-spread-operator.js b/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-spread-operator.js new file mode 100644 index 0000000000..da57776710 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/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/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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-undefined.js b/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-undefined.js new file mode 100644 index 0000000000..8651a63b30 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/meth-args-trailing-comma-undefined.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/arguments/args-trailing-comma-undefined.case +// - src/arguments/default/meth.template +/*--- +description: A trailing comma after undefined should not increase the arguments.length (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 callCount = 0; +var obj = { + method() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 42); + assert.sameValue(arguments[1], undefined); + callCount = callCount + 1; + } +}; + +obj.method(42, undefined,); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/non-strict-arguments-object-is-immutable.js b/js/src/tests/test262/language/arguments-object/non-strict-arguments-object-is-immutable.js new file mode 100644 index 0000000000..3717a107f2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/non-strict-arguments-object-is-immutable.js @@ -0,0 +1,23 @@ +// Copyright 2017 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-functiondeclarationinstantiation +description: Non-strict mode function execution context has a mutable "arguments" binding, however it is created with a "false" argument, which means it may not be deleted. +info: | + envRec.CreateMutableBinding("arguments", false). + + CreateMutableBinding(N, D) + + Create a new but uninitialized mutable binding in an Environment Record. The String value N is the text of the bound name. If the Boolean argument D is true the binding may be subsequently deleted. + +flags: [noStrict] +---*/ + +function f1() { + assert.sameValue(delete arguments, false); +} + +f1(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/shell.js b/js/src/tests/test262/language/arguments-object/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/shell.js diff --git a/js/src/tests/test262/language/arguments-object/unmapped/Symbol.iterator.js b/js/src/tests/test262/language/arguments-object/unmapped/Symbol.iterator.js new file mode 100644 index 0000000000..3811df4d52 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/unmapped/Symbol.iterator.js @@ -0,0 +1,24 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 9.4.4.6 S7 +description: > + Unmapped arguments exotic objects should implement the Array iterator + protocol. +includes: [propertyHelper.js] +flags: [noStrict] +features: [Symbol.iterator] +---*/ + +(function() { + 'use strict'; + var descriptor = Object.getOwnPropertyDescriptor(arguments, Symbol.iterator); + + assert.sameValue(arguments[Symbol.iterator], [][Symbol.iterator]); + + verifyNotEnumerable(Array.prototype, Symbol.iterator); + verifyWritable(Array.prototype, Symbol.iterator); + verifyConfigurable(Array.prototype, Symbol.iterator); +}()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/unmapped/browser.js b/js/src/tests/test262/language/arguments-object/unmapped/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/unmapped/browser.js diff --git a/js/src/tests/test262/language/arguments-object/unmapped/shell.js b/js/src/tests/test262/language/arguments-object/unmapped/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/unmapped/shell.js diff --git a/js/src/tests/test262/language/arguments-object/unmapped/via-params-dflt.js b/js/src/tests/test262/language/arguments-object/unmapped/via-params-dflt.js new file mode 100644 index 0000000000..db16833e2d --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/unmapped/via-params-dflt.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +es6id: 9.2.12 +description: > + Arguments are "unmapped" when paramater list is non-simple due to "default" + parameter +info: | + [...] + 9. Let simpleParameterList be IsSimpleParameterList of formals. + [...] + 22. If argumentsObjectNeeded is true, then + a. If strict is true or if simpleParameterList is false, then + i. Let ao be CreateUnmappedArgumentsObject(argumentsList). + [...] +---*/ + +var value; + +function dflt(a, b = 0) { + arguments[0] = 2; + value = a; +} + +dflt(1); + +assert.sameValue(value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/unmapped/via-params-dstr.js b/js/src/tests/test262/language/arguments-object/unmapped/via-params-dstr.js new file mode 100644 index 0000000000..8d0a4e8d95 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/unmapped/via-params-dstr.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +es6id: 9.2.12 +description: > + Arguments are "unmapped" when paramater list is non-simple due to + destructuring pattern +info: | + [...] + 9. Let simpleParameterList be IsSimpleParameterList of formals. + [...] + 22. If argumentsObjectNeeded is true, then + a. If strict is true or if simpleParameterList is false, then + i. Let ao be CreateUnmappedArgumentsObject(argumentsList). + [...] +---*/ + +var value; + +function dstr(a, [b]) { + arguments[0] = 2; + value = a; +} + +dstr(1, []); + +assert.sameValue(value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/unmapped/via-params-rest.js b/js/src/tests/test262/language/arguments-object/unmapped/via-params-rest.js new file mode 100644 index 0000000000..8c4dab8dcd --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/unmapped/via-params-rest.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +es6id: 9.2.12 +description: > + Arguments are "unmapped" when paramater list is non-simple due to "rest" + parameter +info: | + [...] + 9. Let simpleParameterList be IsSimpleParameterList of formals. + [...] + 22. If argumentsObjectNeeded is true, then + a. If strict is true or if simpleParameterList is false, then + i. Let ao be CreateUnmappedArgumentsObject(argumentsList). + [...] +---*/ + +var value; + +function rest(a, ...b) { + arguments[0] = 2; + value = a; +} + +rest(1); + +assert.sameValue(value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/arguments-object/unmapped/via-strict-strict.js b/js/src/tests/test262/language/arguments-object/unmapped/via-strict-strict.js new file mode 100644 index 0000000000..620a0e9758 --- /dev/null +++ b/js/src/tests/test262/language/arguments-object/unmapped/via-strict-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.6-10-c-ii-2-s +description: arguments[i] doesn't map to actual parameters in strict mode +flags: [onlyStrict] +---*/ + + function foo(a,b,c) + { + arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1; + return 10 === a && 'sss' === b && 1 === c; + } + +assert(foo(10,'sss',1), 'foo(10,"sss",1) !== true'); + +reportCompare(0, 0); |