bug1473272-default-constructors.js (624B)
1 // Test the source location info in a derived-class default constructor. 2 3 function W() { test(); } 4 class Z extends W {} // line 4 5 class Y extends Z {} // line 5 6 7 class X extends Y {} // line 7 8 9 function test() { 10 for (let frame of new Error().stack.split('\n')) { 11 function lineNumber(frame) { 12 return +frame.match(/(\d+):\d+$/)[1]; 13 } 14 15 if (frame.startsWith("Z@")) 16 assertEq(lineNumber(frame), 4); 17 if (frame.startsWith("Y@")) 18 assertEq(lineNumber(frame), 5); 19 if (frame.startsWith("X@")) 20 assertEq(lineNumber(frame), 7); 21 } 22 } 23 24 new X;