Debian Codegraph @

js/src/tests/test262/built-ins/Object/subclass-object-arg.js

raw
1 // Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-object-value
5 author: Matthew Phillips <[email protected]>
6 description: >
7 NewTarget is active function and subclass of Object
8 info: |
9 Object ( [ value ] )
10
11 1. If NewTarget is neither undefined nor the active function, then
12 a. Return ? OrdinaryCreateFromConstructor(NewTarget, "%ObjectPrototype%").
13 [...]
14 features: [class, Reflect, Reflect.construct]
15 ---*/
16
17 class O extends Object {}
18
19 var o1 = new O({a: 1});
20 var o2 = Reflect.construct(Object, [{b: 2}], O);
21
22 assert.sameValue(o1.a, undefined);
23 assert.sameValue(o2.b, undefined);
24
25 assert.sameValue(Object.getPrototypeOf(o1), O.prototype);
26 assert.sameValue(Object.getPrototypeOf(o2), O.prototype);
27
28 reportCompare(0, 0);