Point#getLength: access to out of bounds index in arguments array prevented function from being optimized.

This commit is contained in:
Jonathan Puckey 2012-07-25 20:02:04 +02:00
parent 8cc82917c9
commit 2a0f322c22

View file

@ -428,7 +428,7 @@ var Point = this.Point = Base.extend(/** @lends Point# */{
// squared length should be returned. Hide it so it produces a bean
// property called #length.
var l = this.x * this.x + this.y * this.y;
return arguments[0] ? l : Math.sqrt(l);
return (arguments.length && arguments[0]) ? l : Math.sqrt(l);
},
setLength: function(length) {