function _generateBindBuilderSource (length) {
return "var me = this;\n"
+ "return function (" + _gpfBuildFunctionParameterList(length).join(", ") + ") {\n"
+ " var args = _gpfArraySlice(arguments);\n"
+ " return me.apply(thisArg, prependArgs.concat(args));\n"
function _generateSimpleBindBuilderSource (length) {
return "var me = this;\n"
+ "return function (" + _gpfBuildFunctionParameterList(length).join(", ") + ") {\n"
+ " return me.apply(thisArg, arguments);\n"
var _GPF_COMPATIBILITY_FUNCTION_MIN_LENGTH = 0;
_gpfCompatibilityInstallMethods("Function", {
bind: function (thisArg) {
prependArgs = _gpfArrayTail(arguments),
length = Math.max(this.length - prependArgs.length, _GPF_COMPATIBILITY_FUNCTION_MIN_LENGTH),
if (prependArgs.length) {
builderSource = _generateBindBuilderSource(length);
return _gpfFunc(["thisArg", "prependArgs", "_gpfArraySlice"], builderSource)
.call(me, thisArg, prependArgs, _gpfArraySlice);
builderSource = _generateSimpleBindBuilderSource(length);
return _gpfFunc(["thisArg"], builderSource)