michael@0: // assignment to watched global properties 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: var x = 0; michael@0: var y = 0; michael@0: (function () { michael@0: var a = ['x', 'y']; michael@0: this.watch('z', counter); michael@0: for (var i = 0; i < 14; i++) { michael@0: this.watch(a[+(i > 8)], counter); michael@0: y = 1; michael@0: } michael@0: })(); michael@0: assertEq(hits, 5); michael@0: