__construct__

Constructs new instance with a variable number of arguments

@param  {Function}  Constructor
@param  {Array} Arguments
@return {Instance} Instance
193438
function construct(ctor, args) {
  function F() {
    return ctor.apply(this, args);
  }
  F.prototype = ctor.prototype;
  return new F();
}
738110
public static Constructor findConstructor(Class<?> type, Object[] args) {
        outer:
        for (Constructor constructor : type.getConstructors()) {
            Class<?>[] paramTypes = constructor.getParameterTypes();
            if (paramTypes.length != args.length) continue;
            for (int i = 0; i < args.length; i++) {
                Object arg = args[i];
                if (arg != null && !paramTypes[i].isAssignableFrom(arg.getClass()) && !isBoxedType(paramTypes[i], arg.getClass())) continue outer;
                if (arg == null && paramTypes[i].isPrimitive()) continue outer;
            }
            return constructor;
        }
        throw new GrammarException("No constructor found for %s and the given %s arguments", type, args.length);
    }
328145
protected Object newInstance(Constructor constructor, Object[] parameters) throws InstantiationException, IllegalAccessException,
			InvocationTargetException {
		if (allowNonPublicClasses) {
			constructor.setAccessible(true);
		}

		Object o = constructor.newInstance(parameters);
		ComponentAdvsior componentAdvsior = (ComponentAdvsior) configInfo.getContainerWrapper().lookup(ComponentAdvsior.NAME);
		Object proxy = null;
		if (componentAdvsior != null)
			proxy = componentAdvsior.createProxy(o);

		if (!proxy.getClass().isInstance(o)) {
			Map orignals = getContainerOrignals(configInfo.getContainerWrapper());
			orignals.put((String) this.getComponentKey(), o);
		}

		return proxy;
	}
124024
def _generate_constructor(cls, names):
        """"""

        cache = cls._constructors
        if names in cache:
            return cache[names]
        elif len(cache) > 3:
            cache.clear()

        func = generate_constructor(cls, names)
        cache[names] = func
        return func
393361
function construct(constructor, args) {
            var dynamicClass = function () {
                return new (constructor.bind.apply(constructor, [void 0].concat(args)))();
            };
            dynamicClass.prototype = constructor.prototype;
            return new dynamicClass();
        }
568616
function extend(target,       // @arg Object - global
                constructors, // @arg ConstructorObject - { "Object": { keys: Object_keys, ... }, ... }
                override) {   // @arg Boolean = false
//{@dev
    if (!global["BENCHMARK"]) {
        $valid($type(constructors, "Object"),       extend, "constructors");
        $valid($type(override,     "Boolean|omit"), extend, "override");
    }
//}@dev

    override = override || false;

    for (var klass in constructors) { // Object, Array, String, Function, ...
        if ( !(klass in target) ) {
            target[klass] = constructors[klass];
        }
        _extend(target[klass], constructors[klass]);
    }

    function _extend(extendTarget, object) {
        for (var key in object) { // "keys", "prototype", ...
            if (key === "prototype") {
                // --- extend Object.property ---
                if (!(key in extendTarget)) { // extendTarget has prototype?
                    extendTarget[key] = {};   // extendTarget["prototype"] = {}
                }
                for (var prop in object[key]) {
                    _defineProperty(extendTarget[key], prop, object[key][prop]);
                }
            } else {
                _defineProperty(extendTarget, key, object[key]);
            }
        }
    }

    function _defineProperty(obj, key, value) {
        if ( override || !(key in obj) ) {
            Object.defineProperty(obj, key, {
                "configurable": true, // false is immutable
                "enumerable": false,  // false is invisible(for in loop)
                "writable": true,     // false is read-only
                "value": value
            });
        }
    }
}
661178
public static NativeSymbol construct(Context cx, Scriptable scope, Object[] args)
    {
        cx.putThreadLocal(CONSTRUCTOR_SLOT, Boolean.TRUE);
        try {
            return (NativeSymbol)cx.newObject(scope, CLASS_NAME, args);
        } finally {
            cx.removeThreadLocal(CONSTRUCTOR_SLOT);
        }
    }
1153834
function(constructorFn, args) {

		    var newConstructorFn = function () {
			    constructorFn.apply(this, args);
		    };
		    newConstructorFn.prototype = constructorFn.prototype;
		    return new newConstructorFn();
	    }
1131927
function copy(args) {
  // TODO: Split arguments with destructure in the future
  const source = splitArg(args.source);
  const sourceApp = source[0];
  const sourcePath = source[1];
  const dest = splitArg(args.dest);
  const destApp = dest[0];
  const destPath = dest[1];

  return login(sourceApp, destApp).then((dbs) => {
    const sourceDB = dbs[0];
    const destDB = dbs[1];

    return normalizeArgs(sourceDB, sourcePath, destDB, destPath).then((paths) => {
      const sourcePath = paths[0];
      const destPath = paths[1];

      return streamFrom(sourceDB, sourcePath).then((args) => {
        const rs = args[0];
        const size = args[1];

        return streamTo(destDB, destPath, rs, size);
      });
    });
  });
}
836130
function ( obj, args ) {
		var result = [];

		// Preparing args
		if ( !(args instanceof Array) ) {
			args = typeof args === "object" ? array.cast( args ) : [args];
		}

		array.each( args, function ( i, idx ) {
			if ( !( i instanceof Array ) ) {
				this[idx] = [i];
			}
		});

		// Building result Array
		array.each( obj, function ( i, idx ) {
			result[idx] = [i];
			array.each( args, function ( x ) {
				result[idx].push( x[idx] || null );
			});
		});

		return result;
	}
1181372
public static <E> OptionalFunction<Selection<Constructor<?>>, E> instantiate(Object... args) {
    return OptionalFunction.of(selection -> factory.createInvoker(selection.result()).withArgs(args));
  }
1225472
function Constructor() {
                        // All construction is actually done in the init method.
                        if (!initializing) {


                            return this.constructor !== Constructor &&
                            // We are being called without `new` or we are extending.
                            arguments.length && Constructor.constructorExtends ? Constructor.extend.apply(Constructor, arguments) :
                            // We are being called with `new`.
                            Constructor.newInstance.apply(Constructor, arguments);
                        }
                    }
1030507
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;
    }
845941
private static Object[] expandVarArgs(final boolean isVarArgs, final Object[] args) {
        if (!isVarArgs || isNullOrEmpty(args) || args[args.length - 1] != null && !args[args.length - 1].getClass().isArray()) {
            return args == null ? new Object[0] : args;
        }

        final int nonVarArgsCount = args.length - 1;
        Object[] varArgs;
        if (args[nonVarArgsCount] == null) {
            // in case someone deliberately passed null varArg array
            varArgs = new Object[] { null };
        } else {
            varArgs = ArrayEquals.createObjectArray(args[nonVarArgsCount]);
        }
        final int varArgsCount = varArgs.length;
        Object[] newArgs = new Object[nonVarArgsCount + varArgsCount];
        System.arraycopy(args, 0, newArgs, 0, nonVarArgsCount);
        System.arraycopy(varArgs, 0, newArgs, nonVarArgsCount, varArgsCount);
        return newArgs;
    }
515675
public static <T> T invoke( Constructor<T> constructor, Object... args ) throws Throwable
    {
        try
        {
            return constructor.newInstance( args );
        }
        catch (InstantiationException e)
        {
            throw e.getCause();
        }
    }
687993
function constructor(options) {
    Pagelet.prototype.constructor.call(this, options = options || {});

    //
    // Store the provided global dependencies.
    //
    this.dependencies = this._bigpipe._compiler.page(this).concat(
      options.dependencies
    );

    var req = options.req || {}
      , uri = req.uri || {}
      , query = req.query || {};

    //
    // Set a number of properties on the response as it is available to all pagelets.
    // This will ensure the correct amount of pagelets are processed and that the
    // entire queue is written to the client.
    //
    this._queue = [];

    //
    // Prepare several properties that are used to render the HTML fragment.
    //
    this.length = options.length || 0;
    this.child = options.child || 'root';
    this.once('contentType', this.contentTypeHeader, this);

    //
    // Set the default fallback script, see explanation above.
    //
    this.debug('Initialized in %s mode', options.mode);
    this.fallback = 'sync' === options.mode ? script : noscript.replace(
      '{path}',
      uri.pathname || 'http://localhost/'
    ).replace(
      '{query}',
      qs.stringify(this.merge({ no_pagelet_js: 1 }, query))
    );
  }
605138
public static <T> Constructor<T>[] candidateConstructors(Constructor<T>[] constructors, Object[] args) {
        return candidateConstructors(constructors, collectArgTypes(args));
    }