if(step.isEmpty()) {
throw new IllegalStateException();
}
PathVariable var = null;
final int steplen = step.size();
final RewriteInfo info = new RewriteInfo();
boolean indexAccessable = ENV_DISABLE_INDEX_ACCESS ? false : true;
int lastRewritten = -1;
for(int i = 0; i < steplen; i++) {
final XQExpression curStep = step.get(i);
if(indexAccessable) {
indexAccessable &= curStep.isPathIndexAccessable(statEnv, info);
}
if(indexAccessable && info.isLookaheadRequired() && (i + 1) < steplen) {
indexAccessable = false;
int ni = i + 1;
XQExpression nextStep = step.get(ni);
if(nextStep instanceof DescendantStep) {
indexAccessable = nextStep.isPathIndexAccessable(statEnv, info);