Debian Codegraph @

js/src/tests/test262/language/statements/class/definition/setters-restricted-ids.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 setters 2
7 ---*/
8 var x = 0;
9 class C {
10 set eval(v) {
11 x = v;
12 }
13 set arguments(v) {
14 x = v;
15 }
16 static set eval(v) {
17 x = v;
18 }
19 static set arguments(v) {
20 x = v;
21 }
22 };
23
24 new C().eval = 1;
25 assert.sameValue(x, 1, "The value of `x` is `1`");
26 new C().arguments = 2;
27 assert.sameValue(x, 2, "The value of `x` is `2`");
28 C.eval = 3;
29 assert.sameValue(x, 3, "The value of `x` is `3`");
30 C.arguments = 4;
31 assert.sameValue(x, 4, "The value of `x` is `4`");
32
33 reportCompare(0, 0);