Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/new-symbol-with-super-throws.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.4.1
5 description: Symbol subclass called with the new operator throws on super()
6 info: |
7 19.4.1 The Symbol Constructor
8
9 ...
10 The Symbol constructor is not intended to be used with the new operator or to
11 be subclassed. It may be used as the value of an extends clause of a class
12 definition but a super call to the Symbol constructor will cause an exception.
13
14 19.4.1.1 Symbol ( [ description ] )
15
16 ...
17 1. If NewTarget is not undefined, throw a TypeError exception.
18 features: [Symbol]
19 ---*/
20
21 class S1 extends Symbol {}
22
23 assert.throws(TypeError, function() {
24 new S1();
25 });
26
27 class S2 extends Symbol {
28 constructor() {
29 super();
30 }
31 }
32
33 assert.throws(TypeError, function() {
34 new S2();
35 });
36
37
38 reportCompare(0, 0);