Examples of JSType


Examples of com.google.javascript.rhino.jstype.JSType

    verify("out1", startType);
    verify("out2", UNKNOWN_TYPE);
  }

  public void testAssertInstanceof3a() {
    JSType startType = registry.getNativeType(UNKNOWN_TYPE);
    assuming("x", startType);
    inFunction("out1 = x; goog.asserts.assertInstanceof(x, String); out2 = x;");
    verify("out1", startType);
    verify("out2", STRING_OBJECT_TYPE);
  }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType

    verify("out1", startType);
    verify("out2", STRING_OBJECT_TYPE);
  }

  public void testAssertInstanceof4() {
    JSType startType = registry.getNativeType(STRING_OBJECT_TYPE);
    assuming("x", startType);
    inFunction("out1 = x; goog.asserts.assertInstanceof(x, Object); out2 = x;");
    verify("out1", startType);
    verify("out2", STRING_OBJECT_TYPE);
  }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType

    verify("out1", startType);
    verify("out2", STRING_OBJECT_TYPE);
  }

  public void testAssertInstanceof5() {
    JSType startType = registry.getNativeType(ALL_TYPE);
    assuming("x", startType);
    inFunction(
        "out1 = x; goog.asserts.assertInstanceof(x, String); var r = x;");
    verify("out1", startType);
    verify("x", STRING_OBJECT_TYPE);
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType

    verify("out1", startType);
    verify("x", STRING_OBJECT_TYPE);
  }

  public void testAssertInstanceof6() {
    JSType startType = createUnionType(OBJECT_TYPE,VOID_TYPE);
    assuming("x", startType);
    inFunction(
        "out1 = x; goog.asserts.assertInstanceof(x, String); var r = x;");
    verify("out1", startType);
    verify("x", STRING_OBJECT_TYPE);
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType

    verify("out1", startType);
    verify("x", STRING_OBJECT_TYPE);
  }

  public void testAssertInstanceof7() {
    JSType startType = createUnionType(OBJECT_TYPE,VOID_TYPE);
    assuming("x", startType);
    inFunction(
        "out1 = x; var y = goog.asserts.assertInstanceof(x, String); var r = x;");
    verify("out1", startType);
    verify("y", STRING_OBJECT_TYPE);
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType

    verify("r", STRING_OBJECT_TYPE);
    verify("x", STRING_OBJECT_TYPE);
  }

  public void testAssertWithIsDefAndNotNull() {
    JSType startType = createNullableType(NUMBER_TYPE);
    assuming("x", startType);
    inFunction(
        "out1 = x;" +
        "goog.asserts.assert(goog.isDefAndNotNull(x));" +
        "out2 = x;");
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType

      // TODO(nicksantos|user): This is a terrible, terrible hack
      // to bail out on recursive typedefs. We'll eventually need
      // to handle these properly.
      typeRegistry.declareType(typedef, unknownType);

      JSType realType = info.getTypedefType().evaluate(scope, typeRegistry);
      if (realType == null) {
        compiler.report(
            JSError.make(candidate, MALFORMED_TYPEDEF, typedef));
      }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType

    private ObjectType getThisTypeForCollectingProperties() {
      Node rootNode = scope.getRootNode();
      if (rootNode.isFromExterns()) return null;

      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();
    }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType

          !member.isGetProp() ||
          !member.getFirstChild().isThis()) {
        return;
      }

      JSType jsType = getDeclaredType(info, member, value);
      Node name = member.getLastChild();
      if (jsType != null) {
        thisTypeForProperties.defineDeclaredProperty(
            name.getString(),
            jsType,
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType

      if (functionType != null) {
        Node jsDocParameters = functionType.getParametersNode();
        if (jsDocParameters != null) {
          Node jsDocParameter = jsDocParameters.getFirstChild();
          for (Node astParameter : astParameters.children()) {
            JSType paramType = jsDocParameter == null ?
                unknownType : jsDocParameter.getJSType();
            boolean inferred = paramType == null || paramType == unknownType;

            if (iifeArgumentNode != null && inferred) {
              String argumentName = iifeArgumentNode.getQualifiedName();
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.