this.argTypes = argTypes;
}
private void runCheck(
Map<Scope, JSType> summaries, WarningReporter warnings) {
FunctionType fnSummary = summaries.get(this.calleeScope).getFunType();
println(
"Running deferred check of function: ", calleeScope.getReadableName(),
" with FunctionSummary of: ", fnSummary, " and callsite ret: ",
expectedRetType, " args: ", argTypes);
if (this.expectedRetType != null &&
!fnSummary.getReturnType().isSubtypeOf(this.expectedRetType)) {
warnings.add(JSError.make(
this.callSite, INVALID_INFERRED_RETURN_TYPE,
this.expectedRetType.toString(),
fnSummary.getReturnType().toString()));
}
int i = 0;
Node argNode = callSite.getFirstChild().getNext();
// this.argTypes can be null if in the fwd direction the analysis of the
// call return prematurely, eg, because of a WRONG_ARGUMENT_COUNT.
if (this.argTypes == null) {
return;
}
for (JSType argType : this.argTypes) {
JSType formalType = fnSummary.getFormalType(i);
Preconditions.checkState(!formalType.equals(JSType.topFunction()));
if (argNode.isName() &&
callerScope.isKnownFunction(argNode.getString())) {
argType = summaries.get(callerScope.getScope(argNode.getString()));
}