propertyOptimize-1.js (375B)
1 function Foo(x) 2 { 3 this.f = x + 10; 4 } 5 6 function Bar() 7 { 8 this.g = 0; 9 } 10 11 Bar.prototype = Foo.prototype; 12 13 var x = new Foo(0); 14 var y = new Bar(); 15 16 assertEq(10, eval("x.f")); 17 assertEq(undefined, eval("y.f")); 18 19 function Other(x) 20 { 21 this.f = x + 10; 22 } 23 24 var a = new Other(0); 25 var b = Object.create(Other.prototype); 26 27 assertEq(10, eval("a.f")); 28 assertEq(undefined, eval("b.f"));