Examples of JSType


Examples of com.google.api.explorer.client.base.dynamicjso.JsType

      int index,
      int depth,
      boolean hasSeparator,
      PrettifierLinkFactory linkFactory) {

    JsType type = obj.typeofIndex(index);
    if (type == null) {
      return simpleInline("", "null", style.jsonNull(), depth, hasSeparator);
    }
    String title = "";
    switch (type) {
View Full Code Here

Examples of com.google.javascript.jscomp.newtypes.JSType

      entryEnv = envPutType(entryEnv, RETVAL_ID, JSType.UNDEFINED);
    } else {
      nonLocals.addAll(currentScope.getExterns());
    }
    for (String name : nonLocals) {
      JSType declType = currentScope.getDeclaredTypeOf(name);
      JSType initType = declType == null
          ? envGetType(entryEnv, name) : pickInitialType(declType);
      entryEnv = envPutType(entryEnv, name, initType);
    }

    // For all scopes, add local variables and (local) function definitions
    // to the environment.
    for (String local : currentScope.getLocals()) {
      entryEnv = envPutType(entryEnv, local, JSType.UNDEFINED);
    }
    for (String fnName : currentScope.getLocalFunDefs()) {
      JSType summaryType = getSummaryOfLocalFunDef(fnName);
      FunctionType fnType = summaryType.getFunType();
      if (fnType.isConstructor() || fnType.isInterfaceDefinition()) {
        summaryType = fnType.createConstructorObject();
      } else {
        summaryType = summaryType.withProperty(
            new QualifiedName("prototype"), JSType.TOP_OBJECT);
      }
      entryEnv = envPutType(entryEnv, fnName, summaryType);
    }
    println("Keeping env: ", entryEnv);
View Full Code Here

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

  private void verify(String name, JSTypeNative type) {
    verify(name, registry.getNativeType(type));
  }

  private void verifySubtypeOf(String name, JSType type) {
    JSType varType = getType(name);
    assertNotNull("The variable " + name + " is missing a type.", varType);
    assertTrue("The type " + varType + " of variable " + name +
        " is not a subtype of " + type +".",  varType.isSubtype(type));
  }
View Full Code Here

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

    inFunction("var y = 1; this.foo = x; y = this.foo;");
    verify("y", CHECKED_UNKNOWN_TYPE);
  }

  public void testAssert1() {
    JSType startType = createNullableType(OBJECT_TYPE);
    assuming("x", startType);
    inFunction("out1 = x; goog.asserts.assert(x); out2 = x;");
    verify("out1", startType);
    verify("out2", OBJECT_TYPE);
  }
View Full Code Here

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

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

  public void testAssert1a() {
    JSType startType = createNullableType(OBJECT_TYPE);
    assuming("x", startType);
    inFunction("out1 = x; goog.asserts.assert(x !== null); out2 = x;");
    verify("out1", startType);
    verify("out2", OBJECT_TYPE);
  }
View Full Code Here

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

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

  public void testAssert2() {
    JSType startType = createNullableType(OBJECT_TYPE);
    assuming("x", startType);
    inFunction("goog.asserts.assert(1, x); out1 = x;");
    verify("out1", startType);
  }
View Full Code Here

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

    inFunction("goog.asserts.assert(1, x); out1 = x;");
    verify("out1", startType);
  }

  public void testAssert3() {
    JSType startType = createNullableType(OBJECT_TYPE);
    assuming("x", startType);
    assuming("y", startType);
    inFunction("out1 = x; goog.asserts.assert(x && y); out2 = x; out3 = y;");
    verify("out1", startType);
    verify("out2", OBJECT_TYPE);
View Full Code Here

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

    verify("out2", OBJECT_TYPE);
    verify("out3", OBJECT_TYPE);
  }

  public void testAssert4() {
    JSType startType = createNullableType(OBJECT_TYPE);
    assuming("x", startType);
    assuming("y", startType);
    inFunction("out1 = x; goog.asserts.assert(x && !y); out2 = x; out3 = y;");
    verify("out1", startType);
    verify("out2", OBJECT_TYPE);
View Full Code Here

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

    verify("out2", OBJECT_TYPE);
    verify("out3", NULL_TYPE);
  }

  public void testAssert5() {
    JSType startType = createNullableType(OBJECT_TYPE);
    assuming("x", startType);
    assuming("y", startType);
    inFunction("goog.asserts.assert(x || y); out1 = x; out2 = y;");
    verify("out1", startType);
    verify("out2", startType);
View Full Code Here

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

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

  public void testAssert6() {
    JSType startType = createNullableType(OBJECT_TYPE);
    assuming("x.y", startType);
    inFunction("out1 = x.y; goog.asserts.assert(x.y); out2 = x.y;");
    verify("out1", startType);
    verify("out2", OBJECT_TYPE);
  }
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.