* Type-check the expression.
*/
public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
for (int i=0; i<argument.length; i++) {
Expression exp = visitor.typeCheck(argument[i], contextItemType);
if (exp != argument[i]) {
adoptChildExpression(exp);
argument[i] = exp;
}
}
MemberInfo method = getBestFit(candidateMethods, argument, theClass);
if (method == null) {
XPathException err = new XPathException("There is more than one method matching the function call " +
getFunctionName().getDisplayName() +
", and there is insufficient type information to determine which one should be used");
err.setLocator(this);
throw err;
} else {
DotNetExtensionFunctionFactory factory =
(DotNetExtensionFunctionFactory)config.getExtensionFunctionFactory("clitype");
Expression call = factory.makeExtensionFunctionCall(getFunctionName(), theClass, method, argument);
ExpressionTool.copyLocationInfo(this, call);
return call;
}
}