public final class SemanticReverseAbstractInterpreter extends ChainableReverseAbstractInterpreter
Modifier and Type | Class and Description |
---|---|
private class |
SemanticReverseAbstractInterpreter.RestrictByFalseInstanceOfResultVisitor |
private class |
SemanticReverseAbstractInterpreter.RestrictByTrueInstanceOfResultVisitor |
ChainableReverseAbstractInterpreter.RestrictByFalseTypeOfResultVisitor, ChainableReverseAbstractInterpreter.RestrictByTrueTypeOfResultVisitor, ChainableReverseAbstractInterpreter.RestrictByTypeOfResultVisitor
Modifier and Type | Field and Description |
---|---|
private static com.google.common.base.Function<JSType.TypePair,JSType.TypePair> |
EQ
Merging function for equality between types.
|
private com.google.common.base.Function<JSType.TypePair,JSType.TypePair> |
ineq
Merging function for inequality comparisons between types.
|
private static com.google.common.base.Function<JSType.TypePair,JSType.TypePair> |
NE
Merging function for non-equality between types.
|
private static com.google.common.base.Function<JSType.TypePair,JSType.TypePair> |
SHEQ
Merging function for strict equality between types.
|
private static com.google.common.base.Function<JSType.TypePair,JSType.TypePair> |
SHNE
Merging function for strict non-equality between types.
|
restrictToArrayVisitor, restrictToNotArrayVisitor, typeRegistry
Constructor and Description |
---|
SemanticReverseAbstractInterpreter(JSTypeRegistry typeRegistry)
Creates a semantic reverse abstract interpreter.
|
Modifier and Type | Method and Description |
---|---|
private FlowScope |
caseAndOrMaybeShortCircuiting(Node left,
Node right,
FlowScope blindScope,
boolean outcome) |
private FlowScope |
caseAndOrNotShortCircuiting(Node left,
Node right,
FlowScope blindScope,
boolean outcome) |
private FlowScope |
caseEquality(Node condition,
FlowScope blindScope,
com.google.common.base.Function<JSType.TypePair,JSType.TypePair> merging) |
private FlowScope |
caseEquality(Node left,
Node right,
FlowScope blindScope,
com.google.common.base.Function<JSType.TypePair,JSType.TypePair> merging) |
private FlowScope |
caseIn(Node object,
java.lang.String propertyName,
FlowScope blindScope)
Given 'property in object', ensures that the object has the property in the
informed scope by defining it as a qualified name if the object type lacks
the property and it's not in the blind scope.
|
private FlowScope |
caseInstanceOf(Node left,
Node right,
FlowScope blindScope,
boolean outcome) |
private FlowScope |
caseIsArray(Node value,
FlowScope blindScope,
boolean outcome) |
private FlowScope |
caseNameOrGetProp(Node name,
FlowScope blindScope,
boolean outcome) |
private FlowScope |
caseTypeOf(Node node,
JSType type,
java.lang.String value,
boolean resultEqualsValue,
FlowScope blindScope) |
FlowScope |
getPreciserScopeKnowingConditionOutcome(Node condition,
FlowScope blindScope,
boolean outcome)
Calculates a precise version of the scope knowing the outcome of the
condition.
|
private FlowScope |
maybeRestrictName(FlowScope blindScope,
Node node,
JSType originalType,
JSType restrictedType)
If the restrictedType differs from the originalType, then we should
branch the current flow scope and create a new flow scope with the name
declared with the new type.
|
private FlowScope |
maybeRestrictTwoNames(FlowScope blindScope,
Node left,
JSType originalLeftType,
JSType restrictedLeftType,
Node right,
JSType originalRightType,
JSType restrictedRightType) |
append, declareNameInScope, firstPreciserScopeKnowingConditionOutcome, getFirst, getNativeType, getRestrictedByTypeOfResult, getRestrictedWithoutNull, getRestrictedWithoutUndefined, getTypeIfRefinable, nextPreciserScopeKnowingConditionOutcome
private static final com.google.common.base.Function<JSType.TypePair,JSType.TypePair> EQ
private static final com.google.common.base.Function<JSType.TypePair,JSType.TypePair> NE
private static final com.google.common.base.Function<JSType.TypePair,JSType.TypePair> SHEQ
private static final com.google.common.base.Function<JSType.TypePair,JSType.TypePair> SHNE
private final com.google.common.base.Function<JSType.TypePair,JSType.TypePair> ineq
public SemanticReverseAbstractInterpreter(JSTypeRegistry typeRegistry)
public FlowScope getPreciserScopeKnowingConditionOutcome(Node condition, FlowScope blindScope, boolean outcome)
ReverseAbstractInterpreter
condition
- the condition's expressionblindScope
- the scope without knowledge about the outcome of the
conditionoutcome
- the outcome of the conditionprivate FlowScope caseEquality(Node condition, FlowScope blindScope, com.google.common.base.Function<JSType.TypePair,JSType.TypePair> merging)
private FlowScope caseEquality(Node left, Node right, FlowScope blindScope, com.google.common.base.Function<JSType.TypePair,JSType.TypePair> merging)
private FlowScope caseAndOrNotShortCircuiting(Node left, Node right, FlowScope blindScope, boolean outcome)
private FlowScope caseAndOrMaybeShortCircuiting(Node left, Node right, FlowScope blindScope, boolean outcome)
private FlowScope maybeRestrictName(FlowScope blindScope, Node node, JSType originalType, JSType restrictedType)
null
for a restricted type.private FlowScope maybeRestrictTwoNames(FlowScope blindScope, Node left, JSType originalLeftType, JSType restrictedLeftType, Node right, JSType originalRightType, JSType restrictedRightType)
private FlowScope caseNameOrGetProp(Node name, FlowScope blindScope, boolean outcome)
private FlowScope caseTypeOf(Node node, JSType type, java.lang.String value, boolean resultEqualsValue, FlowScope blindScope)
private FlowScope caseInstanceOf(Node left, Node right, FlowScope blindScope, boolean outcome)
private FlowScope caseIn(Node object, java.lang.String propertyName, FlowScope blindScope)
object
- The node of the right-side of the in.propertyName
- The string of the left-side of the in.