Examples of toMaybeFunctionType()


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

        ObjectType ownerType, String propName) {
      // First, check to see if the property is implemented
      // on a superclass.
      JSType propType = ownerType.getPropertyType(propName);
      if (propType != null && propType.isFunctionType()) {
        return propType.toMaybeFunctionType();
      } else {
        // If it's not, then check to see if it's implemented
        // on an implemented interface.
        for (ObjectType iface :
                 ownerType.getCtorImplementedInterfaces()) {
View Full Code Here

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

        // on an implemented interface.
        for (ObjectType iface :
                 ownerType.getCtorImplementedInterfaces()) {
          propType = iface.getPropertyType(propName);
          if (propType != null && propType.isFunctionType()) {
            return propType.toMaybeFunctionType();
          }
        }
      }

      return null;
View Full Code Here

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

    }
    JSType rightType = right.getJSType();
    ObjectType targetType =
        typeRegistry.getNativeObjectType(JSTypeNative.UNKNOWN_TYPE);
    if (rightType != null && rightType.isFunctionType()) {
      targetType = rightType.toMaybeFunctionType();
    }
    Visitor<JSType> visitor;
    if (outcome) {
      visitor = new RestrictByTrueInstanceOfResultVisitor(targetType);
    } else {
View Full Code Here

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

      JSType type = scope.getTypeOfThis();
      if (type != null) {
        if (type.isGlobalThisType()) {
          return globalScope.getSlot(GLOBAL_THIS);
        } else if (type.isNominalConstructor()) {
          return getSymbolDeclaredBy(type.toMaybeFunctionType());
        } else if (type.isFunctionPrototypeType()) {
          return getSymbolForInstancesOf(
              ((ObjectType) type).getOwnerFunction());
        }
      }
View Full Code Here

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

          if (sym != null) {
            sym.defineReferenceAt(n);
          }
        } else if (owner.isNominalConstructor()) {
          maybeDefineReference(
              n, getSymbolDeclaredBy(owner.toMaybeFunctionType()));
        } else {
          for (Symbol ctor : getAllSymbolsForType(owner)) {
            maybeDefineReference(n, getSymbolForInstancesOf(ctor));
          }
        }
View Full Code Here

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

      FunctionType classType = null;
      String className = null;

      if (constructor != null && constructor.isConstructor()) {
        // Case where the class has been properly declared with @constructor
        classType = constructor.toMaybeFunctionType();
        className = classType.getReferenceName();
      } else {
        // We'll guess it is a constructor even if it didn't have @constructor
        classType = compiler.getTypeRegistry().getNativeFunctionType(
            JSTypeNative.U2U_CONSTRUCTOR_TYPE);
View Full Code Here

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

    Node left = n.getFirstChild();
    JSType functionType = getJSType(left).restrictByNotNullOrUndefined();
    if (functionType != null) {
      if (functionType.isFunctionType()) {
        FunctionType fnType = functionType.toMaybeFunctionType();
        n.setJSType(fnType.getReturnType());
        updateTypeOfParameters(n, fnType);
        updateTypeOfThisOnClosure(n, fnType);
      } else if (functionType.equals(getNativeType(CHECKED_UNKNOWN_TYPE))) {
        n.setJSType(getNativeType(CHECKED_UNKNOWN_TYPE));
View Full Code Here

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

        int j = 0;
        for (Node jParameter : fnType.getParameters()) {
          JSType jParameterType =
              getJSType(jParameter).restrictByNotNullOrUndefined();
          if (jParameterType.isFunctionType()) {
            FunctionType jParameterFnType = jParameterType.toMaybeFunctionType();
            if (jParameterFnType.getTypeOfThis().equals(iParameterType)) {
              foundTemplateTypeOfThisParameter = true;
              // Find the actual type of the this argument.
              if (j + 1 >= childCount) {
                // TypeCheck#visitParameterList will warn so we bail.
View Full Code Here

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

                if (iArgumentType != null &&
                    // null and undefined get filtered out above.
                    !iArgumentType.isNoType()) {
                  // If it's an function expression, update the type of this
                  // using the actual type of T.
                  FunctionType jArgumentFnType = jArgumentType.toMaybeFunctionType();
                  if (jArgumentFnType.getTypeOfThis().isUnknownType()) {
                    // The new type will be picked up when we traverse the inner
                    // function.
                    jArgument.setJSType(
                        registry.createFunctionTypeWithNewThisType(
View Full Code Here

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

    this.parent = parent;
    this.rootNode = rootNode;
    JSType nodeType = rootNode.getJSType();
    if (nodeType != null && nodeType.isFunctionType()) {
      thisType = nodeType.toMaybeFunctionType().getTypeOfThis();
    } else {
      thisType = parent.thisType;
    }
    this.isBottom = false;
    this.depth = parent.depth + 1;
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.