Debian Codegraph @

js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-writeable-strict.js

raw
1 'use strict';
2 // Copyright (c) 2020 Ecma International. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-assignment-operators-runtime-semantics-evaluation
7 description: >
8 Strict Mode - TypeError is not thrown if the LeftHandSide of a Logical
9 Assignment operator(||=) is a reference to a data property with the
10 attribute value {[[Writable]]:false} and PutValue step is not reached.
11 flags: [onlyStrict]
12 features: [logical-assignment-operators]
13
14 ---*/
15
16 var obj = {};
17 Object.defineProperty(obj, "prop", {
18 value: 2,
19 writable: false,
20 enumerable: true,
21 configurable: true
22 });
23
24 assert.sameValue(obj.prop ||= 1, 2, "obj.prop");
25
26 reportCompare(0, 0);