Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/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.5.1
5 description: Super need to be called to initialize internals
6 info: |
7 19.5.1 The Error Constructor
8
9 ...
10 The Error constructor is designed to be subclassable. It may be used as the
11 alue of an extends clause of a class definition. Subclass constructors that
12 intend to inherit the specified Error behaviour must include a super call to
13 the Error constructor to create and initialize subclass instances with a
14 [[ErrorData]] internal slot.
15 ---*/
16
17 class CustomError extends Error {
18 constructor() {}
19 }
20
21 assert.throws(ReferenceError, function() {
22 new CustomError('foo');
23 });
24
25 reportCompare(0, 0);