use of com.google.errorprone.annotations.CheckReturnValue in project closure-compiler by google.
the class ChainableReverseAbstractInterpreter method declareNameInScope.
/**
* Declares a refined type in {@code scope} for the name represented by {@code node}. It must be
* possible to refine the type of the given node in the given scope, as determined by {@link
* #getTypeIfRefinable}. Returns an updated flow scope, which may be different from the passed-in
* scope if any changes occur.
*/
@CheckReturnValue
protected FlowScope declareNameInScope(FlowScope scope, Node node, JSType type) {
switch(node.getToken()) {
case NAME:
return scope.inferSlotType(node.getString(), type);
case GETPROP:
String qualifiedName = node.getQualifiedName();
checkNotNull(qualifiedName);
JSType origType = node.getJSType();
origType = origType == null ? getNativeType(UNKNOWN_TYPE) : origType;
return scope.inferQualifiedSlot(node, qualifiedName, origType, type, false);
case THIS:
// "this" references aren't currently modeled in the CFG.
return scope;
default:
throw new IllegalArgumentException("Node cannot be refined. \n" + node.toStringTree());
}
}
Aggregations