Class ChainableReverseAbstractInterpreter
- java.lang.Object
-
- com.google.javascript.jscomp.type.ChainableReverseAbstractInterpreter
-
- All Implemented Interfaces:
ReverseAbstractInterpreter
- Direct Known Subclasses:
ClosureReverseAbstractInterpreter,SemanticReverseAbstractInterpreter
public abstract class ChainableReverseAbstractInterpreter extends java.lang.Object implements ReverseAbstractInterpreter
Chainable reverse abstract interpreter providing basic functionality.
-
-
Constructor Summary
Constructors Constructor Description ChainableReverseAbstractInterpreter(JSTypeRegistry typeRegistry)Constructs an interpreter, which is the only link in a chain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChainableReverseAbstractInterpreterappend(ChainableReverseAbstractInterpreter lastLink)Appends a link tothis, returning the updated last link.protected FlowScopedeclareNameInScope(FlowScope scope, Node node, JSType type)Declares a refined type inscopefor the name represented bynode.protected FlowScopefirstPreciserScopeKnowingConditionOutcome(Node condition, FlowScope blindScope, Outcome outcome)Calculates the preciser scope starting with the first link.ChainableReverseAbstractInterpretergetFirst()Gets the first link of this chain.protected @Nullable JSTypegetTypeIfRefinable(Node node, FlowScope scope)Returns the type of a node in the given scope if the node corresponds to a name whose type is capable of being refined.protected FlowScopenextPreciserScopeKnowingConditionOutcome(Node condition, FlowScope blindScope, Outcome outcome)Delegates the calculation of the preciser scope to the next link.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.javascript.jscomp.type.ReverseAbstractInterpreter
getPreciserScopeKnowingConditionOutcome
-
-
-
-
Constructor Detail
-
ChainableReverseAbstractInterpreter
public ChainableReverseAbstractInterpreter(JSTypeRegistry typeRegistry)
Constructs an interpreter, which is the only link in a chain. Interpreters can be appended usingappend(com.google.javascript.jscomp.type.ChainableReverseAbstractInterpreter).
-
-
Method Detail
-
append
public ChainableReverseAbstractInterpreter append(ChainableReverseAbstractInterpreter lastLink)
Appends a link tothis, returning the updated last link.The pattern
new X().append(new Y())...append(new Z())forms a chain starting with X, then Y, then ... Z.- Parameters:
lastLink- a chainable interpreter, with no next link- Returns:
- the updated last link
-
getFirst
public ChainableReverseAbstractInterpreter getFirst()
Gets the first link of this chain.
-
firstPreciserScopeKnowingConditionOutcome
protected FlowScope firstPreciserScopeKnowingConditionOutcome(Node condition, FlowScope blindScope, Outcome outcome)
Calculates the preciser scope starting with the first link.
-
nextPreciserScopeKnowingConditionOutcome
protected FlowScope nextPreciserScopeKnowingConditionOutcome(Node condition, FlowScope blindScope, Outcome outcome)
Delegates the calculation of the preciser scope to the next link. If there is no next link, returns the blind scope.
-
getTypeIfRefinable
protected @Nullable JSType getTypeIfRefinable(Node node, FlowScope scope)
Returns the type of a node in the given scope if the node corresponds to a name whose type is capable of being refined.- Returns:
- The current type of the node if it can be refined, null otherwise.
-
declareNameInScope
@CheckReturnValue protected FlowScope declareNameInScope(FlowScope scope, Node node, JSType type)
Declares a refined type inscopefor the name represented bynode. It must be possible to refine the type of the given node in the given scope, as determined bygetTypeIfRefinable(com.google.javascript.rhino.Node, com.google.javascript.jscomp.type.FlowScope). Returns an updated flow scope, which may be different from the passed-in scope if any changes occur.
-
-