Debian Codegraph @

js/src/tests/test262/language/statements/class/name-binding/const.js

raw
1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 14.5
5 description: >
6 class name binding const
7 ---*/
8 assert.throws(TypeError, function() {
9 class C { constructor() { C = 42; } }; new C();
10 });
11 assert.throws(TypeError, function() {
12 new (class C { constructor() { C = 42; } })
13 });
14 assert.throws(TypeError, function() {
15 class C { m() { C = 42; } }; new C().m()
16 });
17 assert.throws(TypeError, function() {
18 new (class C { m() { C = 42; } }).m()
19 });
20 assert.throws(TypeError, function() {
21 class C { get x() { C = 42; } }; new C().x
22 });
23 assert.throws(TypeError, function() {
24 (new (class C { get x() { C = 42; } })).x
25 });
26 assert.throws(TypeError, function() {
27 class C { set x(_) { C = 42; } }; new C().x = 15;
28 });
29 assert.throws(TypeError, function() {
30 (new (class C { set x(_) { C = 42; } })).x = 15;
31 });
32
33 reportCompare(0, 0);