michael@0: var c = 0; michael@0: function g(o) { michael@0: try { michael@0: for(;;) michael@0: o.next(); michael@0: } catch(e) { michael@0: c += e; michael@0: } michael@0: return o.x; michael@0: } michael@0: function f() { michael@0: var o = {x: 0, next: function() { michael@0: if (this.x++ > 100) michael@0: throw 3; michael@0: }}; michael@0: michael@0: g(o); michael@0: assertEq(o.x, 102); michael@0: michael@0: o.x = 0; michael@0: g(o); michael@0: assertEq(o.x, 102); michael@0: } michael@0: f(); michael@0: assertEq(c, 6);