lgcl-nullish-assignment-operator-no-set.js 710 B

12345678910111213141516171819202122232425
  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. esid: sec-assignment-operators-runtime-semantics-evaluation
  5. description: >
  6. Strict Mode - TypeError is not thrown if the LeftHandSide of a Logical
  7. Assignment operator(??=) is a reference to a data property with the
  8. attribute value {[[Set]]:undefined} and PutValue step is not reached.
  9. flags: [onlyStrict]
  10. features: [logical-assignment-operators]
  11. ---*/
  12. var obj = {};
  13. Object.defineProperty(obj, "prop", {
  14. get: function() {
  15. return 0;
  16. },
  17. set: undefined,
  18. enumerable: true,
  19. configurable: true
  20. });
  21. assert.sameValue(obj.prop ??= 1, 0, "obj.prop");