il.append(methodGen.loadDOM());
// If the predicate's Step is simply '.' we translate this Step
// and place the node test on top of the resulting iterator
if (step.isAbbreviatedDot()) {
translate(classGen, methodGen);
il.append(new ICONST(DOM.RETURN_CURRENT));
}
// Otherwise we create a parent location path with this Step and
// the predicates Step, and place the node test on top of that
else {
ParentLocationPath path = new ParentLocationPath(this,step);
try {
path.typeCheck(getParser().getSymbolTable());
}
catch (TypeCheckError e) { }
path.translate(classGen, methodGen);
il.append(new ICONST(DOM.RETURN_PARENT));
}
predicate.translate(classGen, methodGen);
idx = cpg.addInterfaceMethodref(DOM_INTF,
GET_NODE_VALUE_ITERATOR,
GET_NODE_VALUE_ITERATOR_SIG);
il.append(new INVOKEINTERFACE(idx, 5));
}
// Handle '//*[n]' expression
else if (predicate.isNthDescendant()) {
il.append(methodGen.loadDOM());
// il.append(new ICONST(NodeTest.ELEMENT));
il.append(new ICONST(predicate.getPosType()));
predicate.translate(classGen, methodGen);
il.append(new ICONST(0));
idx = cpg.addInterfaceMethodref(DOM_INTF,
"getNthDescendant",
"(IIZ)"+NODE_ITERATOR_SIG);
il.append(new INVOKEINTERFACE(idx, 4));
}