Debian Codegraph @

js/src/tests/test262/language/arguments-object/mapped/writable-enumerable-configurable-descriptor.js

raw
1 // Copyright (C) 2020 Alexey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-arguments-exotic-objects-defineownproperty-p-desc
6 description: >
7 Index stays mapped when redefined with complete descriptor, which differs only
8 by the [[Value]] field. Unmapped index is created.
9 info: |
10 [[DefineOwnProperty]] ( P, Desc )
11
12 [...]
13 6. Let allowed be ? OrdinaryDefineOwnProperty(args, P, newArgDesc).
14 7. If allowed is false, return false.
15 8. If isMapped is true, then
16 [...]
17 b. Else,
18 i. If Desc.[[Value]] is present, then
19 1. Let setStatus be Set(map, P, Desc.[[Value]], false).
20 2. Assert: setStatus is true because formal parameters mapped by argument objects are always writable.
21 9. Return true.
22 flags: [noStrict]
23 ---*/
24
25 (function(a) {
26 Object.defineProperty(arguments, "0", {
27 value: "foo",
28 writable: true,
29 enumerable: true,
30 configurable: true,
31 });
32
33 assert.sameValue(a, "foo");
34 assert.sameValue(arguments[0], "foo");
35
36
37 Object.defineProperty(arguments, "1", {
38 value: "bar",
39 writable: true,
40 enumerable: true,
41 configurable: true,
42 });
43
44 assert.sameValue(arguments[1], "bar");
45 })(0);
46
47 reportCompare(0, 0);