Examples of toMaybeFunctionType()


Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

      }

      if (restrictedParameter != null
          && iArgument.isFunction()
          && iArgumentType.isFunctionType()) {
        FunctionType argFnType = iArgumentType.toMaybeFunctionType();
        boolean declared = iArgument.getJSDocInfo() != null;
        iArgument.setJSType(
            matchFunction(restrictedParameter, argFnType, declared));
      }
      i++;
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

        String property2 = NodeUtil.getStringValue(object.getLastChild());

        if ("prototype".equals(property2)) {
          JSType jsType = getJSType(object2);
          if (jsType.isFunctionType()) {
            FunctionType functionType = jsType.toMaybeFunctionType();
            if (functionType.isConstructor() || functionType.isInterface()) {
              checkDeclaredPropertyInheritance(
                  t, assign, functionType, property, info, getJSType(rvalue));
            }
          } else {
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

   */
  private void visitNew(NodeTraversal t, Node n) {
    Node constructor = n.getFirstChild();
    JSType type = getJSType(constructor).restrictByNotNullOrUndefined();
    if (type.isConstructor() || type.isEmptyType() || type.isUnknownType()) {
      FunctionType fnType = type.toMaybeFunctionType();
      if (fnType != null) {
        visitParameterList(t, n, fnType);
        ensureTyped(t, n, fnType.getInstanceType());
      } else {
        ensureTyped(t, n);
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

    }

    // A couple of types can be called as if they were functions.
    // If it is a function type, then validate parameters.
    if (childType.isFunctionType()) {
      FunctionType functionType = childType.toMaybeFunctionType();

      boolean isExtern = false;
      JSDocInfo functionJSDocInfo = functionType.getJSDocInfo();
      if(functionJSDocInfo != null) {
        isExtern = functionJSDocInfo.getAssociatedNode().isFromExterns();
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

      return;
    }
    JSType jsType = getJSType(function);

    if (jsType.isFunctionType()) {
      FunctionType functionType = jsType.toMaybeFunctionType();

      JSType returnType = functionType.getReturnType();

      // if no return type is specified, undefined must be returned
      // (it's a void function)
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

      if (jsType.isPropertyInExterns(prop) && propType.isFunctionType()) {
        ObjectType thisType = jsType;
        if (jsType.isFunctionPrototypeType()) {
          thisType = thisType.getOwnerFunction().getInstanceType();
        }
        FunctionType callType = propType.toMaybeFunctionType();
        Action action = createExternFunctionCall(
            fnNode, thisType, callType);
        return Lists.<Action>newArrayList(action);
      }
      return Lists.<Action>newArrayList();
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

    if (type == null || type.isUnknownType()) {
      return "";
    }

    FunctionType funType = type.toMaybeFunctionType();

    // We need to use the child nodes of the function as the nodes for the
    // parameters of the function type do not have the real parameter names.
    // FUNCTION
    //   NAME
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

        // We have an assignment of the form "a.b = ...".
        JSType lValueType = lValue.getJSType();
        if (lValueType != null && lValueType.isNominalConstructor()) {
          // If a.b is a constructor, then everything in this function
          // belongs to the "a.b" type.
          return (lValueType.toMaybeFunctionType()).getInstanceType();
        } else {
          // If a.b is not a constructor, then treat this as a method
          // of whatever type is on "a".
          return normalizeClassType(lValue.getFirstChild().getJSType());
        }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

    // global scope, if that function has a @this type that we can
    // build properties on.
    for (Node functionNode : scopeBuilder.nonExternFunctions) {
      JSType type = functionNode.getJSType();
      if (type != null && type.isFunctionType()) {
        FunctionType fnType = type.toMaybeFunctionType();
        ObjectType fnThisType = fnType.getTypeOfThis();
        if (!fnThisType.isUnknownType()) {
          NodeTraversal.traverse(compiler, functionNode.getLastChild(),
              scopeBuilder.new CollectProperties(fnThisType));
        }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

          JSType type = info.getType().evaluate(scope, typeRegistry);

          // Known to be not null since we have the FUNCTION token there.
          type = type.restrictByNotNullOrUndefined();
          if (type.isFunctionType()) {
            functionType = type.toMaybeFunctionType();
            functionType.setJSDocInfo(info);
          }
        }

        if (functionType == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.