michael@0: // assignments to watched properties via ++ must not be traced michael@0: var hits = 0; michael@0: function counter(id, oldval, newval) { michael@0: hits++; michael@0: return newval; michael@0: } michael@0: michael@0: (function () { michael@0: var obj = {x: 0, y: 0}; michael@0: var a = ['x', 'y']; michael@0: obj.watch('z', counter); michael@0: for (var i = 0; i < 14; i++) { michael@0: obj.watch(a[+(i > 8)], counter); michael@0: obj.y++; michael@0: } michael@0: })(); michael@0: assertEq(hits, 5); michael@0: