1 // Copyright (C) 2021 Alexey Shvayka. All rights reserved.
2 // This code is governed by the license found in the LICENSE file.
5 esid: sec-object.assign
7 [[Set]] to non-existing property of sealed `target` fails with TypeError.
9 SetIntegrityLevel ( O, level )
12 3. Let status be ? O.[[PreventExtensions]]().
15 Object.assign ( target, ...sources )
18 3. For each element nextSource of sources, do
19 a. If nextSource is neither undefined nor null, then
21 iii. For each element nextKey of keys, do
22 1. Let desc be ? from.[[GetOwnProperty]](nextKey).
23 2. If desc is not undefined and desc.[[Enumerable]] is true, then
25 b. Perform ? Set(to, nextKey, propValue, true).
27 OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc )
30 3. If IsDataDescriptor(ownDesc) is true, then
32 c. Let existingDescriptor be ? Receiver.[[GetOwnProperty]](P).
33 d. If existingDescriptor is not undefined, then
36 i. Assert: Receiver does not currently have a property P.
37 ii. Return ? CreateDataProperty(Receiver, P, V).
39 ValidateAndApplyPropertyDescriptor ( O, P, extensible, Desc, current )
42 2. If current is undefined, then
43 a. If extensible is false, return false.
44 features: [Symbol, Reflect]
47 var target1 = Object.seal({ foo: 1 });
49 assert.throws(TypeError, function() {
50 Object.assign(target1, { get bar() {} });
57 assert.throws(TypeError, function() {
58 Object.assign(target2, { [Symbol()]: 1 });