michael@0: this.name = "outer"; michael@0: michael@0: var sb = evalcx(''); michael@0: sb.name = "inner"; michael@0: sb.parent = this; michael@0: michael@0: var res = 0; michael@0: michael@0: function f() { michael@0: assertEq(this.name, "outer"); michael@0: res++; michael@0: } michael@0: michael@0: // ff is a property of the inner global object. Generate a CALLNAME IC, then michael@0: // change ff to a function on the outer global. It should get the inner this michael@0: // value. michael@0: evalcx('this.ff = function() {};' + michael@0: '(function() { ' + michael@0: 'eval("");' + michael@0: 'for(var i=0; i<10; i++) {' + michael@0: 'ff();' + michael@0: 'if (i == 5) ff = parent.f;' + michael@0: '}' + michael@0: '})()', sb); michael@0: assertEq(res, 4);