summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testBug753158.js
blob: 50ba14b2324b57e2b7326a08c3be9513dc04a190 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function testFuncStmt1() {
    var g = 3;
    function f(b) {
        if (b) {
            function g() { return 42 }
            assertEq(g(), 42);
        }
    }
    f(true);
}
testFuncStmt1();

function testFuncStmt2() {
    var g = 3;
    (function(b) {
        if (b) {
            function g() { return 42 }
            function f() { assertEq(g(), 42); }
            f();
        }
    })(true);
}
testFuncStmt2();

function testEval1() {
    var g = 3;
    function f() {
        eval("var g = 42");
        assertEq(g, 42);
    }
    f();
}
testEval1();

function testEval2() {
    var g = 3;
    (function() {
        eval("var g = 42");
        function f() {
            assertEq(g, 42);
        }
        f();
    })();
}
testEval2();

function testWith1() {
    var g = 3;
    function f() {
        with ({g:42}) {
            assertEq(g, 42);
        }
    }
    f();
}
testWith1();

function testWith2() {
    var g = 3;
    with ({g:42}) {
        function f() {
            assertEq(g, 42);
        }
    }
    f();
}
testWith2();