| "Tests what happens when you have an inlined function that captures arguments and then throws an exception." |
| function foo(f, a, b, c) { |
| capturedArgs = arguments; |
| for (var i = 1; i < arguments.length; ++i) |
| result += arguments[i] + f(); |
| return result + a + b + c; |
| return eval("(function() { if (shouldThrow) throw \"The exception " + i + "\"; return 0; })"); |
| for (var i = 0; i < 100; i = dfgIncrement({f:bar, i:i + 1, n:100})) |
| testFailed("bar() didn't throw an exception."); |
| shouldBe("theException", "\"The exception 100\""); |
| shouldBe("capturedArgs.length", "4"); |
| shouldBe("capturedArgs[1]", "1"); |
| shouldBe("capturedArgs[2]", "2"); |
| shouldBe("capturedArgs[3]", "3"); |