summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-writeable-put-strict.js
blob: caef17b5d581243a1b245c20262f9ed1f7b670e8 (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
29
'use strict';
// 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: >
    Strict Mode - TypeError is thrown if the LeftHandSide of a Logical
    Assignment operator(??=) is a reference to a data property with the
    attribute value {[[Writable]]:false} and PutValue step is reached.
flags: [onlyStrict]
features: [logical-assignment-operators]

---*/

var obj = {};
Object.defineProperty(obj, "prop", {
  value: undefined,
  writable: false,
  enumerable: true,
  configurable: true
});

assert.throws(TypeError, function() {
  obj.prop ??= 1;
});
assert.sameValue(obj.prop, undefined, "obj.prop");

reportCompare(0, 0);