use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.
the class SemanticReverseAbstractInterpreterTest method testAssignCondition1.
/**
* Tests reverse interpretation of a ASSIGN expression.
*/
@SuppressWarnings("unchecked")
public void testAssignCondition1() throws Exception {
FlowScope blind = newScope();
testBinop(blind, Token.ASSIGN, createVar(blind, "a", createNullableType(OBJECT_TYPE)), createVar(blind, "b", createNullableType(OBJECT_TYPE)), ImmutableSet.of(new TypedName("a", OBJECT_TYPE), new TypedName("b", OBJECT_TYPE)), ImmutableSet.of(new TypedName("a", NULL_TYPE), new TypedName("b", NULL_TYPE)));
}
use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.
the class SemanticReverseAbstractInterpreterTest method testSheqCondition6.
@SuppressWarnings("unchecked")
public void testSheqCondition6() throws Exception {
FlowScope blind = newScope();
testBinop(blind, Token.SHEQ, createVar(blind, "a", createUnionType(STRING_TYPE, VOID_TYPE)), createVar(blind, "b", createUnionType(NUMBER_TYPE, VOID_TYPE)), ImmutableSet.of(new TypedName("a", VOID_TYPE), new TypedName("b", VOID_TYPE)), ImmutableSet.of(new TypedName("a", createUnionType(STRING_TYPE, VOID_TYPE)), new TypedName("b", createUnionType(NUMBER_TYPE, VOID_TYPE))));
}
use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.
the class SemanticReverseAbstractInterpreterTest method testShneCondition6.
@SuppressWarnings("unchecked")
public void testShneCondition6() throws Exception {
FlowScope blind = newScope();
testBinop(blind, Token.SHNE, createVar(blind, "a", createUnionType(STRING_TYPE, VOID_TYPE)), createVar(blind, "b", createUnionType(NUMBER_TYPE, VOID_TYPE)), ImmutableSet.of(new TypedName("a", createUnionType(STRING_TYPE, VOID_TYPE)), new TypedName("b", createUnionType(NUMBER_TYPE, VOID_TYPE))), ImmutableSet.of(new TypedName("a", VOID_TYPE), new TypedName("b", VOID_TYPE)));
}
use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.
the class SemanticReverseAbstractInterpreterTest method testInstanceOf2.
@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), ImmutableSet.of(new TypedName("x", STRING_OBJECT_TYPE), new TypedName("s", STRING_OBJECT_FUNCTION_TYPE)), ImmutableSet.of(new TypedName("x", NUMBER_OBJECT_TYPE), new TypedName("s", STRING_OBJECT_FUNCTION_TYPE)));
}
use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.
the class SemanticReverseAbstractInterpreterTest method testAnd.
@SuppressWarnings("unchecked")
public void testAnd() {
FlowScope blind = newScope();
testBinop(blind, Token.AND, createVar(blind, "b", createUnionType(STRING_TYPE, NULL_TYPE)), createVar(blind, "a", createUnionType(NUMBER_TYPE, VOID_TYPE)), ImmutableSet.of(new TypedName("a", NUMBER_TYPE), new TypedName("b", STRING_TYPE)), ImmutableSet.of(new TypedName("a", createUnionType(NUMBER_TYPE, VOID_TYPE)), new TypedName("b", createUnionType(STRING_TYPE, NULL_TYPE))));
}
Aggregations