Examples of toObjectType()


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

      JSType type = rootNode.getJSType();
      if (type == null || !type.isFunctionType()) return null;

      FunctionType fnType = type.toMaybeFunctionType();
      JSType fnThisType = fnType.getTypeOfThis();
      return fnThisType.isUnknownType() ? null : fnThisType.toObjectType();
    }

    private void maybeCollectMember(Node member,
        Node nodeWithJsDocInfo, @Nullable Node value) {
      JSDocInfo info = nodeWithJsDocInfo.getJSDocInfo();
View Full Code Here

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

    if (existingType != null) {
      boolean isInstanceObject = existingType.isInstanceType();
      if (isInstanceObject || fnName.equals("Function")) {
        FunctionType existingFn =
            isInstanceObject ?
            existingType.toObjectType().getConstructor() :
            typeRegistry.getNativeFunctionType(FUNCTION_FUNCTION_TYPE);

        if (existingFn.getSource() == null) {
          existingFn.setSource(contents.getSourceNode());
        }
View Full Code Here

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

      Set<JSType> types = Sets.newHashSet();
      JSType skipType = type;
      while (skipType != null) {
        types.add(skipType);

        ObjectType objSkipType = skipType.toObjectType();
        if (objSkipType != null) {
          skipType = objSkipType.getImplicitPrototype();
        } else {
          break;
        }
View Full Code Here

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

      // Do not type-check interface methods, because we expect that
      // they will have dummy implementations that do not match the type
      // annotations.
      JSType ownerType = getJSType(owner);
      if (ownerType.isFunctionPrototypeType()) {
        FunctionType ownerFn = ownerType.toObjectType().getOwnerFunction();
        if (ownerFn.isInterface() &&
            rightType.isFunctionType() && leftType.isFunctionType()) {
          return true;
        }
      }
View Full Code Here

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

      }
    }

    // The best type name is the actual type name.
    if (type.isFunctionPrototypeType() ||
        (type.toObjectType() != null &&
         type.toObjectType().getConstructor() != null)) {
      return type.toString();
    }

    // If we're analyzing a GETPROP, the property may be inherited by the
View Full Code Here

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

    }

    // The best type name is the actual type name.
    if (type.isFunctionPrototypeType() ||
        (type.toObjectType() != null &&
         type.toObjectType().getConstructor() != null)) {
      return type.toString();
    }

    // If we're analyzing a GETPROP, the property may be inherited by the
    // prototype chain. So climb the prototype chain and find out where
View Full Code Here

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

    JSType firstParam = evalInternal(params.get(0), nameResolver);
    if (!isTemplatizable(firstParam)) {
      reportWarning(ttlAst, BASETYPE_INVALID, firstParam.toString());
      return getUnknownType();
    }
    ObjectType baseType = firstParam.toObjectType();
    // TODO(lpino): Check that the number of parameters correspond with the
    // number of template types that the base type can take when creating
    // a templatized type. For instance, if the base type is Array then there
    // must be just one parameter.
    JSType[] templatizedTypes = new JSType[params.size() - 1];
View Full Code Here

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

    ImmutableList.Builder<RecordType> recTypesBuilder =
        new ImmutableList.Builder<RecordType>();
    for (int i = 0; i < paramCount; i++) {
      JSType type = evalRecordParam(getCallArgument(ttlAst, i), nameResolver);
      // Check that each parameter evaluates to an object
      ObjectType objType = type.toObjectType();
      if (objType == null || objType.isUnknownType()) {
        reportWarning(ttlAst, RECPARAM_INVALID, type.toString());
        return getUnknownType();
      }
      JSType recType = buildRecordTypeFromObject(objType);
View Full Code Here

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

    return type;
  }

  private JSType evalPropType(Node ttlAst, NameResolver nameResolver) {
    JSType type = evalInternal(getCallArgument(ttlAst, 1), nameResolver);
    ObjectType objType = type.toObjectType();
    if (objType == null) {
      reportWarning(ttlAst, PROPTYPE_INVALID, type.toString());
      return getUnknownType();
    }
    return objType.getPropertyType(getCallArgument(ttlAst, 0).getString());
View Full Code Here

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

    public void visit(NodeTraversal t, Node n, Node p) {
      // We are a root GetProp
      if (n.isGetProp() && !p.isGetProp()) {
        String propName = getFieldName(n);
        JSType type = n.getFirstChild().getJSType();
        if (type == null || type.toObjectType() == null) {
          // Note cases like <primitive>.field
          return;
        }
        removeProperty(type.toObjectType(), propName);
      }
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.