michael@0: var calls = 0; michael@0: function g() { michael@0: calls++; michael@0: }; michael@0: function test1() { michael@0: for (var i=0; i<20; i++) { michael@0: if (i > 18) michael@0: g() = 2; michael@0: } michael@0: } michael@0: try { michael@0: test1(); michael@0: assertEq(0, 1); michael@0: } catch(e) { michael@0: assertEq(e instanceof ReferenceError, true); michael@0: } michael@0: michael@0: assertEq(calls, 1); michael@0: michael@0: function test2() { michael@0: for (var i=0; i<20; i++) { michael@0: if (i > 18) michael@0: g()++; michael@0: } michael@0: } michael@0: try { michael@0: test2(); michael@0: assertEq(0, 1); michael@0: } catch(e) { michael@0: assertEq(e instanceof ReferenceError, true); michael@0: } michael@0: assertEq(calls, 2); michael@0: michael@0: function test3() { michael@0: var v1, v2, v3; michael@0: var z = [1, 2, 3]; michael@0: for (var i=0; i<15; i++) { michael@0: if (i > 12) michael@0: [v1, v2, g(), v3] = z michael@0: } michael@0: } michael@0: try { michael@0: test3(); michael@0: assertEq(0, 1); michael@0: } catch(e) { michael@0: assertEq(e instanceof ReferenceError, true); michael@0: } michael@0: assertEq(calls, 3); michael@0: michael@0: function test4() { michael@0: for (var i=0; i<20; i++) { michael@0: if (i > 18) michael@0: g() >>= 2; michael@0: } michael@0: } michael@0: try { michael@0: test4(); michael@0: assertEq(0, 1); michael@0: } catch(e) { michael@0: assertEq(e instanceof ReferenceError, true); michael@0: } michael@0: michael@0: assertEq(calls, 4);