Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/super/realm.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-super-keyword
5 es6id: 12.3.5
6 description: >
7 Default [[Prototype]] value derived from realm of the newTarget value
8 info: |
9 1. Let newTarget be GetNewTarget().
10 [...]
11 6. Let result be ? Construct(func, argList, newTarget).
12 [...]
13
14 9.1.14 GetPrototypeFromConstructor
15
16 [...]
17 3. Let proto be ? Get(constructor, "prototype").
18 4. If Type(proto) is not Object, then
19 a. Let realm be ? GetFunctionRealm(constructor).
20 b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
21 [...]
22 features: [cross-realm, Reflect]
23 ---*/
24
25 var other = $262.createRealm().global;
26 var C = new other.Function();
27 C.prototype = null;
28
29 class B extends function() {} {
30 constructor() {
31 super();
32 }
33 }
34
35 var b = Reflect.construct(B, [], C);
36
37 assert.sameValue(Object.getPrototypeOf(b), other.Object.prototype);