summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/js/script-tests/function-declarations-in-switch-statement.js
blob: 9bf9fac094e904bdaab46ffd903cac52bdde74ef (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 t(n) {
    switch (n) {
        case 1:
            function f() {
                return 10;
            }
            break;
        case 2:
            function f() {
                return 20;
            }
            break;
    }

    try {
      return f();
    } catch (e) {
      return -1;
    }
}

shouldBe(t(1), '20');
shouldBe(t(2), '20');
shouldBe(t(3), '20');