basic.js (668B)
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 7 ---*/ 8 var C2; 9 class C { 10 constructor() { 11 C2 = C; 12 } 13 m() { 14 C2 = C; 15 } 16 get x() { 17 C2 = C; 18 } 19 set x(_) { 20 C2 = C; 21 } 22 } 23 new C(); 24 assert.sameValue(C, C2, "The value of `C` is `C2`"); 25 26 C2 = undefined; 27 new C().m(); 28 assert.sameValue(C, C2, "The value of `C` is `C2`"); 29 30 C2 = undefined; 31 new C().x; 32 assert.sameValue(C, C2, "The value of `C` is `C2`"); 33 34 C2 = undefined; 35 new C().x = 1; 36 assert.sameValue(C, C2, "The value of `C` is `C2`"); 37 38 reportCompare(0, 0);