summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/class/bug1473272-default-constructors.js
blob: e9bd5c188963bc5d36cd69f6826b5b40859a6df1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Test the source location info in a derived-class default constructor.

function W() { test(); }
class Z extends W {}  // line 4
class Y extends Z {}  // line 5

class X extends Y {}  // line 7

function test() {
    for (let frame of new Error().stack.split('\n')) {
        function lineNumber(frame) {
            return +frame.match(/(\d+):\d+$/)[1];
        }

        if (frame.startsWith("Z@"))
            assertEq(lineNumber(frame), 4);
        if (frame.startsWith("Y@"))
            assertEq(lineNumber(frame), 5);
        if (frame.startsWith("X@"))
            assertEq(lineNumber(frame), 7);
    }
}

new X;