michael@0: function g() {} michael@0: michael@0: function h() { michael@0: for (var i = 0; i < 9; i++) michael@0: x.f = i; michael@0: } michael@0: michael@0: function j() { michael@0: x.f(); michael@0: } michael@0: michael@0: var x = {f: 0.7, g: g}; michael@0: x.g(); // interpreter brands x michael@0: h(); michael@0: print(shapeOf(x)); michael@0: x.f = function (){}; // does not change x's shape michael@0: j(); michael@0: print(shapeOf(x)); michael@0: h(); // should change x's shape michael@0: michael@0: var thrown = 'none'; michael@0: try { michael@0: j(); // should throw since x.f === 8 michael@0: } catch (exc) { michael@0: thrown = exc.name; michael@0: } michael@0: assertEq(thrown, 'TypeError');