dist/node/loose/Class.js
function optimizeConstructor(constructor) {
        var tmp = constructor[$class],
            canOptimizeConst,
            newConstructor,
            parentInitialize;

        // Check if we can optimize the constructor
        if (tmp.efficient) {
            canOptimizeConst = constructor.$canOptimizeConst;
            delete constructor.$canOptimizeConst;

            if (canOptimizeConst && !tmp.properties.length && !tmp.binds.length) {
                if (hasOwn(constructor.prototype, 'initialize'))  {
                    newConstructor = constructor.prototype.initialize;
                } else {
                    parentInitialize = constructor.prototype.initialize;

                    // Optimize common use cases
                    // Default to the slower apply..
                    switch (parentInitialize.length) {
                    case 0:
                        newConstructor = function () { parentInitialize.call(this); };
                        break;
                    case 1:
                        newConstructor = function (a) { parentInitialize.call(this, a); };
                        break;
                    case 2:
                        newConstructor = function (a, b) { parentInitialize.call(this, a, b); };
                        break;
                    case 3:
                        newConstructor = function (a, b, c) { parentInitialize.call(this, a, b, c); };
                        break;
                    case 4:
                        newConstructor = function (a, b, c, d) { parentInitialize.call(this, a, b, c, d); };
                        break;
                    default:
                        newConstructor = function () { parentInitialize.apply(this, arguments); };
                    }
                }

                if (constructor.$parent) {
                    inheritPrototype(newConstructor, constructor);
                    newConstructor.$parent = constructor.$parent;
                }

                mixIn(newConstructor.prototype, constructor.prototype);
                mixIn(newConstructor, constructor);
                obfuscateProperty(newConstructor, $class, constructor[$class]);

                return newConstructor;
            }
        }

        return constructor;
    }
function optimizeConstructor(constructor) {
        var tmp = constructor[$class],
            canOptimizeConst,
            newConstructor,
            parentInitialize;

        // Check if we can optimize the constructor
        if (tmp.efficient) {
            canOptimizeConst = constructor.$canOptimizeConst;
            delete constructor.$canOptimizeConst;

            if (canOptimizeConst && !tmp.properties.length && !tmp.binds.length) {
                if (hasOwn(constructor.prototype, 'initialize'))  {
                    newConstructor = constructor.prototype.initialize;
                } else {
                    parentInitialize = constructor.prototype.initialize;

                    // Optimize common use cases
                    // Default to the slower apply..
                    switch (parentInitialize.length) {
                    case 0:
                        newConstructor = function () { parentInitialize.call(this); };
                        break;
                    case 1:
                        newConstructor = function (a) { parentInitialize.call(this, a); };
                        break;
                    case 2:
                        newConstructor = function (a, b) { parentInitialize.call(this, a, b); };
                        break;
                    case 3:
                        newConstructor = function (a, b, c) { parentInitialize.call(this, a, b, c); };
                        break;
                    case 4:
                        newConstructor = function (a, b, c, d) { parentInitialize.call(this, a, b, c, d); };
                        break;
                    default:
                        newConstructor = function () { parentInitialize.apply(this, arguments); };
                    }
                }

                if (constructor.$parent) {
                    inheritPrototype(newConstructor, constructor);
                    newConstructor.$parent = constructor.$parent;
                }

                mixIn(newConstructor.prototype, constructor.prototype);
                mixIn(newConstructor, constructor);
                obfuscateProperty(newConstructor, $class, constructor[$class]);

                return newConstructor;
            }
        }

        return constructor;
    }
function optimizeConstructor ( constructor ) { var tmp = constructor [ $class ] , canOptimizeConst , newConstructor , parentInitialize ; // Check if we can optimize the constructor if ( tmp . efficient ) { canOptimizeConst = constructor . $canOptimizeConst ; delete constructor . $canOptimizeConst ; if ( canOptimizeConst && ! tmp . properties . length && ! tmp . binds . length ) { if ( hasOwn ( constructor . prototype , 'initialize' ) ) { newConstructor = constructor . prototype . initialize ; } else { parentInitialize = constructor . prototype . initialize ; // Optimize common use cases // Default to the slower apply.. switch ( parentInitialize . length ) { case 0 : newConstructor = function ( ) { parentInitialize . call ( this ) ; } ; break ; case 1 : newConstructor = function ( a ) { parentInitialize . call ( this , a ) ; } ; break ; case 2 : newConstructor = function ( a , b ) { parentInitialize . call ( this , a , b ) ; } ; break ; case 3 : newConstructor = function ( a , b , c ) { parentInitialize . call ( this , a , b , c ) ; } ; break ; case 4 : newConstructor = function ( a , b , c , d ) { parentInitialize . call ( this , a , b , c , d ) ; } ; break ; default : newConstructor = function ( ) { parentInitialize . apply ( this , arguments ) ; } ; } } if ( constructor . $parent ) { inheritPrototype ( newConstructor , constructor ) ; newConstructor . $parent = constructor . $parent ; } mixIn ( newConstructor . prototype , constructor . prototype ) ; mixIn ( newConstructor , constructor ) ; obfuscateProperty ( newConstructor , $class , constructor [ $class ] ) ; return newConstructor ; } } return constructor ; }
Attempts to optimize the constructor function.

@param {Function} constructor The constructor

@param {Function} The old or the new constructor
Attempts to optimize the constructor function .