Examples of FlowScope


Examples of com.google.javascript.jscomp.type.FlowScope

            new TypedName("a", OBJECT_TYPE)));
  }

  @SuppressWarnings("unchecked")
  public void testTypeof2() {
    FlowScope blind = newScope();
    testBinop(blind,
        Token.EQ,
        new Node(Token.TYPEOF, createVar(blind, "a", ALL_TYPE)),
        Node.newString("function"),
        Sets.newHashSet(
View Full Code Here

Examples of com.google.javascript.jscomp.type.FlowScope

            new TypedName("a", ALL_TYPE)));
  }

  @SuppressWarnings("unchecked")
  public void testTypeof3() {
    FlowScope blind = newScope();
    testBinop(blind,
        Token.EQ,
        new Node(Token.TYPEOF, createVar(
            blind, "a", OBJECT_NUMBER_STRING_BOOLEAN)),
        Node.newString("function"),
View Full Code Here

Examples of com.google.javascript.jscomp.type.FlowScope

            new TypedName("a", OBJECT_NUMBER_STRING_BOOLEAN)));
  }

  @SuppressWarnings("unchecked")
  public void testTypeof4() {
    FlowScope blind = newScope();
    testBinop(blind,
        Token.EQ,
        new Node(Token.TYPEOF, createVar(
            blind, "a", createUnionType(
                U2U_CONSTRUCTOR_TYPE, NUMBER_STRING_BOOLEAN))),
View Full Code Here

Examples of com.google.javascript.jscomp.type.FlowScope

            new TypedName("a", NUMBER_STRING_BOOLEAN)));
  }

  @SuppressWarnings("unchecked")
  public void testInstanceOf() {
    FlowScope blind = newScope();
    testBinop(blind,
        Token.INSTANCEOF,
        createVar(blind, "x", UNKNOWN_TYPE),
        createVar(blind, "s", STRING_OBJECT_FUNCTION_TYPE),
        Sets.newHashSet(
View Full Code Here

Examples of com.google.javascript.jscomp.type.FlowScope

            new TypedName("s", STRING_OBJECT_FUNCTION_TYPE)));
  }

  @SuppressWarnings("unchecked")
  public void testInstanceOf2() {
    FlowScope blind = newScope();
    testBinop(blind,
        Token.INSTANCEOF,
        createVar(blind, "x",
            createUnionType(STRING_OBJECT_TYPE, NUMBER_OBJECT_TYPE)),
        createVar(blind, "s", STRING_OBJECT_FUNCTION_TYPE),
View Full Code Here

Examples of com.google.javascript.jscomp.type.FlowScope

            new TypedName("s", STRING_OBJECT_FUNCTION_TYPE)));
  }

  @SuppressWarnings("unchecked")
  public void testInstanceOf3() {
    FlowScope blind = newScope();
    testBinop(blind,
        Token.INSTANCEOF,
        createVar(blind, "x", OBJECT_TYPE),
        createVar(blind, "s", STRING_OBJECT_FUNCTION_TYPE),
        Sets.newHashSet(
View Full Code Here

Examples of com.google.javascript.jscomp.type.FlowScope

            new TypedName("s", STRING_OBJECT_FUNCTION_TYPE)));
  }

  @SuppressWarnings("unchecked")
  public void testInstanceOf4() {
    FlowScope blind = newScope();
    testBinop(blind,
        Token.INSTANCEOF,
        createVar(blind, "x", ALL_TYPE),
        createVar(blind, "s", STRING_OBJECT_FUNCTION_TYPE),
        Sets.newHashSet(
View Full Code Here

Examples of com.google.javascript.jscomp.type.FlowScope

    Node condition = new Node(binop);
    condition.addChildToBack(left);
    condition.addChildToBack(right);

    // true outcome.
    FlowScope informedTrue = interpreter.
        getPreciserScopeKnowingConditionOutcome(condition, blind, true);
    for (TypedName p : trueOutcome) {
      assertTypeEquals(p.name, p.type, getVarType(informedTrue, p.name));
    }

    // false outcome.
    FlowScope informedFalse = interpreter.
        getPreciserScopeKnowingConditionOutcome(condition, blind, false);
    for (TypedName p : falseOutcome) {
      assertTypeEquals(p.type, getVarType(informedFalse, p.name));
    }
  }
View Full Code Here

Examples of com.google.javascript.jscomp.type.FlowScope

  /**
   * Tests reverse interpretation of a NAME expression.
   */
  public void testNameCondition() throws Exception {
    FlowScope blind = newScope();
    Node condition = createVar(blind, "a", createNullableType(STRING_TYPE));

    // true outcome.
    FlowScope informedTrue = interpreter.
        getPreciserScopeKnowingConditionOutcome(condition, blind, true);
    assertTypeEquals(STRING_TYPE, getVarType(informedTrue, "a"));

    // false outcome.
    FlowScope informedFalse = interpreter.
        getPreciserScopeKnowingConditionOutcome(condition, blind, false);
    assertTypeEquals(createNullableType(STRING_TYPE),
        getVarType(informedFalse, "a"));
  }
View Full Code Here

Examples of com.google.javascript.jscomp.type.FlowScope

  /**
   * Tests reverse interpretation of a NOT(NAME) expression.
   */
  public void testNegatedNameCondition() throws Exception {
    FlowScope blind = newScope();
    Node a = createVar(blind, "a", createNullableType(STRING_TYPE));
    Node condition = new Node(Token.NOT);
    condition.addChildToBack(a);

    // true outcome.
    FlowScope informedTrue = interpreter.
        getPreciserScopeKnowingConditionOutcome(condition, blind, true);
    assertTypeEquals(createNullableType(STRING_TYPE),
        getVarType(informedTrue, "a"));

    // false outcome.
    FlowScope informedFalse = interpreter.
        getPreciserScopeKnowingConditionOutcome(condition, blind, false);
    assertTypeEquals(STRING_TYPE, getVarType(informedFalse, "a"));
  }
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.