summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testMultipleFunctionRedeclarations.js
blob: 701782378f341286c17c57ba9ffe5bb8a70738c1 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function f1() {
    assertEq(g(), 3);
    function g() { return 1 }
    assertEq(g(), 3);
    function g() { return 2 }
    assertEq(g(), 3);
    function g() { return 3 }
    assertEq(g(), 3);
}
f1();

function f2() {
    assertEq(g(), 2);
    var g = 3;
    assertEq(g, 3);
    function g() { return 1 }
    function g() { return 2 }
}
f2();

function f3() {
    assertEq(g(), 2);
    var g = 3;
    assertEq(g, 3);
    function g() { return 1 }
    var g = 4;
    assertEq(g, 4);
    function g() { return 2 }
}
f3();

function f4() {
    assertEq(g(), 4);
    function g() { return 1 }
    assertEq(g(), 4);
    function g() { return 2 }
    var g = 9;
    assertEq(g, 9);
    function g() { return 3 }
    assertEq(g, 9);
    function g() { return 4 }
    assertEq(g, 9);
}
f4();