summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-bigint.js
blob: 149099ab3f8bc121c96f790559aa0b2854b80426 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (c) 2020 Ecma International.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-assignment-operators-runtime-semantics-evaluation
description: Logical Nullish Assignment Operator
features: [BigInt, logical-assignment-operators]
info: |
    AssignmentExpression:
      LeftHandSideExpression ??= AssignmentExpression

    1. Let lref be the result of evaluating LeftHandSideExpression.
    2. Let lval be ? GetValue(lref).
    3. If lval is neither undefined nor null, return lval.
    4. Let rref be the result of evaluating AssignmentExpression.
    5. Let rval be ? GetValue(rref).
    6. Perform ? PutValue(lref, rval).
    7. Return rval.

---*/

var value = 0n;
assert.sameValue(value ??= 1n, 0n, "(value ??= 1n) === 0n; where value = 0n");

value = 2n;
assert.sameValue(value ??= 1n, 2n, "(value ??= 1n) === 2n; where value = 2n");

reportCompare(0, 0);