Search in sources :

Example 41 with FlowScope

use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.

the class SemanticReverseAbstractInterpreterTest method testSheqCondition5.

@SuppressWarnings("unchecked")
public void testSheqCondition5() throws Exception {
    FlowScope blind = newScope();
    testBinop(blind, Token.SHEQ, createVar(blind, "a", createUnionType(NULL_TYPE, VOID_TYPE)), createVar(blind, "b", createUnionType(VOID_TYPE)), ImmutableSet.of(new TypedName("a", VOID_TYPE), new TypedName("b", VOID_TYPE)), ImmutableSet.of(new TypedName("a", NULL_TYPE), new TypedName("b", VOID_TYPE)));
}
Also used : FlowScope(com.google.javascript.jscomp.type.FlowScope)

Example 42 with FlowScope

use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.

the class SemanticReverseAbstractInterpreterTest method testShneCondition4.

@SuppressWarnings("unchecked")
public void testShneCondition4() throws Exception {
    FlowScope blind = newScope();
    testBinop(blind, Token.SHNE, createVar(blind, "a", createUnionType(STRING_TYPE, VOID_TYPE)), createVar(blind, "b", createUnionType(VOID_TYPE)), ImmutableSet.of(new TypedName("a", STRING_TYPE), new TypedName("b", VOID_TYPE)), ImmutableSet.of(new TypedName("a", VOID_TYPE), new TypedName("b", VOID_TYPE)));
}
Also used : FlowScope(com.google.javascript.jscomp.type.FlowScope)

Example 43 with FlowScope

use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.

the class SemanticReverseAbstractInterpreterTest method testEqCondition4.

/**
 * Tests reverse interpretation of two undefineds.
 */
@SuppressWarnings("unchecked")
public void testEqCondition4() throws Exception {
    FlowScope blind = newScope();
    testBinop(blind, Token.EQ, createVar(blind, "a", VOID_TYPE), createVar(blind, "b", VOID_TYPE), ImmutableSet.of(new TypedName("a", VOID_TYPE), new TypedName("b", VOID_TYPE)), ImmutableSet.of(new TypedName("a", NO_TYPE), new TypedName("b", NO_TYPE)));
}
Also used : FlowScope(com.google.javascript.jscomp.type.FlowScope)

Example 44 with FlowScope

use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.

the class SemanticReverseAbstractInterpreterTest method testSheqCondition3.

/**
 * Tests reverse interpretation of a SHEQ(NAME, NAME) expression.
 */
@SuppressWarnings("unchecked")
public void testSheqCondition3() throws Exception {
    FlowScope blind = newScope();
    testBinop(blind, Token.SHEQ, createVar(blind, "b", createUnionType(STRING_TYPE, BOOLEAN_TYPE)), createVar(blind, "a", createUnionType(STRING_TYPE, NUMBER_TYPE)), ImmutableSet.of(new TypedName("a", STRING_TYPE), new TypedName("b", STRING_TYPE)), ImmutableSet.of(new TypedName("a", createUnionType(STRING_TYPE, NUMBER_TYPE)), new TypedName("b", createUnionType(STRING_TYPE, BOOLEAN_TYPE))));
}
Also used : FlowScope(com.google.javascript.jscomp.type.FlowScope)

Example 45 with FlowScope

use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.

the class SemanticReverseAbstractInterpreterTest method testSheqCondition4.

@SuppressWarnings("unchecked")
public void testSheqCondition4() throws Exception {
    FlowScope blind = newScope();
    testBinop(blind, Token.SHEQ, createVar(blind, "a", createUnionType(STRING_TYPE, VOID_TYPE)), createVar(blind, "b", createUnionType(VOID_TYPE)), ImmutableSet.of(new TypedName("a", VOID_TYPE), new TypedName("b", VOID_TYPE)), ImmutableSet.of(new TypedName("a", STRING_TYPE), new TypedName("b", VOID_TYPE)));
}
Also used : FlowScope(com.google.javascript.jscomp.type.FlowScope)

Aggregations

FlowScope (com.google.javascript.jscomp.type.FlowScope)60 Node (com.google.javascript.rhino.Node)20 Test (org.junit.Test)16 JSType (com.google.javascript.rhino.jstype.JSType)12 Token (com.google.javascript.rhino.Token)3 ImmutableMap (com.google.common.collect.ImmutableMap)1 CheckReturnValue (com.google.errorprone.annotations.CheckReturnValue)1 Branch (com.google.javascript.jscomp.ControlFlowGraph.Branch)1 AbstractScopedCallback (com.google.javascript.jscomp.NodeTraversal.AbstractScopedCallback)1 DiGraphEdge (com.google.javascript.jscomp.graph.DiGraph.DiGraphEdge)1 Module (com.google.javascript.jscomp.modules.Module)1 ClosureReverseAbstractInterpreter (com.google.javascript.jscomp.type.ClosureReverseAbstractInterpreter)1 ReverseAbstractInterpreter (com.google.javascript.jscomp.type.ReverseAbstractInterpreter)1 JSTypeResolver (com.google.javascript.rhino.jstype.JSTypeResolver)1 ObjectType (com.google.javascript.rhino.jstype.ObjectType)1 StaticTypedScope (com.google.javascript.rhino.jstype.StaticTypedScope)1 TemplateType (com.google.javascript.rhino.jstype.TemplateType)1 NodeSubject.assertNode (com.google.javascript.rhino.testing.NodeSubject.assertNode)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1