public Sequence<? extends Item> eval(Sequence<? extends Item> contextSeq, DynamicContext dynEnv)
throws XQueryException {
XQExpression outsideQueryExpr = dynEnv.getQueryExpression();
OutsideNonDownwardAxisDetector outsideNdaDetector = new OutsideNonDownwardAxisDetector();
outsideNdaDetector.visit(outsideQueryExpr, null);
final PreparedQueryRequest request = new PreparedQueryRequest(_queryExpr, outsideNdaDetector.foundNonDownwardAxis() ? ReturnType.REMOTE_PADED_SEQUENCE
: RemoteEval.RETURN_TYPE);
InsideNonDownwardAxisDetector insideNdaDetector = new InsideNonDownwardAxisDetector();
insideNdaDetector.visit(_queryExpr, null);
PreparedQueryRequest svRequest = insideNdaDetector.foundNonDownwardAxis() ? new PreparedQueryRequest(_queryExpr, ReturnType.REMOTE_PADED_SEQUENCE)
: request;
final ArrayList<ShippedVariable> shippedVars = new ArrayList<ShippedVariable>(4);
ShippedVariableCollector collector = new ShippedVariableCollector(shippedVars);
collector.visit(_queryExpr, null);