Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/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.4.1
5 description: Super need to be called to initialize internals
6 info: |
7 23.4.1 The WeakSet Constructor
8
9 ...
10
11 The WeakSet 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 WeakSet behaviour must include a super call to
14 the WeakSet constructor to create and initialize the subclass instance with
15 the internal state necessary to support the WeakSet.prototype built-in
16 methods.
17 features: [WeakSet]
18 ---*/
19
20 class WS1 extends WeakSet {
21 constructor() {}
22 }
23
24 assert.throws(ReferenceError, function() {
25 new WS1();
26 });
27
28 class WS2 extends WeakSet {
29 constructor() {
30 super();
31 }
32 }
33
34 new WS2();
35
36 reportCompare(0, 0);