From 92a200b29fccf68109cccc2d952f09bc56b27f39 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Mon, 14 Sep 2020 15:56:43 -0400 Subject: [PATCH] Attempting to set a value to a binding that no longer exists must throw a ReferenceError exception in strict mode code. Fixes gh-427 --- ...t-operator-calls-putvalue-lref--rval--1.js | 41 +++++++++++++++++++ ...ent-operator-calls-putvalue-lref--rval-.js | 36 ++++++++++++++++ ...ment-operator-calls-putvalue-lref--v--1.js | 40 ++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--10.js | 41 +++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--11.js | 40 ++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--12.js | 41 +++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--13.js | 39 ++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--14.js | 40 ++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--15.js | 39 ++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--16.js | 40 ++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--17.js | 39 ++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--18.js | 40 ++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--19.js | 39 ++++++++++++++++++ ...ment-operator-calls-putvalue-lref--v--2.js | 40 ++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--20.js | 40 ++++++++++++++++++ ...ent-operator-calls-putvalue-lref--v--21.js | 39 ++++++++++++++++++ ...ment-operator-calls-putvalue-lref--v--3.js | 39 ++++++++++++++++++ ...ment-operator-calls-putvalue-lref--v--4.js | 40 ++++++++++++++++++ ...ment-operator-calls-putvalue-lref--v--5.js | 39 ++++++++++++++++++ ...ment-operator-calls-putvalue-lref--v--6.js | 40 ++++++++++++++++++ ...ment-operator-calls-putvalue-lref--v--7.js | 39 ++++++++++++++++++ ...ment-operator-calls-putvalue-lref--v--8.js | 40 ++++++++++++++++++ ...ment-operator-calls-putvalue-lref--v--9.js | 39 ++++++++++++++++++ ...gnment-operator-calls-putvalue-lref--v-.js | 40 ++++++++++++++++++ ...ecrement-calls-putvalue-lhs-newvalue--1.js | 39 ++++++++++++++++++ ...-decrement-calls-putvalue-lhs-newvalue-.js | 40 ++++++++++++++++++ ...ncrement-calls-putvalue-lhs-newvalue--1.js | 39 ++++++++++++++++++ ...-increment-calls-putvalue-lhs-newvalue-.js | 40 ++++++++++++++++++ ...rement-x-calls-putvalue-lhs-newvalue--1.js | 39 ++++++++++++++++++ ...ecrement-x-calls-putvalue-lhs-newvalue-.js | 40 ++++++++++++++++++ ...rement-x-calls-putvalue-lhs-newvalue--1.js | 39 ++++++++++++++++++ ...ncrement-x-calls-putvalue-lhs-newvalue-.js | 40 ++++++++++++++++++ 32 files changed, 1266 insertions(+) create mode 100644 test/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval--1.js create mode 100644 test/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval-.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js create mode 100644 test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js create mode 100644 test/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue--1.js create mode 100644 test/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue-.js create mode 100644 test/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue--1.js create mode 100644 test/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue-.js create mode 100644 test/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue--1.js create mode 100644 test/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue-.js create mode 100644 test/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue--1.js create mode 100644 test/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue-.js diff --git a/test/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval--1.js b/test/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval--1.js new file mode 100644 index 00000000000..6b603731f0a --- /dev/null +++ b/test/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval--1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Assignment Operator calls PutValue(lref, rval) (formerly S11.13.1_A5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ + +var count = 0; +var global = this; + +Object.defineProperty(this, "x", { + configurable: true, + value: 1 +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x = (delete global.x, 2); + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); +assert(!('x' in global)); + diff --git a/test/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval-.js b/test/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval-.js new file mode 100644 index 00000000000..234e7217607 --- /dev/null +++ b/test/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval-.js @@ -0,0 +1,36 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Assignment Operator calls PutValue(lref, rval) (formerly S11.13.1_A5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ + +var count = 0; +var scope = {x: 1}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x = (delete scope.x, 2); + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js new file mode 100644 index 00000000000..e761e0d2abf --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.10_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; + +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x ^= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js new file mode 100644 index 00000000000..5df4c0ecec7 --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.4_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ + +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x += 1; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js new file mode 100644 index 00000000000..df04571c60d --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.4_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x += 1; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js new file mode 100644 index 00000000000..660724a6b43 --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x -= 1; + count++; + }); + count++; +})(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js new file mode 100644 index 00000000000..dc0159fd3b1 --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x -= 1; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js new file mode 100644 index 00000000000..22b6dbc5da5 --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.6_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x <<= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js new file mode 100644 index 00000000000..350a72168cc --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.6_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x <<= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js new file mode 100644 index 00000000000..f4abf82b8d8 --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.7_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 16; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js new file mode 100644 index 00000000000..9079e76c3fc --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.7_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 16; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js new file mode 100644 index 00000000000..2dfe18b1cfb --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.8_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 16; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>>= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js new file mode 100644 index 00000000000..ca00e0774fe --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.8_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 16; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>>= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js new file mode 100644 index 00000000000..e42fb5b501e --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.11_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x |= 4; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js new file mode 100644 index 00000000000..3ee960590ae --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.9_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 5; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x &= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js new file mode 100644 index 00000000000..c41b445f50c --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.9_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 5; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x &= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js new file mode 100644 index 00000000000..b8a7462b146 --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.11_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x |= 4; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js new file mode 100644 index 00000000000..0668987492d --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.1_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x *= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js new file mode 100644 index 00000000000..abc9431dbda --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.1_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x *= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js new file mode 100644 index 00000000000..39dbc6825c7 --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.2_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 6; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x /= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js new file mode 100644 index 00000000000..f977cb731ae --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.2_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 6; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x /= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js new file mode 100644 index 00000000000..c039181dd48 --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.3_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 5; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x %= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js new file mode 100644 index 00000000000..ee2b3e61f4e --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.3_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 5; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x %= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js new file mode 100644 index 00000000000..61d6db054ae --- /dev/null +++ b/test/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.10_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x ^= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue--1.js b/test/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue--1.js new file mode 100644 index 00000000000..2aa6af2a2b9 --- /dev/null +++ b/test/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue--1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator x-- calls PutValue(lhs, newValue) (formerly S11.3.2_A5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x--; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue-.js b/test/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue-.js new file mode 100644 index 00000000000..0ce36079862 --- /dev/null +++ b/test/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue-.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator x-- calls PutValue(lhs, newValue) (formerly S11.3.2_A5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x--; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue--1.js b/test/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue--1.js new file mode 100644 index 00000000000..2250e995ac1 --- /dev/null +++ b/test/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue--1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator x++ calls PutValue(lhs, newValue) (formerly S11.3.1_A5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x++; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue-.js b/test/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue-.js new file mode 100644 index 00000000000..990a7b42e48 --- /dev/null +++ b/test/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue-.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator x++ calls PutValue(lhs, newValue) (formerly S11.3.1_A5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x++; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue--1.js b/test/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue--1.js new file mode 100644 index 00000000000..dad98eac223 --- /dev/null +++ b/test/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue--1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator --x calls PutValue(lhs, newValue) (formerly S11.4.5_A5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + --x; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue-.js b/test/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue-.js new file mode 100644 index 00000000000..fe1e217cec4 --- /dev/null +++ b/test/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue-.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator --x calls PutValue(lhs, newValue) (formerly S11.4.5_A5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + --x; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); diff --git a/test/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue--1.js b/test/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue--1.js new file mode 100644 index 00000000000..1c55dd94a6c --- /dev/null +++ b/test/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue--1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator ++x calls PutValue(lhs, newValue) (formerly S11.4.4_A5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + ++x; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); diff --git a/test/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue-.js b/test/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue-.js new file mode 100644 index 00000000000..8e2065c2b98 --- /dev/null +++ b/test/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue-.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator ++x calls PutValue(lhs, newValue) (formerly S11.4.4_A5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + ++x; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope));