side-effects-in-extends.js (659B)
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 side effect in extends 7 ---*/ 8 var calls = 0; 9 class C {} 10 class D extends (calls++, C) {} 11 assert.sameValue(calls, 1, "The value of `calls` is `1`"); 12 assert.sameValue(typeof D, 'function', "`typeof D` is `'function'`"); 13 assert.sameValue(Object.getPrototypeOf(D), C, "`Object.getPrototypeOf(D)` returns `C`"); 14 assert.sameValue( 15 C.prototype, 16 Object.getPrototypeOf(D.prototype), 17 "The value of `C.prototype` is `Object.getPrototypeOf(D.prototype)`" 18 ); 19 20 reportCompare(0, 0);