summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testCallProtoMethod.js
blob: 8907871ba09ce16a1391770f5fa94c7b2af087db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function testCallProtoMethod() {
    function X() { this.x = 1; }
    X.prototype.getName = function () { return "X"; }

    function Y() { this.x = 2; }
    Y.prototype.getName = function() { return "Y"; };

    var a = [new X, new X, new X, new X, new Y];
    var s = '';
    for (var i = 0; i < a.length; i++)
        s += a[i].getName();
    return s;
}
assertEq(testCallProtoMethod(), 'XXXXY');