call-generic-constructor.js (424B)
1 // Test that the generic call trampoline handles constructors correctly. 2 3 function foo(f) { 4 return new f(1); 5 } 6 7 with ({}) {} 8 9 function f1(x) { this.x = x; } 10 function f2(y) { this.y = y; } 11 let f3 = f1.bind({}); 12 let f4 = f1.bind({}, 2); 13 let f5 = Uint8Array; 14 15 for (var i = 0; i < 500; i++) { 16 assertEq(foo(f1).x, 1); 17 assertEq(foo(f2).y, 1); 18 assertEq(foo(f3).x, 1); 19 assertEq(foo(f4).x, 2); 20 assertEq(foo(f5)[0], 0); 21 }