summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/jaeger/getelem-sanity-2.js
blob: 399219b482cdf33b21406c317b4c1c482ec78bbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var obj = {firstAttr: 'value', secondAttr: 'another value'};

(function() {
    for (var i = 0; i < 12; ++i) {
        var name;
        if (i < 4)
            name = 'firstAttr';
        else if (i < 8)
            name = 'secondAttr';
        else
            name = 'firstAttr';

        var result = obj[name];

        switch (name) {
          case 'firstAttr': assertEq(result, 'value'); break;
          case 'secondAttr': assertEq(result, 'another value'); break;
        }
    }
})();

/* Toggle lookup between two ids. */