summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js')
-rw-r--r--js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js
new file mode 100644
index 0000000000..48f9da1452
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/logical-assignment-private/and.case
+// - src/logical-assignment-private/default/data-property.template
+/*---
+description: Logical-and assignment with target being a private reference (to a field)
+esid: sec-assignment-operators-runtime-semantics-evaluation
+features: [class-fields-private, logical-assignment-operators]
+flags: [generated]
+info: |
+ sec-property-accessors-runtime-semantics-evaluation
+ MemberExpression : MemberExpression `.` PrivateIdentifier
+
+ 1. Let _baseReference_ be the result of evaluating |MemberExpression|.
+ 2. Let _baseValue_ be ? GetValue(_baseReference_).
+ 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|.
+ 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_).
+
+ PutValue (V, W)
+ ...
+ 5.b. If IsPrivateReference(_V_) is *true*, then
+ i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_).
+
+ PrivateSet (O, P, value)
+ ...
+ 3. If _entry_.[[Kind]] is ~field~, then
+ a. Set _entry_.[[Value]] to _value_.
+
+
+ sec-assignment-operators-runtime-semantics-evaluation
+ AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression
+ 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|.
+ 2. Let _lval_ be ? GetValue(_lref_).
+ 3. Let _lbool_ be ! ToBoolean(_lval_).
+ 4. If _lbool_ is *false*, return _lval_.
+ ...
+ 7. Perform ? PutValue(_lref_, _rval_).
+ 8. Return _rval_.
+---*/
+
+
+class C {
+ #field = true;
+ compoundAssignment() {
+ return this.#field &&= false;
+ }
+ fieldValue() {
+ return this.#field;
+ }
+}
+
+const o = new C();
+assert.sameValue(o.compoundAssignment(), false, "The expression should evaluate to the result");
+assert.sameValue(o.fieldValue(), false, "PutValue should store the result in the private reference");
+
+reportCompare(0, 0);