Allocate a named class constructor for a class definition

@param {_GpfOldClassDefinition} classDef Class definition
@param {Function} innerConstructor Constructor as defined by the class
@return {Function} Constructor
 Build a new constructor
550592
function _getNewClassConstructor (classDef, innerConstructor) {
    var builder = new _GpfFunctionBuilder(_gpfNewClassConstructorTpl);
    builder.replaceInBody({
        "function": "function " + classDef.getName()
    });
    return builder.generate()(innerConstructor);
}
709843
function () {
        var
            newClass,
            newPrototype,
            baseClassDef;

        // The new class constructor
        newClass = _getOldNewClassConstructor(this);
        this._Constructor = newClass;
        newClass[_GPF_CLASSDEF_MARKER] = this._uid;

        // Basic JavaScript inheritance mechanism: Defines the newClass prototype as an instance of the super class
        newPrototype = Object.create(this._Super.prototype);

        // Populate our constructed prototype object
        newClass.prototype = newPrototype;

        // Enforce the constructor to be what we expect
        newPrototype.constructor = newClass;

        /*
         * Defines the link between this class and its base one
         * (It is necessary to do it here because of the gpf.addAttributes that will test the parent class)
         */
        baseClassDef = _gpfGetClassDefinition(this._Super);
        baseClassDef._Subs.push(newClass);

        /*
         * 2014-04-28 ABZ Changed again from two passes on all members to two passes in which the first one also
         * collects attributes to simplify the second pass.
         */
        this._processDefinition(this._definition, _GPF_VISIBILITY_UNKNOWN);
        this._processAttributes();

        // Optimization for the constructor
        this._resolveConstructor();
    }
258899
public ImmutableList<Constructor> getConstructors(Class classDefinition) {
        if (definedClasses.getRootValue().containsKey(classDefinition)) {
            return definedClasses.getRootValue().get(classDefinition);
        }
        return new ImmutableArrayList<>();
    }
581424
function constructor(options, error, name) {
    Pagelet.prototype.constructor.call(this, options);

    if (name) this.name = name;
    this.data = error instanceof Error ? error : {};
  }
709221
function Class() {
			if (this.constructor !== root.Class) {
				throw new Error("You can only instanciate objects with the 'new' operator");
				return null;
			};
			// All construction is actually done in the init method
			if (!initializing && this.init) {
				var ret = this.init.apply(this, arguments);
				if (ret) {
					return ret;
				};
			};
			// add self object to each function, ekitjs
			_.each(this.__keys, function(value, key) {
				if (_.isFunction(this[key])) {
					this[key].self = this;
				};
			}, undefined, this);
			// add Class
			this.__Class = Class;
			// 
			return this;
		}
1173390
public ClassFile addInnerClass(String innerClassName,
                                   String superClassName) {
        String fullInnerClassName;
        if (innerClassName == null) {
            fullInnerClassName =
                mClassName + '$' + (++mAnonymousInnerClassCount);
        }
        else {
            fullInnerClassName = mClassName + '$' + innerClassName;
        }

        ClassFile inner = new ClassFile(fullInnerClassName, superClassName);
        Modifiers access = inner.getModifiers();
        access.setPrivate(true);
        access.setStatic(true);
        inner.mInnerClassName = innerClassName;
        inner.mOuterClass = this;

        if (mInnerClasses == null) {
            mInnerClasses = new ArrayList<ClassFile>();
        }

        mInnerClasses.add(inner);

        // Record the inner class in this, the outer class.
        if (mInnerClassesAttr == null) {
            addAttribute(new InnerClassesAttr(mCp));
        }

        mInnerClassesAttr.addInnerClass(fullInnerClassName, mClassName,
                                        innerClassName, access);

        // Record the inner class in itself.
        inner.addAttribute(new InnerClassesAttr(inner.getConstantPool()));
        inner.mInnerClassesAttr.addInnerClass(fullInnerClassName, mClassName,
                                              innerClassName, access);

        return inner;
    }
492234
function attachNeighborIteratorCreator(Class, description) {
  const {
    name,
    type,
    direction
  } = description;

  const iteratorName = name.slice(0, -1) + 'Entries';

  /**
   * Function returning an iterator over all the relevant neighbors.
   *
   * @param  {any}      node     - Target node.
   * @return {Iterator}
   *
   * @throws {Error} - Will throw if there are too many arguments.
   */
  Class.prototype[iteratorName] = function(node) {

    // Early termination
    if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)
      return Iterator.empty();

    node = '' + node;

    const nodeData = this._nodes.get(node);

    if (typeof nodeData === 'undefined')
      throw new NotFoundGraphError(`Graph.${iteratorName}: could not find the "${node}" node in the graph.`);

    // Here, we want to iterate over a node's relevant neighbors
    return createNeighborIterator(
      type === 'mixed' ? this.type : type,
      direction,
      nodeData
    );
  };
}
244697
function createWithInternals({ acceptElse = false, condition, initialData }) {
    const classNameBuilder = Object.create(classNameBuilderProto);
    classNameBuilder._acceptElse = acceptElse;
    classNameBuilder._data = initialData;
    classNameBuilder._condition = condition;
    return classNameBuilder;
}
323343
function createClass() {
    var parent = null,
        properties = slice.call(arguments, 0);

    if (typeof properties[0] === 'function') {
      parent = properties.shift();
    }
    function klass() {
      this.initialize.apply(this, arguments);
    }

    klass.superclass = parent;
    klass.subclasses = [ ];

    if (parent) {
      subclass.prototype = parent.prototype;
      klass.prototype = new subclass;
      parent.subclasses.push(klass);
    }
    for (var i = 0, length = properties.length; i < length; i++) {
      addMethods(klass, properties[i], parent);
    }
    if (!klass.prototype.initialize) {
      klass.prototype.initialize = emptyFunction;
    }
    klass.prototype.constructor = klass;
    return klass;
  }
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
1171197
function addClass(className) {
  if (typeof className === 'undefined') {
    return this;
  }
  const classes = className.split(' ');
  for (let i = 0; i < classes.length; i += 1) {
    for (let j = 0; j < this.length; j += 1) {
      if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') this[j].classList.add(classes[i]);
    }
  }
  return this;
}
758626
function isClassConstructor(node) {
    return node.type === "FunctionExpression" &&
        node.parent &&
        node.parent.type === "MethodDefinition" &&
        node.parent.kind === "constructor";
}
1064827
private static Constructor<?> findConstructorForInnerClass(final Class<?> klazz, final Class<?> declaringClass) {
    final Constructor<?>[] constructors = klazz.getDeclaredConstructors();
    if (constructors.length == 1) {
      return constructors[0];
    }
    for (final Constructor<?> c : constructors) {
      final Class<?>[] params = c.getParameterTypes();
      if (params.length == 1 && params[0] == declaringClass) {
        return c;
      }
    }
    return constructors[0];
  }
1322213
public static boolean isNamespaceDecl(Node n) {
    JSDocInfo jsdoc = getBestJSDocInfo(n);
    if (jsdoc != null && !jsdoc.getTypeNodes().isEmpty()) {
      return false;
    }
    // In externs, we allow namespace definitions without @const.
    // This is a worse design than always requiring @const, but it helps with
    // namespaces that are defined in many places, such as gapi.
    // Also, omitting @const in externs is not as confusing as in source code,
    // because assigning an object literal in externs only makes sense when
    // defining a namespace or enum.
    boolean isMarkedConst = n.getParent().isConst() || (jsdoc != null && jsdoc.isConstant());
    if (!n.isFromExterns() && !isMarkedConst) {
      return false;
    }
    Node qnameNode;
    Node initializer;
    if (NodeUtil.isNameDeclaration(n.getParent())) {
      qnameNode = n;
      initializer = n.getFirstChild();
    } else if (n.isExprResult()) {
      Node expr = n.getFirstChild();
      if (!expr.isAssign() || !expr.getFirstChild().isGetProp()) {
        return false;
      }
      qnameNode = expr.getFirstChild();
      initializer = expr.getLastChild();
    } else if (n.isGetProp()) {
      Node parent = n.getParent();
      if (!parent.isAssign() || !parent.getParent().isExprResult()) {
        return false;
      }
      qnameNode = n;
      initializer = parent.getLastChild();
    } else {
      return false;
    }
    if (initializer == null || qnameNode == null) {
      return false;
    }
    if (initializer.isObjectLit()) {
      return true;
    }
    return initializer.isOr()
        && qnameNode.matchesQualifiedName(initializer.getFirstChild())
        && initializer.getLastChild().isObjectLit();
  }
107926
private FunctionDeclaration makeAllocatingConstructor(
      MethodDeclaration method, boolean releasing) {
    assert method.isConstructor();
    ExecutableElement element = method.getExecutableElement();
    TypeElement declaringClass = ElementUtil.getDeclaringClass(element);

    String name = releasing ? nameTable.getReleasingConstructorName(element)
        : nameTable.getAllocatingConstructorName(element);
    FunctionDeclaration function = new FunctionDeclaration(name, declaringClass.asType());
    function.setLineNumber(method.getLineNumber());
    function.setModifiers(ElementUtil.isPrivate(element) ? Modifier.PRIVATE : Modifier.PUBLIC);
    function.setReturnsRetained(!releasing);
    TreeUtil.copyList(method.getParameters(), function.getParameters());
    Block body = new Block();
    function.setBody(body);

    StringBuilder sb = new StringBuilder(releasing ? "J2OBJC_CREATE_IMPL(" : "J2OBJC_NEW_IMPL(");
    sb.append(nameTable.getFullName(declaringClass));
    sb.append(", ").append(nameTable.getFunctionName(element));
    for (SingleVariableDeclaration param : function.getParameters()) {
      sb.append(", ").append(nameTable.getVariableQualifiedName(param.getVariableElement()));
    }
    sb.append(")");
    body.addStatement(new NativeStatement(sb.toString()));

    return function;
  }
150447
function defineOptionConstructor(constructor, code, name, repeatable, ...args) {
    optionConstructors[code] = optionConstructors[name] =
        constructor.create.bind(constructor, ...[code, name, repeatable, ...args]);
}
1033927
function subclass (BaseClass, classes, namespace = {}) {

    for (const [$class, subclasses] of Object.entries (classes)) {

        const Class = Object.assign (namespace, {

        /*  By creating a named property, we trick compiler to assign our class constructor function a name.
            Otherwise, all our error constructors would be shown as [Function: Error] in the debugger! And
            the super-useful `e.constructor.name` magic wouldn't work — we then would have no chance to
            obtain a error type string from an error instance programmatically!                               */

            [$class]: class extends BaseClass {

                constructor (message) {

                    super (message)

                /*  A workaround to make `instanceof` work on custom Error classes in transpiled ES5.
                    See my blog post for the explanation of this hack:

                    https://medium.com/@xpl/javascript-deriving-from-error-properly-8d2f8f315801        */

                    this.constructor = Class
                    this.__proto__   = Class.prototype
                    this.message     = message
                }
            }

        })[$class]

        subclass (Class, subclasses, namespace)
    }

    return namespace
}