Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/super-must-be-called.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 es6id: 19.3.1
5 description: Super need to be called to initialize Boolean internals
6 info: |
7 19.3.1 The Boolean Constructor
8
9 ...
10 Subclass constructors that intend to inherit the specified Boolean behaviour
11 must include a super call to the Boolean constructor to create and initialize
12 the subclass instance with a [[BooleanData]] internal slot.
13 ---*/
14
15 class Bln extends Boolean {
16 constructor() {}
17 }
18
19 // Boolean internals are not initialized
20 assert.throws(ReferenceError, function() {
21 new Bln(1);
22 });
23
24 class Bln2 extends Boolean {
25 constructor() {
26 super();
27 }
28 }
29
30 var b = new Bln2(1);
31 assert(b instanceof Boolean);
32
33 reportCompare(0, 0);