}
public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
for (int i=0; i<conditions.length; i++) {
conditions[i] = visitor.typeCheck(conditions[i], contextItemType);
XPathException err = TypeChecker.ebvError(conditions[i], visitor.getConfiguration().getTypeHierarchy());
if (err != null) {
err.setLocator(conditions[i]);
throw err;
}
}
for (int i=0; i<actions.length; i++) {
try {
actions[i] = visitor.typeCheck(actions[i], contextItemType);
} catch (XPathException err) {
// mustn't throw the error unless the branch is actually selected, unless its a type error
if (err.isTypeError()) {
throw err;
} else {
actions[i] = new ErrorExpression(err);
}
}