expression.js (1116B)
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 expression 7 ---*/ 8 var Cc; 9 var Cm; 10 var Cgx; 11 var Csx; 12 var Cv = class C { 13 constructor() { 14 assert.sameValue(C, Cv, "The value of `C` is `Cv`, inside `constructor()`"); 15 Cc = C; 16 } 17 m() { 18 assert.sameValue(C, Cv, "The value of `C` is `Cv`, inside `m()`"); 19 Cm = C; 20 } 21 get x() { 22 assert.sameValue(C, Cv, "The value of `C` is `Cv`, inside `get x()`"); 23 Cgx = C; 24 } 25 set x(_) { 26 assert.sameValue(C, Cv, "The value of `C` is `Cv`, inside `set x()`"); 27 Csx = C; 28 } 29 }; 30 31 new Cv(); 32 assert.sameValue(Cc, Cv, "The value of `Cc` is `Cv`, after executing `new Cv();`"); 33 34 new Cv().m(); 35 assert.sameValue(Cm, Cv, "The value of `Cm` is `Cv`, after executing `new Cv().m();`"); 36 37 new Cv().x; 38 assert.sameValue(Cgx, Cv, "The value of `Cgx` is `Cv`, after executing `new Cv().x;`"); 39 40 new Cv().x = 1; 41 assert.sameValue(Csx, Cv, "The value of `Csx` is `Cv`, after executing `new Cv().x = 1;`"); 42 43 reportCompare(0, 0);