summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/baseline/classConstructor-AnyScripted.js
blob: 763a8bb7d9faf4cefcf98ee4a86d98815e393854 (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
function test(fun) {
    fun();
}

// Generate a CallAnyScripted stub in test()
for (let i = 0; i < 20; i++) {
    test(function() { /* wheeee */ });
}

class foo {
    constructor() { }
}

// Compile foo()
for (let i = 0; i < 11; i++)
    new foo();

try {
    test(foo);
    throw new Error("Invoking a class constructor without new must throw");
} catch (e) {
    if (!(e instanceof TypeError))
        throw e;
}