* Type check a FilterParentPath. If the filter is not a node-set add a
* cast to node-set only if it is of reference type. This type coercion is
* needed for expressions like $x/LINE where $x is a parameter reference.
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
final Type ftype = _filterExpr.typeCheck(stable);
if (ftype instanceof NodeSetType == false) {
if (ftype instanceof ReferenceType) {
_filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
}
/*
else if (ftype instanceof ResultTreeType) {
_filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
}
*/
else if (ftype instanceof NodeType) {
_filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
}
else {
throw new TypeCheckError(this);
}
}
// Wrap single node path in a node set
final Type ptype = _path.typeCheck(stable);
if (!(ptype instanceof NodeSetType)) {
_path = new CastExpr(_path, Type.NodeSet);
}
return _type = Type.NodeSet;