js/src/jit-test/tests/ion/new-9.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:93e037199c6c
1 // Test createThisScripted(), without a singleton.
2 function Foo(a) {
3 this.str = "foo";
4 }
5
6 function Bar(a) {
7 this.str = "bar";
8 }
9
10 function f() {
11 var x;
12 for (var i = 0; i < 400; i++) {
13 if (i % 2 == 0)
14 x = Foo;
15 else
16 x = Bar;
17
18 var y = new x(5);
19
20 if (i % 2 == 0)
21 assertEq(y.str, "foo");
22 else
23 assertEq(y.str, "bar");
24 }
25 }
26
27 f();

mercurial