1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/basic/testClosures.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,18 @@ 1.4 +function testClosures() 1.5 +{ 1.6 + function MyObject(id) { 1.7 + var thisObject = this; 1.8 + this.id = id; 1.9 + this.toString = str; 1.10 + 1.11 + function str() { 1.12 + return "" + this.id + thisObject.id; 1.13 + } 1.14 + } 1.15 + 1.16 + var a = []; 1.17 + for (var i = 0; i < 5; i++) 1.18 + a.push(new MyObject(i)); 1.19 + return a.toString(); 1.20 +} 1.21 +assertEq(testClosures(), "00,11,22,33,44");