invalid-extends.js (551B)
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 invalid extends 7 ---*/ 8 assert.throws(TypeError, function() { 9 class C extends 42 {} 10 }); 11 12 assert.throws(TypeError, function() { 13 // Function but its .prototype is not null or a function. 14 class C extends Math.abs {} 15 }); 16 17 assert.throws(TypeError, function() { 18 Math.abs.prototype = 42; 19 class C extends Math.abs {} 20 }); 21 delete Math.abs.prototype; 22 23 reportCompare(0, 0);