resolveList(defaults, s);
Scope funcTable = getTable();
int argnum = 0;
for (NNode a : args) {
NType argtype = NFunctionDef.getArgType(args, defaults, argnum++);
param.bind(funcTable, a, argtype);
fromType.add(argtype);
}
if (varargs != null) {
NType u = new NUnknownType();
param.bind(funcTable, varargs, u);
fromType.add(u);
}
if (kwargs != null) {
NType u = new NUnknownType();
param.bind(funcTable, kwargs, u);
fromType.add(u);
}
// A lambda body is not an NBody, so it doesn't undergo the two
// pre-resolve passes for finding global statements and name-binding
// constructs. However, the lambda expression may itself contain
// name-binding constructs (generally, other lambdas), so we need to
// perform the name-binding pass on it before resolving.
try {
funcTable.setNameBindingPhase(true);
body.visit(new BindingFinder(funcTable));
} finally {
funcTable.setNameBindingPhase(false);
}
NType toType = resolveExpr(body, funcTable);
if (getType().isFuncType()) { // else warning logged at method entry above
getType().asFuncType().setReturnType(toType);
}
return getType();
}