Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/proto-from-ctor.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-object-value
5 es6id: 19.1.1.1
6 description: Default [[Prototype]] value derived from realm of the newTarget
7 info: |
8 1. If NewTarget is neither undefined nor the active function, then
9 a. Return ? OrdinaryCreateFromConstructor(NewTarget, "%ObjectPrototype%").
10
11 9.1.14 GetPrototypeFromConstructor
12
13 [...]
14 3. Let proto be ? Get(constructor, "prototype").
15 4. If Type(proto) is not Object, then
16 a. Let realm be ? GetFunctionRealm(constructor).
17 b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
18 [...]
19 features: [cross-realm, Reflect]
20 ---*/
21
22 var other = $262.createRealm().global;
23 var C = new other.Function();
24 C.prototype = null;
25
26 var o = Reflect.construct(Object, [], C);
27
28 assert.sameValue(Object.getPrototypeOf(o), other.Object.prototype);