]>
Commit | Line | Data |
---|---|---|
81345200 A |
1 | function foo(o) { |
2 | return o.f + 1; | |
3 | } | |
4 | ||
5 | Number.prototype.f = 42; | |
6 | ||
7 | noInline(foo); | |
8 | ||
9 | for (var i = 0; i < 100000; ++i) { | |
10 | var result = foo(23); | |
11 | if (result != 43) | |
12 | throw "Error: bad result: " + result; | |
13 | result = foo({f:25}); | |
14 | if (result != 26) | |
15 | throw "Error: bad result: " + result; | |
16 | result = foo({g:12, f:13}); | |
17 | if (result != 14) | |
18 | throw "Error: bad result: " + result; | |
19 | } | |
20 | ||
21 | var didThrow; | |
22 | try { | |
23 | foo(void 0); | |
24 | } catch (e) { | |
25 | didThrow = e; | |
26 | } | |
27 | ||
28 | if (!didThrow || didThrow.toString().indexOf("TypeError:") != 0) | |
29 | throw "Error: didn't throw or threw wrong exception: " + didThrow; |