Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/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: 23.2.1
5 description: Super need to be called to initialize internals
6 info: |
7 23.2.1 The Set Constructor
8
9 ...
10
11 The Set constructor is designed to be subclassable. It may be used as the
12 value in an extends clause of a class definition. Subclass constructors that
13 intend to inherit the specified Set behaviour must include a super call to the
14 Set constructor to create and initialize the subclass instance with the
15 internal state necessary to support the Set.prototype built-in methods.
16 ---*/
17
18 class S1 extends Set {
19 constructor() {}
20 }
21
22 assert.throws(ReferenceError, function() {
23 new S1();
24 });
25
26 class S2 extends Set {
27 constructor() {
28 super();
29 }
30 }
31
32 new S2();
33
34 reportCompare(0, 0);