summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/new
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/expressions/new')
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A1.1.js62
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A1.2.js62
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A2.js34
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A3_T1.js47
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A3_T2.js47
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A3_T3.js47
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A3_T4.js47
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A3_T5.js47
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A4_T1.js47
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A4_T2.js47
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A4_T3.js47
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A4_T4.js34
-rw-r--r--js/src/tests/test262/language/expressions/new/S11.2.2_A4_T5.js46
-rw-r--r--js/src/tests/test262/language/expressions/new/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval-fn-wrapup.js39
-rw-r--r--js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval.js34
-rw-r--r--js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval-fn-wrapup.js38
-rw-r--r--js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval.js32
-rw-r--r--js/src/tests/test262/language/expressions/new/non-ctor-err-realm.js34
-rw-r--r--js/src/tests/test262/language/expressions/new/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-mult-err-expr-throws.js36
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-mult-err-iter-get-value.js47
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-call.js45
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-get.js46
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-step.js55
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-value.js58
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-mult-err-obj-unresolvable.js37
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-mult-err-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-sngl-err-expr-throws.js36
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-call.js46
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-get.js47
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-value.js46
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-step.js59
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-value.js65
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-sngl-err-obj-unresolvable.js37
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-err-sngl-err-unresolvable.js42
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-mult-empty.js46
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-mult-expr.js51
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-mult-iter.js63
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-mult-literal.js48
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-mult-obj-ident.js73
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-mult-obj-null.js44
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-mult-obj-undefined.js44
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-getter-descriptor.js58
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-getter-init.js38
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-manipulate-outter-obj-in-getter.js52
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-mult-spread-getter.js52
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-mult-spread.js50
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-null.js42
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-override-immutable.js51
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-overrides-prev-properties.js48
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-skip-non-enumerable.js36
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-spread-order.js49
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-symbol-property.js50
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-undefined.js42
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-obj-with-overrides.js54
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-sngl-empty.js45
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-sngl-expr.js53
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-sngl-iter.js60
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-sngl-literal.js50
-rw-r--r--js/src/tests/test262/language/expressions/new/spread-sngl-obj-ident.js59
61 files changed, 2792 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A1.1.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A1.1.js
new file mode 100644
index 0000000000..76a0ab179d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A1.1.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ White Space and Line Terminator between "new" and NewExpression are
+ allowed
+es5id: 11.2.2_A1.1
+description: Checking by using eval
+---*/
+
+//CHECK#1
+if (eval("new\u0009Number") != 0) {
+ throw new Test262Error('#1: new\\u0009Number == 0');
+}
+
+//CHECK#2
+if (eval("new\u000BNumber") != 0) {
+ throw new Test262Error('#2: new\\u000BNumber == 0');
+}
+
+//CHECK#3
+if (eval("new\u000CNumber") != 0) {
+ throw new Test262Error('#3: new\\u000CNumber == 0');
+}
+
+//CHECK#4
+if (eval("new\u0020Number") != 0) {
+ throw new Test262Error('#4: new\\u0020Number == 0');
+}
+
+//CHECK#5
+if (eval("new\u00A0Number") != 0) {
+ throw new Test262Error('#5: new\\u00A0Number == 0');
+}
+
+//CHECK#6
+if (eval("new\u000ANumber") != 0) {
+ throw new Test262Error('#6: new\\u000ANumber == 0');
+}
+
+//CHECK#7
+if (eval("new\u000DNumber") != 0) {
+ throw new Test262Error('#7: new\\u000DNumber == 0');
+}
+
+//CHECK#8
+if (eval("new\u2028Number") != 0) {
+ throw new Test262Error('#8: new\\u2028Number == 0');
+}
+
+//CHECK#9
+if (eval("new\u2029Number") != 0) {
+ throw new Test262Error('#9: new\\u2029Number == 0');
+}
+
+//CHECK#10
+if (eval("new\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029Number") != 0) {
+ throw new Test262Error('#10: new\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Number == 0');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A1.2.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A1.2.js
new file mode 100644
index 0000000000..7dc595aadb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A1.2.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ White Space and Line Terminator between "new" and MemberExpression are
+ allowed
+es5id: 11.2.2_A1.2
+description: Checking by using eval
+---*/
+
+//CHECK#1
+if (eval("new\u0009Number()") != 0) {
+ throw new Test262Error('#1: new\\u0009Number == 0');
+}
+
+//CHECK#2
+if (eval("new\u000BNumber()") != 0) {
+ throw new Test262Error('#2: new\\u000BNumber == 0');
+}
+
+//CHECK#3
+if (eval("new\u000CNumber()") != 0) {
+ throw new Test262Error('#3: new\\u000CNumber == 0');
+}
+
+//CHECK#4
+if (eval("new\u0020Number()") != 0) {
+ throw new Test262Error('#4: new\\u0020Number == 0');
+}
+
+//CHECK#5
+if (eval("new\u00A0Number()") != 0) {
+ throw new Test262Error('#5: new\\u00A0Number == 0');
+}
+
+//CHECK#6
+if (eval("new\u000ANumber()") != 0) {
+ throw new Test262Error('#6: new\\u000ANumber == 0');
+}
+
+//CHECK#7
+if (eval("new\u000DNumber()") != 0) {
+ throw new Test262Error('#7: new\\u000DNumber == 0');
+}
+
+//CHECK#8
+if (eval("new\u2028Number()") != 0) {
+ throw new Test262Error('#8: new\\u2028Number == 0');
+}
+
+//CHECK#9
+if (eval("new\u2029Number()") != 0) {
+ throw new Test262Error('#9: new\\u2029Number == 0');
+}
+
+//CHECK#10
+if (eval("new\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029Number()") != 0) {
+ throw new Test262Error('#10: new\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Number == 0');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A2.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A2.js
new file mode 100644
index 0000000000..4f1e053c7a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A2.js
@@ -0,0 +1,34 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator "new" uses GetValue
+es5id: 11.2.2_A2
+description: >
+ If GetBase(NewExpression) or GetBase(MemberExpression) is null,
+ throw ReferenceError
+---*/
+
+//CHECK#1
+try {
+ new x;
+ throw new Test262Error('#1.1: new x throw ReferenceError. Actual: ' + (new x));
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ throw new Test262Error('#1.2: new x throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+//CHECK#2
+try {
+ new x();
+ throw new Test262Error('#2: new x() throw ReferenceError');
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ throw new Test262Error('#2: new x() throw ReferenceError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T1.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T1.js
new file mode 100644
index 0000000000..0707d7d0ad
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T1.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Type(NewExpression) or Type(MemberExpression) is not Object, throw
+ TypeError
+es5id: 11.2.2_A3_T1
+description: Checking boolean primitive case
+---*/
+
+//CHECK#1
+try {
+ new true;
+ throw new Test262Error('#1: new true throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1: new true throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ var x = true;
+ new x;
+ throw new Test262Error('#2: var x = true; new x throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#2: var x = true; new x throw TypeError');
+ }
+}
+
+//CHECK#3
+try {
+ var x = true;
+ new x();
+ throw new Test262Error('#3: var x = true; new x() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#3: var x = true; new x() throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T2.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T2.js
new file mode 100644
index 0000000000..b111d0316e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T2.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Type(NewExpression) or Type(MemberExpression) is not Object, throw
+ TypeError
+es5id: 11.2.2_A3_T2
+description: Checking "number primitive" case
+---*/
+
+//CHECK#1
+try {
+ new 1;
+ throw new Test262Error('#1: new 1 throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1: new 1 throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ var x = 1;
+ new x;
+ throw new Test262Error('#2: var x = 1; new x throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#2: var x = 1; new x throw TypeError');
+ }
+}
+
+//CHECK#3
+try {
+ var x = 1;
+ new x();
+ throw new Test262Error('#3: var x = 1; new x() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#3: var x = 1; new x() throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T3.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T3.js
new file mode 100644
index 0000000000..9b4c4ffb9f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T3.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Type(NewExpression) or Type(MemberExpression) is not Object, throw
+ TypeError
+es5id: 11.2.2_A3_T3
+description: Checking "string primitive" case
+---*/
+
+//CHECK#1
+try {
+ new 1;
+ throw new Test262Error('#1: new "1" throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1: new "1" throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ var x = "1";
+ new x;
+ throw new Test262Error('#2: var x = "1"; new x throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#2: var x = "1"; new x throw TypeError');
+ }
+}
+
+//CHECK#3
+try {
+ var x = "1";
+ new x();
+ throw new Test262Error('#3: var x = "1"; new x() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#3: var x = "1"; new x() throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T4.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T4.js
new file mode 100644
index 0000000000..3e7229462c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T4.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Type(NewExpression) or Type(MemberExpression) is not Object, throw
+ TypeError
+es5id: 11.2.2_A3_T4
+description: Checking "undefined" case
+---*/
+
+//CHECK#1
+try {
+ new undefined;
+ throw new Test262Error('#1: new undefined throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1: new undefined throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ var x = undefined;
+ new x;
+ throw new Test262Error('#2: var x = undefined; new x throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#2: var x = undefined; new x throw TypeError');
+ }
+}
+
+//CHECK#3
+try {
+ var x = undefined;
+ new x();
+ throw new Test262Error('#3: var x = undefined; new x() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#3: var x = undefined; new x() throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T5.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T5.js
new file mode 100644
index 0000000000..bded1822dd
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T5.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Type(NewExpression) or Type(MemberExpression) is not Object, throw
+ TypeError
+es5id: 11.2.2_A3_T5
+description: Checking "null primitive" case
+---*/
+
+//CHECK#1
+try {
+ new null;
+ throw new Test262Error('#1: new null throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1: new null throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ var x = null;
+ new x;
+ throw new Test262Error('#2: var x = null; new x throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#2: var x = null; new x throw TypeError');
+ }
+}
+
+//CHECK#3
+try {
+ var x = null;
+ new x();
+ throw new Test262Error('#3: var x = null; new x() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#3: var x = null; new x() throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T1.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T1.js
new file mode 100644
index 0000000000..fc18a95326
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T1.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If NewExpression or MemberExpression does not implement internal
+ [[Construct]] method, throw TypeError
+es5id: 11.2.2_A4_T1
+description: Checking Boolean object case
+---*/
+
+//CHECK#1
+try {
+ new new Boolean(true);
+ throw new Test262Error('#1: new new Boolean(true) throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1: new new Boolean(true) throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ var x = new Boolean(true);
+ new x;
+ throw new Test262Error('#2: var x = new Boolean(true); new x throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#2: var x = new Boolean(true); new x throw TypeError');
+ }
+}
+
+//CHECK#3
+try {
+ var x = new Boolean(true);
+ new x();
+ throw new Test262Error('#3: var x = new Boolean(true); new x() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#3: var x = new Boolean(true); new x() throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T2.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T2.js
new file mode 100644
index 0000000000..be68afe987
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T2.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If NewExpression or MemberExpression does not implement internal
+ [[Construct]] method, throw TypeError
+es5id: 11.2.2_A4_T2
+description: Checking Number object case
+---*/
+
+//CHECK#1
+try {
+ new new Number(1);
+ throw new Test262Error('#1: new new Number(1) throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1: new new Number(1) throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ var x = new Number(1);
+ new x;
+ throw new Test262Error('#2: var x = new Number(1); new x throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#2: var x = new Number(1); new x throw TypeError');
+ }
+}
+
+//CHECK#3
+try {
+ var x = new Number(1);
+ new x();
+ throw new Test262Error('#3: var x = new Number(1); new x() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#3: var x = new Number(1); new x() throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T3.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T3.js
new file mode 100644
index 0000000000..f36fbd52d6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T3.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If NewExpression or MemberExpression does not implement internal
+ [[Construct]] method, throw TypeError
+es5id: 11.2.2_A4_T3
+description: Checking String object case
+---*/
+
+//CHECK#1
+try {
+ new new String("1");
+ throw new Test262Error('#1: new new String("1") throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1: new new String("1") throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ var x = new String("1");
+ new x;
+ throw new Test262Error('#2: var x = new String("1"); new x throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#2: var x = new String("1"); new x throw TypeError');
+ }
+}
+
+//CHECK#3
+try {
+ var x = new String("1");
+ new x();
+ throw new Test262Error('#3: var x = new String("1"); new x() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#3: var x = new String("1"); new x() throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T4.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T4.js
new file mode 100644
index 0000000000..7ecf784e0c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T4.js
@@ -0,0 +1,34 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If NewExpression or MemberExpression does not implement internal
+ [[Construct]] method, throw TypeError
+es5id: 11.2.2_A4_T4
+description: Checking Global object case
+---*/
+
+//CHECK#1
+try {
+ new this;
+ throw new Test262Error('#1: new this throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1: new this throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ new this();
+ throw new Test262Error('#2: new this() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#2: new this() throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T5.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T5.js
new file mode 100644
index 0000000000..8216b05bd9
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T5.js
@@ -0,0 +1,46 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If NewExpression or MemberExpression does not implement internal
+ [[Construct]] method, throw TypeError
+es5id: 11.2.2_A4_T5
+description: Checking Math object case
+---*/
+
+//CHECK#1
+try {
+ new Math;
+ throw new Test262Error('#1: new Math throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1: new Math throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ new new Math();
+ throw new Test262Error('#2: new new Math() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#2: new new Math() throw TypeError');
+ }
+}
+
+//CHECK#3
+try {
+ var x = new Math();
+ new x();
+ throw new Test262Error('#3: var x = new Math(); new x() throw TypeError');
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#3: var x = new Math(); new x() throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/browser.js b/js/src/tests/test262/language/expressions/new/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/browser.js
diff --git a/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval-fn-wrapup.js b/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval-fn-wrapup.js
new file mode 100644
index 0000000000..ebadd23a93
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval-fn-wrapup.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2020 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-new-operator
+description: >
+ The constructExpr is referenced before arguments in the same EvaluateNew evaluation.
+ Function wrap-up to use the same function level binding ref.
+info: |
+ NewExpression : new NewExpression
+ 1. Return ? EvaluateNew(NewExpression, empty).
+ MemberExpression : new MemberExpression Arguments
+ 1. Return ? EvaluateNew(MemberExpression, Arguments).
+
+ Runtime Semantics: EvaluateNew
+
+ 3. Let ref be the result of evaluating constructExpr.
+ 4. Let constructor be ? GetValue(ref).
+ 5. If arguments is empty, let argList be a new empty List.
+ 6. Else,
+ a. Let argList be ? ArgumentListEvaluation of arguments.
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ 8. Return ? Construct(constructor, argList).
+---*/
+
+function fn() {
+ var x = function() {
+ this.foo = 42;
+ };
+
+ var result = new x(x = 1);
+
+ assert.sameValue(x, 1);
+ assert.sameValue(result.foo, 42);
+}
+
+fn();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval.js b/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval.js
new file mode 100644
index 0000000000..cdd0254f18
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2020 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-new-operator
+description: >
+ The constructExpr is referenced before arguments in the same EvaluateNew evaluation.
+info: |
+ NewExpression : new NewExpression
+ 1. Return ? EvaluateNew(NewExpression, empty).
+ MemberExpression : new MemberExpression Arguments
+ 1. Return ? EvaluateNew(MemberExpression, Arguments).
+
+ Runtime Semantics: EvaluateNew
+
+ 3. Let ref be the result of evaluating constructExpr.
+ 4. Let constructor be ? GetValue(ref).
+ 5. If arguments is empty, let argList be a new empty List.
+ 6. Else,
+ a. Let argList be ? ArgumentListEvaluation of arguments.
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ 8. Return ? Construct(constructor, argList).
+---*/
+
+var x = function() {
+ this.foo = 42;
+};
+
+var result = new x(x = 1);
+
+assert.sameValue(x, 1);
+assert.sameValue(result.foo, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval-fn-wrapup.js b/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval-fn-wrapup.js
new file mode 100644
index 0000000000..b1e980c7d2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval-fn-wrapup.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2020 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-new-operator
+description: >
+ The IsConstructor(ctor) happens after evaluating the arguments, use the correct ctor.
+ Function wrap-up to use the same function level binding ref
+info: |
+ NewExpression : new NewExpression
+ 1. Return ? EvaluateNew(NewExpression, empty).
+ MemberExpression : new MemberExpression Arguments
+ 1. Return ? EvaluateNew(MemberExpression, Arguments).
+
+ Runtime Semantics: EvaluateNew
+
+ 3. Let ref be the result of evaluating constructExpr.
+ 4. Let constructor be ? GetValue(ref).
+ 5. If arguments is empty, let argList be a new empty List.
+ 6. Else,
+ a. Let argList be ? ArgumentListEvaluation of arguments.
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ 8. Return ? Construct(constructor, argList).
+---*/
+
+var ref;
+var argz;
+
+assert.throws(TypeError, function() {
+ var x = 42;
+ ref = x;
+ new x(x = function() {}, argz = 39);
+});
+
+assert.sameValue(ref, 42);
+assert.sameValue(argz, 39, 'arguments evaluated before checking valid ctor');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval.js b/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval.js
new file mode 100644
index 0000000000..1a8385fd41
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2020 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-new-operator
+description: >
+ The IsConstructor(ctor) happens after evaluating the arguments, use the correct ctor
+info: |
+ NewExpression : new NewExpression
+ 1. Return ? EvaluateNew(NewExpression, empty).
+ MemberExpression : new MemberExpression Arguments
+ 1. Return ? EvaluateNew(MemberExpression, Arguments).
+
+ Runtime Semantics: EvaluateNew
+
+ 3. Let ref be the result of evaluating constructExpr.
+ 4. Let constructor be ? GetValue(ref).
+ 5. If arguments is empty, let argList be a new empty List.
+ 6. Else,
+ a. Let argList be ? ArgumentListEvaluation of arguments.
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ 8. Return ? Construct(constructor, argList).
+---*/
+
+var x = {};
+assert.throws(TypeError, function() {
+ new x(x = Array);
+});
+
+assert.sameValue(x, Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/non-ctor-err-realm.js b/js/src/tests/test262/language/expressions/new/non-ctor-err-realm.js
new file mode 100644
index 0000000000..a446c720bc
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/non-ctor-err-realm.js
@@ -0,0 +1,34 @@
+// 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-new-operator
+es6id: 12.3.3
+description: Realm of error object produced when operand is not a constructor
+info: |
+ NewExpression : new NewExpression
+
+ 1. Return ? EvaluateNew(NewExpression, empty).
+
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return ? EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+features: [cross-realm]
+---*/
+
+var otherParseInt = $262.createRealm().global.parseInt;
+
+assert.sameValue(typeof otherParseInt, 'function');
+
+assert.throws(TypeError, function() {
+ new otherParseInt(0);
+}, 'production including Arguments');
+
+assert.throws(TypeError, function() {
+ new otherParseInt;
+}, 'production eliding Arguments');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/shell.js b/js/src/tests/test262/language/expressions/new/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/shell.js
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-expr-throws.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-expr-throws.js
new file mode 100644
index 0000000000..418bba7e55
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-expr-throws.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-err-expr-throws.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator following other arguments when evaluation throws (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [generators]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ArgumentList , ... AssignmentExpression
+
+ 1. Let precedingArgs be the result of evaluating ArgumentList.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let iterator be GetIterator(GetValue(spreadRef) ).
+ 4. ReturnIfAbrupt(iterator).
+
+---*/
+
+assert.throws(Test262Error, function() {
+ new function() {}(0, ...function*() { throw new Test262Error(); }());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-iter-get-value.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-iter-get-value.js
new file mode 100644
index 0000000000..4856246436
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-iter-get-value.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-err-iter-get-value.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator following other arguments when GetIterator fails (@@iterator function return value) (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ArgumentList , ... AssignmentExpression
+
+ 1. Let precedingArgs be the result of evaluating ArgumentList.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let iterator be GetIterator(GetValue(spreadRef) ).
+ 4. ReturnIfAbrupt(iterator).
+
+ 7.4.1 GetIterator ( obj, method )
+
+ [...]
+ 2. Let iterator be ? Call(method, obj).
+ 3. If Type(iterator) is not Object, throw a TypeError exception.
+---*/
+var iter = {};
+Object.defineProperty(iter, Symbol.iterator, {
+ get: function() {
+ return null;
+ }
+});
+
+assert.throws(TypeError, function() {
+ new function() {}(0, ...iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-call.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-call.js
new file mode 100644
index 0000000000..18e586403e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-call.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-err-itr-get-call.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator following other arguments when GetIterator fails (@@iterator function invocation) (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ArgumentList , ... AssignmentExpression
+
+ 1. Let precedingArgs be the result of evaluating ArgumentList.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let iterator be GetIterator(GetValue(spreadRef) ).
+ 4. ReturnIfAbrupt(iterator).
+
+ 7.4.1 GetIterator ( obj, method )
+
+ [...]
+ 3. Let iterator be Call(method,obj).
+ 4. ReturnIfAbrupt(iterator).
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ new function() {}(0, ...iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-get.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-get.js
new file mode 100644
index 0000000000..0659652501
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-get.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-err-itr-get-get.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator following other arguments when GetIterator fails (@@iterator property access) (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ArgumentList , ... AssignmentExpression
+
+ 1. Let precedingArgs be the result of evaluating ArgumentList.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let iterator be GetIterator(GetValue(spreadRef) ).
+ 4. ReturnIfAbrupt(iterator).
+
+ 7.4.1 GetIterator ( obj, method )
+
+ 1. If method was not passed, then
+ a. Let method be ? GetMethod(obj, @@iterator).
+---*/
+var iter = {};
+Object.defineProperty(iter, Symbol.iterator, {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ new function() {}(0, ...iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-step.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-step.js
new file mode 100644
index 0000000000..124fb44312
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-step.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-err-itr-step.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator following other arguments when IteratorStep fails (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ArgumentList , ... AssignmentExpression
+
+ 1. Let precedingArgs be the result of evaluating ArgumentList.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let iterator be GetIterator(GetValue(spreadRef) ).
+ 4. ReturnIfAbrupt(iterator).
+
+ 7.4.5 IteratorStep ( iterator )
+
+ 1. Let result be IteratorNext(iterator).
+ 2. ReturnIfAbrupt(result).
+
+ 7.4.2 IteratorNext ( iterator, value )
+
+ 1. If value was not passed, then
+ a. Let result be Invoke(iterator, "next", « »).
+ [...]
+ 3. ReturnIfAbrupt(result).
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ new function() {}(0, ...iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-value.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-value.js
new file mode 100644
index 0000000000..849b8d1d60
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-value.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-err-itr-value.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator following other arguments when IteratorValue fails (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ArgumentList , ... AssignmentExpression
+
+ 1. Let precedingArgs be the result of evaluating ArgumentList.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let iterator be GetIterator(GetValue(spreadRef) ).
+ 4. ReturnIfAbrupt(iterator).
+
+ 7.4.4 IteratorValue ( iterResult )
+
+ 1. Assert: Type(iterResult) is Object.
+ 2. Return Get(iterResult, "value").
+
+ 7.3.1 Get (O, P)
+
+ [...]
+ 3. Return O.[[Get]](P, O).
+---*/
+var iter = {};
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ new function() {}(0, ...iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-obj-unresolvable.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-obj-unresolvable.js
new file mode 100644
index 0000000000..9eed42b6d2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-obj-unresolvable.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-err-obj-unresolvable.case
+// - src/spread/error/member-expr.template
+/*---
+description: Object Spread operator results in error when using an unresolvable reference (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+
+assert.throws(ReferenceError, function() {
+ new function() {}({a: 0, ...unresolvableReference});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-unresolvable.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-unresolvable.js
new file mode 100644
index 0000000000..b393fc09dc
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-err-unresolvable.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator following other arguments when reference is unresolvable (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ArgumentList , ... AssignmentExpression
+
+ 1. Let precedingArgs be the result of evaluating ArgumentList.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let iterator be GetIterator(GetValue(spreadRef) ).
+ 4. ReturnIfAbrupt(iterator).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ new function() {}(0, ...unresolvableReference);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-expr-throws.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-expr-throws.js
new file mode 100644
index 0000000000..4a37f2e1dc
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-expr-throws.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-err-expr-throws.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator applied to the only argument when evaluation throws (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [generators]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(Test262Error, function() {
+ new function() {}(...function*() { throw new Test262Error(); }());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-call.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-call.js
new file mode 100644
index 0000000000..c5372145b1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-call.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-err-itr-get-call.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator applied to the only argument when GetIterator fails (@@iterator function invocation) (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+
+ 7.4.1 GetIterator ( obj, method )
+
+ [...]
+ 3. Let iterator be Call(method,obj).
+ 4. ReturnIfAbrupt(iterator).
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ new function() {}(...iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-get.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-get.js
new file mode 100644
index 0000000000..2c7475c7a8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-get.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-err-itr-get-get.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator applied to the only argument when GetIterator fails (@@iterator property access) (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+
+ 7.4.1 GetIterator ( obj, method )
+
+ 1. If method was not passed, then
+ a. Let method be ? GetMethod(obj, @@iterator).
+---*/
+var iter = {};
+Object.defineProperty(iter, Symbol.iterator, {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ new function() {}(...iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-value.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-value.js
new file mode 100644
index 0000000000..e6fa1ebd1c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-value.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-err-itr-get-value.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator applied to the only argument when GetIterator fails (@@iterator function return value) (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+
+ 7.4.1 GetIterator ( obj, method )
+
+ [...]
+ 2. Let iterator be ? Call(method, obj).
+ 3. If Type(iterator) is not Object, throw a TypeError exception.
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return null;
+};
+
+assert.throws(TypeError, function() {
+ new function() {}(...iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-step.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-step.js
new file mode 100644
index 0000000000..3e18f9d4ae
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-step.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-err-itr-step.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator applied to the only argument when IteratorStep fails (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+ 6. Repeat
+ a. Let next be IteratorStep(iterator).
+ b. ReturnIfAbrupt(next).
+
+ 7.4.5 IteratorStep ( iterator )
+
+ 1. Let result be IteratorNext(iterator).
+ 2. ReturnIfAbrupt(result).
+
+ 7.4.2 IteratorNext ( iterator, value )
+
+ 1. If value was not passed, then
+ a. Let result be Invoke(iterator, "next", « »).
+ [...]
+ 3. ReturnIfAbrupt(result).
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ new function() {}(...iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-value.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-value.js
new file mode 100644
index 0000000000..ff8141e961
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-value.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-err-itr-value.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator applied to the only argument when IteratorValue fails (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+ 6. Repeat
+ a. Let next be IteratorStep(iterator).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return list.
+ d. Let nextArg be IteratorValue(next).
+ e. ReturnIfAbrupt(nextArg).
+
+ 7.4.4 IteratorValue ( iterResult )
+
+ 1. Assert: Type(iterResult) is Object.
+ 2. Return Get(iterResult, "value").
+
+ 7.3.1 Get (O, P)
+
+ [...]
+ 3. Return O.[[Get]](P, O).
+---*/
+var iter = {};
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ new function() {}(...iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-obj-unresolvable.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-obj-unresolvable.js
new file mode 100644
index 0000000000..cc65d5438d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-obj-unresolvable.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-err-obj-unresolvable.case
+// - src/spread/error/member-expr.template
+/*---
+description: Object Spread operator results in error when using an unresolvable reference (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+
+assert.throws(ReferenceError, function() {
+ new function() {}({...unresolvableReference});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-unresolvable.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-unresolvable.js
new file mode 100644
index 0000000000..e1e8415a02
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-unresolvable.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-err-unresolvable.case
+// - src/spread/error/member-expr.template
+/*---
+description: Spread operator applied to the only argument when reference is unresolvable (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ new function() {}(...unresolvableReference);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-empty.js b/js/src/tests/test262/language/expressions/new/spread-mult-empty.js
new file mode 100644
index 0000000000..38020fa567
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-mult-empty.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-empty.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operator following other arguments when no iteration occurs (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ArgumentList , ... AssignmentExpression
+
+ 1. Let precedingArgs be the result of evaluating ArgumentList.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let iterator be GetIterator(GetValue(spreadRef) ).
+ 4. ReturnIfAbrupt(iterator).
+ 5. Repeat
+ a. Let next be IteratorStep(iterator).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return precedingArgs.
+---*/
+
+var callCount = 0;
+
+new function() {
+ assert.sameValue(arguments.length, 3);
+ assert.sameValue(arguments[0], 1);
+ assert.sameValue(arguments[1], 2);
+ assert.sameValue(arguments[2], 3);
+ callCount += 1;
+}(1, 2, 3, ...[]);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-expr.js b/js/src/tests/test262/language/expressions/new/spread-mult-expr.js
new file mode 100644
index 0000000000..30e6539a1d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-mult-expr.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-expr.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operator applied to AssignmentExpression following other elements (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ArgumentList , ... AssignmentExpression
+
+ 1. Let precedingArgs be the result of evaluating ArgumentList.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let iterator be GetIterator(GetValue(spreadRef) ).
+ 4. ReturnIfAbrupt(iterator).
+ 5. Repeat
+ a. Let next be IteratorStep(iterator).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return precedingArgs.
+---*/
+var source = [3, 4, 5];
+var target;
+
+var callCount = 0;
+
+new function() {
+ assert.sameValue(arguments.length, 5);
+ assert.sameValue(arguments[0], 1);
+ assert.sameValue(arguments[1], 2);
+ assert.sameValue(arguments[2], 3);
+ assert.sameValue(arguments[3], 4);
+ assert.sameValue(arguments[4], 5);
+ assert.sameValue(target, source);
+ callCount += 1;
+}(1, 2, ...target = source);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-iter.js b/js/src/tests/test262/language/expressions/new/spread-mult-iter.js
new file mode 100644
index 0000000000..967229af2f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-mult-iter.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-iter.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operator following other arguments with a valid iterator (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+ 6. Repeat
+ a. Let next be IteratorStep(iterator).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return list.
+ d. Let nextArg be IteratorValue(next).
+ e. ReturnIfAbrupt(nextArg).
+ f. Append nextArg as the last element of list.
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ var nextCount = 3;
+ return {
+ next: function() {
+ nextCount += 1;
+ return { done: nextCount === 6, value: nextCount };
+ }
+ };
+};
+
+var callCount = 0;
+
+new function() {
+ assert.sameValue(arguments.length, 5);
+ assert.sameValue(arguments[0], 1);
+ assert.sameValue(arguments[1], 2);
+ assert.sameValue(arguments[2], 3);
+ assert.sameValue(arguments[3], 4);
+ assert.sameValue(arguments[4], 5);
+ callCount += 1;
+}(1, 2, 3, ...iter);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-literal.js b/js/src/tests/test262/language/expressions/new/spread-mult-literal.js
new file mode 100644
index 0000000000..51dc64f2f9
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-mult-literal.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-literal.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operator applied to AssignmentExpression following other elements (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ArgumentList , ... AssignmentExpression
+
+ 1. Let precedingArgs be the result of evaluating ArgumentList.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let iterator be GetIterator(GetValue(spreadRef) ).
+ 4. ReturnIfAbrupt(iterator).
+ 5. Repeat
+ a. Let next be IteratorStep(iterator).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return precedingArgs.
+---*/
+
+var callCount = 0;
+
+new function() {
+ assert.sameValue(arguments.length, 5);
+ assert.sameValue(arguments[0], 5);
+ assert.sameValue(arguments[1], 6);
+ assert.sameValue(arguments[2], 7);
+ assert.sameValue(arguments[3], 8);
+ assert.sameValue(arguments[4], 9);
+ callCount += 1;
+}(5, ...[6, 7, 8], 9);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-obj-ident.js b/js/src/tests/test262/language/expressions/new/spread-mult-obj-ident.js
new file mode 100644
index 0000000000..eb3070203a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-mult-obj-ident.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-obj-ident.case
+// - src/spread/default/member-expr.template
+/*---
+description: Object Spread operator following other properties (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+let o = {c: 3, d: 4};
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(Object.keys(obj).length, 4);
+
+ verifyProperty(obj, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(obj, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ verifyProperty(obj, "c", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(obj, "d", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount += 1;
+}({a: 1, b: 2, ...o});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-obj-null.js b/js/src/tests/test262/language/expressions/new/spread-mult-obj-null.js
new file mode 100644
index 0000000000..1a9aa9eaa7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-mult-obj-null.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-obj-null.case
+// - src/spread/default/member-expr.template
+/*---
+description: Object Spread operator following other arguments with null value (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.a, 1);
+ assert.sameValue(obj.b, 2);
+ assert.sameValue(Object.keys(obj).length, 2);
+ callCount += 1;
+}({a: 1, b: 2, ...null});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-obj-undefined.js b/js/src/tests/test262/language/expressions/new/spread-mult-obj-undefined.js
new file mode 100644
index 0000000000..3e71260178
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-mult-obj-undefined.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/mult-obj-undefined.case
+// - src/spread/default/member-expr.template
+/*---
+description: Object Spread operator following other arguments with undefined (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.a, 1);
+ assert.sameValue(obj.b, 2);
+ assert.sameValue(Object.keys(obj).length, 2);
+ callCount += 1;
+}({a: 1, b: 2, ...undefined});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-getter-descriptor.js b/js/src/tests/test262/language/expressions/new/spread-obj-getter-descriptor.js
new file mode 100644
index 0000000000..c630fd9d9a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-getter-descriptor.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-getter-descriptor.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operation with getter results in data property descriptor (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+let o = {
+ get a() {
+ return 42;
+ }
+};
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.c, 4);
+ assert.sameValue(obj.d, 5);
+ assert.sameValue(Object.keys(obj).length, 3);
+
+ verifyProperty(obj, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 42
+ });
+ callCount += 1;
+}({...o, c: 4, d: 5});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-getter-init.js b/js/src/tests/test262/language/expressions/new/spread-obj-getter-init.js
new file mode 100644
index 0000000000..95f0f6e907
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-getter-init.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-getter-init.case
+// - src/spread/default/member-expr.template
+/*---
+description: Getter in object literal is not evaluated (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+---*/
+
+let o = {a: 2, b: 3};
+let executedGetter = false;
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.a, 2);
+ assert.sameValue(obj.b, 3);
+ assert.sameValue(executedGetter, false)
+ assert.sameValue(Object.keys(obj).length, 3);
+ callCount += 1;
+}({...o, get c() { executedGetter = true; }});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-manipulate-outter-obj-in-getter.js b/js/src/tests/test262/language/expressions/new/spread-obj-manipulate-outter-obj-in-getter.js
new file mode 100644
index 0000000000..5cd25dd306
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-manipulate-outter-obj-in-getter.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-manipulate-outter-obj-in-getter.case
+// - src/spread/default/member-expr.template
+/*---
+description: Getter manipulates outter object before it's spread operation (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+var o = { a: 0, b: 1 };
+var cthulhu = { get x() {
+ delete o.a;
+ o.b = 42;
+ o.c = "ni";
+}};
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.hasOwnProperty("a"), false);
+ assert.sameValue(obj.b, 42);
+ assert.sameValue(obj.c, "ni");
+ assert(obj.hasOwnProperty("x"));
+ assert.sameValue(Object.keys(obj).length, 3);
+ callCount += 1;
+}({...cthulhu, ...o});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread-getter.js b/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread-getter.js
new file mode 100644
index 0000000000..32d1226cfd
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread-getter.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-mult-spread-getter.case
+// - src/spread/default/member-expr.template
+/*---
+description: Multiple Object Spread usage calls getter multiple times (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+let getterCallCount = 0;
+let o = {
+ get a() {
+ return ++getterCallCount;
+ }
+};
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.a, 2);
+ assert.sameValue(obj.c, 4);
+ assert.sameValue(obj.d, 5);
+ assert.sameValue(Object.keys(obj).length, 3);
+ callCount += 1;
+}({...o, c: 4, d: 5, a: 42, ...o});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread.js b/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread.js
new file mode 100644
index 0000000000..da3c4ac77e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-mult-spread.case
+// - src/spread/default/member-expr.template
+/*---
+description: Multiple Object Spread operation (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+
+let o = {a: 2, b: 3};
+let o2 = {c: 4, d: 5};
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.a, 2);
+ assert.sameValue(obj.b, 3);
+ assert.sameValue(obj.c, 4);
+ assert.sameValue(obj.d, 5);
+ assert.sameValue(Object.keys(obj).length, 4);
+ callCount += 1;
+}({...o, ...o2});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-null.js b/js/src/tests/test262/language/expressions/new/spread-obj-null.js
new file mode 100644
index 0000000000..f67773d781
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-null.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-null.case
+// - src/spread/default/member-expr.template
+/*---
+description: Null Object Spread is ignored (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(Object.keys(obj).length, 0);
+ callCount += 1;
+}({...null});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-override-immutable.js b/js/src/tests/test262/language/expressions/new/spread-obj-override-immutable.js
new file mode 100644
index 0000000000..2689c35e24
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-override-immutable.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-override-immutable.case
+// - src/spread/default/member-expr.template
+/*---
+description: Object Spread overriding immutable properties (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+---*/
+
+let o = {b: 2};
+Object.defineProperty(o, "a", {value: 1, enumerable: true, writable: false, configurable: true});
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.a, 3)
+ assert.sameValue(obj.b, 2);
+
+ verifyProperty(obj, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(obj, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount += 1;
+}({...o, a: 3});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-overrides-prev-properties.js b/js/src/tests/test262/language/expressions/new/spread-obj-overrides-prev-properties.js
new file mode 100644
index 0000000000..fbdbb8719b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-overrides-prev-properties.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-overrides-prev-properties.case
+// - src/spread/default/member-expr.template
+/*---
+description: Object Spread properties overrides previous definitions (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+let o = {a: 2, b: 3};
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.a, 2);
+ assert.sameValue(obj.b, 3);
+ assert.sameValue(Object.keys(obj).length, 2);
+ assert.sameValue(o.a, 2);
+ assert.sameValue(o.b, 3);
+ callCount += 1;
+}({a: 1, b: 7, ...o});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/new/spread-obj-skip-non-enumerable.js
new file mode 100644
index 0000000000..b96f517fc2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-skip-non-enumerable.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-skip-non-enumerable.case
+// - src/spread/default/member-expr.template
+/*---
+description: Object Spread doesn't copy non-enumerable properties (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+---*/
+
+let o = {};
+Object.defineProperty(o, "b", {value: 3, enumerable: false});
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.hasOwnProperty("b"), false)
+ assert.sameValue(Object.keys(obj).length, 0);
+ callCount += 1;
+}({...o});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-spread-order.js b/js/src/tests/test262/language/expressions/new/spread-obj-spread-order.js
new file mode 100644
index 0000000000..980a894c41
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-spread-order.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-spread-order.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operation follows [[OwnPropertyKeys]] order (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol, object-spread]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+var calls = [];
+var o = { get z() { calls.push('z') }, get a() { calls.push('a') } };
+Object.defineProperty(o, 1, { get: () => { calls.push(1) }, enumerable: true });
+Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") }, enumerable: true });
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]);
+ assert.sameValue(Object.keys(obj).length, 3);
+ callCount += 1;
+}({...o});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-symbol-property.js b/js/src/tests/test262/language/expressions/new/spread-obj-symbol-property.js
new file mode 100644
index 0000000000..e68d264fab
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-symbol-property.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-symbol-property.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operation where source object contains Symbol properties (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol, object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+let symbol = Symbol('foo');
+let o = {};
+o[symbol] = 1;
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj[symbol], 1);
+ assert(Object.prototype.hasOwnProperty.call(obj, symbol), "symbol is an own property");
+ assert.sameValue(obj.c, 4);
+ assert.sameValue(obj.d, 5);
+ assert.sameValue(Object.keys(obj).length, 2);
+ callCount += 1;
+}({...o, c: 4, d: 5});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-undefined.js b/js/src/tests/test262/language/expressions/new/spread-obj-undefined.js
new file mode 100644
index 0000000000..3a64b13ffe
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-undefined.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-undefined.case
+// - src/spread/default/member-expr.template
+/*---
+description: Undefined Object Spread is ignored (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(Object.keys(obj).length, 0);
+ callCount += 1;
+}({...undefined});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-with-overrides.js b/js/src/tests/test262/language/expressions/new/spread-obj-with-overrides.js
new file mode 100644
index 0000000000..46fea85d29
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-obj-with-overrides.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/obj-with-overrides.case
+// - src/spread/default/member-expr.template
+/*---
+description: Object Spread properties being overriden (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol, object-spread]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+let o = {a: 2, b: 3, c: 4, e: undefined, f: null, g: false};
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(obj.a, 1);
+ assert.sameValue(obj.b, 7);
+ assert.sameValue(obj.c, 4);
+ assert.sameValue(obj.d, 5);
+ assert(obj.hasOwnProperty("e"));
+ assert.sameValue(obj.f, null);
+ assert.sameValue(obj.g, false);
+ assert.sameValue(obj.h, -0);
+ assert.sameValue(obj.i.toString(), "Symbol(foo)");
+ assert(Object.is(obj.j, o));
+ assert.sameValue(Object.keys(obj).length, 10);
+ callCount += 1;
+}({...o, a: 1, b: 7, d: 5, h: -0, i: Symbol("foo"), j: o});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-sngl-empty.js b/js/src/tests/test262/language/expressions/new/spread-sngl-empty.js
new file mode 100644
index 0000000000..a967289690
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-sngl-empty.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-empty.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operator applied to the only argument when no iteration occurs (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+ 6. Repeat
+ a. Let next be IteratorStep(iterator).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return list.
+ [...]
+---*/
+
+var callCount = 0;
+
+new function() {
+ assert.sameValue(arguments.length, 0);
+ callCount += 1;
+}(...[]);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-sngl-expr.js b/js/src/tests/test262/language/expressions/new/spread-sngl-expr.js
new file mode 100644
index 0000000000..0b3f28bdc3
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-sngl-expr.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-expr.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operator applied to AssignmentExpression as only element (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+ 6. Repeat
+ a. Let next be IteratorStep(iterator).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return list.
+ d. Let nextArg be IteratorValue(next).
+ e. ReturnIfAbrupt(nextArg).
+ f. Append nextArg as the last element of list.
+---*/
+var source = [2, 3, 4];
+var target;
+
+var callCount = 0;
+
+new function() {
+ assert.sameValue(arguments.length, 3);
+ assert.sameValue(arguments[0], 2);
+ assert.sameValue(arguments[1], 3);
+ assert.sameValue(arguments[2], 4);
+ assert.sameValue(target, source);
+ callCount += 1;
+}(...target = source);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-sngl-iter.js b/js/src/tests/test262/language/expressions/new/spread-sngl-iter.js
new file mode 100644
index 0000000000..1b63418aac
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-sngl-iter.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-iter.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operator applied to the only argument with a valid iterator (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [Symbol.iterator]
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+ 6. Repeat
+ a. Let next be IteratorStep(iterator).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return list.
+ d. Let nextArg be IteratorValue(next).
+ e. ReturnIfAbrupt(nextArg).
+ f. Append nextArg as the last element of list.
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ var nextCount = 0;
+ return {
+ next: function() {
+ nextCount += 1;
+ return { done: nextCount === 3, value: nextCount };
+ }
+ };
+};
+
+var callCount = 0;
+
+new function() {
+ assert.sameValue(arguments.length, 2);
+ assert.sameValue(arguments[0], 1);
+ assert.sameValue(arguments[1], 2);
+ callCount += 1;
+}(...iter);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-sngl-literal.js b/js/src/tests/test262/language/expressions/new/spread-sngl-literal.js
new file mode 100644
index 0000000000..b74182edb6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-sngl-literal.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-literal.case
+// - src/spread/default/member-expr.template
+/*---
+description: Spread operator applied to array literal as only element (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+flags: [generated]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+
+ ArgumentList : ... AssignmentExpression
+
+ 1. Let list be an empty List.
+ 2. Let spreadRef be the result of evaluating AssignmentExpression.
+ 3. Let spreadObj be GetValue(spreadRef).
+ 4. Let iterator be GetIterator(spreadObj).
+ 5. ReturnIfAbrupt(iterator).
+ 6. Repeat
+ a. Let next be IteratorStep(iterator).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return list.
+ d. Let nextArg be IteratorValue(next).
+ e. ReturnIfAbrupt(nextArg).
+ f. Append nextArg as the last element of list.
+---*/
+
+var callCount = 0;
+
+new function() {
+ assert.sameValue(arguments.length, 3);
+ assert.sameValue(arguments[0], 3);
+ assert.sameValue(arguments[1], 4);
+ assert.sameValue(arguments[2], 5);
+ callCount += 1;
+}(...[3, 4, 5]);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/new/spread-sngl-obj-ident.js b/js/src/tests/test262/language/expressions/new/spread-sngl-obj-ident.js
new file mode 100644
index 0000000000..d1f4a56034
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/new/spread-sngl-obj-ident.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/spread/sngl-obj-ident.case
+// - src/spread/default/member-expr.template
+/*---
+description: Object Spread operator without other arguments (`new` operator)
+esid: sec-new-operator-runtime-semantics-evaluation
+features: [object-spread]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ MemberExpression : new MemberExpression Arguments
+
+ 1. Return EvaluateNew(MemberExpression, Arguments).
+
+ 12.3.3.1.1 Runtime Semantics: EvaluateNew
+
+ 6. If arguments is empty, let argList be an empty List.
+ 7. Else,
+ a. Let argList be ArgumentListEvaluation of arguments.
+ [...]
+
+ Pending Runtime Semantics: PropertyDefinitionEvaluation
+
+ PropertyDefinition:...AssignmentExpression
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let fromValue be GetValue(exprValue).
+ 3. ReturnIfAbrupt(fromValue).
+ 4. Let excludedNames be a new empty List.
+ 5. Return CopyDataProperties(object, fromValue, excludedNames).
+
+---*/
+let o = {c: 3, d: 4};
+
+
+var callCount = 0;
+
+new function(obj) {
+ assert.sameValue(Object.keys(obj).length, 2);
+
+ verifyProperty(obj, "c", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(obj, "d", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount += 1;
+}({...o});
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);