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 f() { michael@0: var a = [{}, this]; michael@0: for (var i = 0; i < 14; i++) { michael@0: print(shapeOf(this)); michael@0: Object.prototype.watch.call(a[+(i > 8)], "y", counter); michael@0: y++; michael@0: } michael@0: } michael@0: f(); michael@0: assertEq(hits, 5); michael@0: