{
int iter = cpg.addInterfaceMethodref(DOM_INTF,
"getTypedAxisIterator",
"(II)"+NODE_ITERATOR_SIG);
il.append(methodGen.loadDOM());
il.append(new PUSH(cpg, Axis.ATTRIBUTE));
il.append(new PUSH(cpg, _nodeType));
il.append(new INVOKEINTERFACE(iter, 3));
return;
}
SyntaxTreeNode parent = getParent();
// Special case for '.'
if (isAbbreviatedDot()) {
if (_type == Type.Node) {
// Put context node on stack if using Type.Node
il.append(methodGen.loadContextNode());
}
else {
if (parent instanceof ParentLocationPath){
// Wrap the context node in a singleton iterator if not.
int init = cpg.addMethodref(SINGLETON_ITERATOR,
"<init>",
"("+NODE_SIG+")V");
il.append(new NEW(cpg.addClass(SINGLETON_ITERATOR)));
il.append(DUP);
il.append(methodGen.loadContextNode());
il.append(new INVOKESPECIAL(init));
} else {
// DOM.getAxisIterator(int axis);
int git = cpg.addInterfaceMethodref(DOM_INTF,
"getAxisIterator",
"(I)"+NODE_ITERATOR_SIG);
il.append(methodGen.loadDOM());
il.append(new PUSH(cpg, _axis));
il.append(new INVOKEINTERFACE(git, 2));
}
}
return;
}
// Special case for /foo/*/bar
if ((parent instanceof ParentLocationPath) &&
(parent.getParent() instanceof ParentLocationPath)) {
if ((_nodeType == NodeTest.ELEMENT) && (!_hadPredicates)) {
_nodeType = NodeTest.ANODE;
}
}
// "ELEMENT" or "*" or "@*" or ".." or "@attr" with a parent.
switch (_nodeType) {
case NodeTest.ATTRIBUTE:
_axis = Axis.ATTRIBUTE;
case NodeTest.ANODE:
// DOM.getAxisIterator(int axis);
int git = cpg.addInterfaceMethodref(DOM_INTF,
"getAxisIterator",
"(I)"+NODE_ITERATOR_SIG);
il.append(methodGen.loadDOM());
il.append(new PUSH(cpg, _axis));
il.append(new INVOKEINTERFACE(git, 2));
break;
default:
if (star > 1) {
final String namespace;
if (_axis == Axis.ATTRIBUTE)
namespace = name.substring(0,star-2);
else
namespace = name.substring(0,star-1);
final int nsType = xsltc.registerNamespace(namespace);
final int ns = cpg.addInterfaceMethodref(DOM_INTF,
"getNamespaceAxisIterator",
"(II)"+NODE_ITERATOR_SIG);
il.append(methodGen.loadDOM());
il.append(new PUSH(cpg, _axis));
il.append(new PUSH(cpg, nsType));
il.append(new INVOKEINTERFACE(ns, 3));
break;
}
case NodeTest.ELEMENT:
// DOM.getTypedAxisIterator(int axis, int type);
final int ty = cpg.addInterfaceMethodref(DOM_INTF,
"getTypedAxisIterator",
"(II)"+NODE_ITERATOR_SIG);
// Get the typed iterator we're after
il.append(methodGen.loadDOM());
il.append(new PUSH(cpg, _axis));
il.append(new PUSH(cpg, _nodeType));
il.append(new INVOKEINTERFACE(ty, 3));
break;
}
}