public abstract class ChainableReverseAbstractInterpreter extends java.lang.Object implements ReverseAbstractInterpreter
Modifier and Type | Class and Description |
---|---|
(package private) class |
ChainableReverseAbstractInterpreter.RestrictByFalseTypeOfResultVisitor
A class common to all visitors that need to restrict the type based on
some
typeof -like condition being false. |
private class |
ChainableReverseAbstractInterpreter.RestrictByOneTypeOfResultVisitor |
(package private) class |
ChainableReverseAbstractInterpreter.RestrictByTrueTypeOfResultVisitor
A class common to all visitors that need to restrict the type based on
some
typeof -like condition being true. |
(package private) class |
ChainableReverseAbstractInterpreter.RestrictByTypeOfResultVisitor
A class common to all visitors that need to restrict the type based on
typeof -like conditions. |
Modifier and Type | Field and Description |
---|---|
private ChainableReverseAbstractInterpreter |
firstLink |
private ChainableReverseAbstractInterpreter |
nextLink |
private Visitor<JSType> |
restrictNullVisitor |
(package private) Visitor<JSType> |
restrictToArrayVisitor
For when
goog.isArray or Array.isArray returns true. |
(package private) Visitor<JSType> |
restrictToNotArrayVisitor
For when
goog.isArray or Array.isArray returns false. |
private Visitor<JSType> |
restrictUndefinedVisitor |
(package private) JSTypeRegistry |
typeRegistry |
Constructor and Description |
---|
ChainableReverseAbstractInterpreter(JSTypeRegistry typeRegistry)
Constructs an interpreter, which is the only link in a chain.
|
Modifier and Type | Method and Description |
---|---|
ChainableReverseAbstractInterpreter |
append(ChainableReverseAbstractInterpreter lastLink)
Appends a link to
this , returning the updated last link. |
protected void |
declareNameInScope(FlowScope scope,
Node node,
JSType type)
Declares a refined type in
scope for the name represented by
node . |
protected FlowScope |
firstPreciserScopeKnowingConditionOutcome(Node condition,
FlowScope blindScope,
boolean outcome)
Calculates the preciser scope starting with the first link.
|
ChainableReverseAbstractInterpreter |
getFirst()
Gets the first link of this chain.
|
(package private) JSType |
getNativeType(JSTypeNative typeId) |
private JSType |
getNativeTypeForTypeOf(java.lang.String value)
If we definitely know what a type is based on the typeof result,
return it.
|
(package private) JSType |
getRestrictedByTypeOfResult(JSType type,
java.lang.String value,
boolean resultEqualsValue)
Returns a version of
type that is restricted by some knowledge
about the result of the typeof operation. |
protected JSType |
getRestrictedWithoutNull(JSType type)
Returns a version of type where null is not present.
|
protected JSType |
getRestrictedWithoutUndefined(JSType type)
Returns a version of type where undefined is not present.
|
protected 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.
|
protected FlowScope |
nextPreciserScopeKnowingConditionOutcome(Node condition,
FlowScope blindScope,
boolean outcome)
Delegates the calculation of the preciser scope to the next link.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPreciserScopeKnowingConditionOutcome
final JSTypeRegistry typeRegistry
private ChainableReverseAbstractInterpreter firstLink
private ChainableReverseAbstractInterpreter nextLink
private final Visitor<JSType> restrictUndefinedVisitor
getRestrictedWithoutUndefined(JSType)
private final Visitor<JSType> restrictNullVisitor
getRestrictedWithoutNull(JSType)
final Visitor<JSType> restrictToArrayVisitor
goog.isArray
or Array.isArray
returns true.public ChainableReverseAbstractInterpreter(JSTypeRegistry typeRegistry)
append(com.google.javascript.jscomp.type.ChainableReverseAbstractInterpreter)
.public ChainableReverseAbstractInterpreter append(ChainableReverseAbstractInterpreter lastLink)
this
, 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.
lastLink
- a chainable interpreter, with no next linkpublic ChainableReverseAbstractInterpreter getFirst()
protected FlowScope firstPreciserScopeKnowingConditionOutcome(Node condition, FlowScope blindScope, boolean outcome)
protected FlowScope nextPreciserScopeKnowingConditionOutcome(Node condition, FlowScope blindScope, boolean outcome)
protected JSType getTypeIfRefinable(Node node, FlowScope scope)
protected void declareNameInScope(FlowScope scope, Node node, JSType type)
scope
for the name represented by
node
. It must be possible to refine the type of the given node in
the given scope, as determined by getTypeIfRefinable(com.google.javascript.rhino.Node, com.google.javascript.jscomp.type.FlowScope)
.protected final JSType getRestrictedWithoutUndefined(JSType type)
protected final JSType getRestrictedWithoutNull(JSType type)
JSType getRestrictedByTypeOfResult(JSType type, java.lang.String value, boolean resultEqualsValue)
type
that is restricted by some knowledge
about the result of the typeof
operation.
The behavior of the typeof
operator can be summarized by the
following table:
type | result |
---|---|
undefined | "undefined" |
null | "object" |
boolean | "boolean" |
number | "number" |
string | "string" |
Object (which doesn't implement [[Call]]) |
"object" |
Object (which implements [[Call]]) |
"function" |
type
- the type to restrictvalue
- A value known to be equal or not equal to the result of the
typeof
operationresultEqualsValue
- true
if the typeOf
result is known
to equal value
; false
if it is known not to
equal value
JSType getNativeType(JSTypeNative typeId)
private JSType getNativeTypeForTypeOf(java.lang.String value)