lgcl-and-assignment-operator-bigint.js (947B)
1 // Copyright (c) 2020 Ecma International. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-assignment-operators-runtime-semantics-evaluation 6 description: Logical And Assignment Operator 7 features: [BigInt, logical-assignment-operators] 8 info: | 9 AssignmentExpression: 10 LeftHandSideExpression &&= AssignmentExpression 11 12 1. Let lref be the result of evaluating LeftHandSideExpression. 13 2. Let lval be ? GetValue(lref). 14 3. Let lbool be ! ToBoolean(lval). 15 4. If lbool is false, return lval. 16 5. Let rref be the result of evaluating AssignmentExpression. 17 6. Let rval be ? GetValue(rref). 18 7. Perform ? PutValue(lref, rval). 19 8. Return rval. 20 21 ---*/ 22 23 var value = 0n; 24 assert.sameValue(value &&= 1n, 0n, "(value &&= 1n) === 0n; where value = 0n"); 25 26 value = 2n; 27 assert.sameValue(value &&= 1n, 1n, "(value &&= 1n) === 1n; where value = 2n"); 28 29 reportCompare(0, 0);