public void display(int indent) { indent(indent); Util.println("ForEach"); indent(indent + IndentIncrement); Util.println("select " + _select.toString()); displayContents(indent + IndentIncrement); }
/** * The code that is generated by nested for-each loops can appear to some * JVMs as if it is accessing un-initialized variables. We must add some * code that pushes the default variable value on the stack and pops it * into the variable slot. This is done by the Variable.initialize() * method. The code that we compile for this loop looks like this: * * initialize iterator * initialize variables <-- HERE!!! * goto Iterate * Loop: : * : (code for <xsl:for-each> contents) * : * Iterate: node = iterator.next(); * if (node != END) goto Loop */ public void initializeVariables(ClassGenerator classGen, MethodGenerator methodGen) { final int n = elementCount(); for (int i = 0; i < n; i++) { final Object child = getContents().elementAt(i); if (child instanceof Variable) { Variable var = (Variable)child; var.initialize(classGen, methodGen); } } }
public void parseContents(Parser parser) { _select = parser.parseExpression(this, "select", null); parseChildren(parser); // make sure required attribute(s) have been set if (_select.isDummy()) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "select"); } }
Enumeration children = elements(); while (children.hasMoreElements()) { final Object child = children.nextElement(); getParser().reportError(WARNING, msg); initializeVariables(classGen, methodGen); translateContents(classGen, methodGen);
initializeVariables(classGen, methodGen);
Enumeration children = elements(); while (children.hasMoreElements()) { final Object child = children.nextElement(); getParser().reportError(WARNING, msg); initializeVariables(classGen, methodGen); translateContents(classGen, methodGen);
initializeVariables(classGen, methodGen);
public void display(int indent) { indent(indent); Util.println("ForEach"); indent(indent + IndentIncrement); Util.println("select " + _select.toString()); displayContents(indent + IndentIncrement); }
public void parseContents(Parser parser) { _select = parser.parseExpression(this, "select", null); parseChildren(parser); // make sure required attribute(s) have been set if (_select.isDummy()) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "select"); } }
/** * The code that is generated by nested for-each loops can appear to some * JVMs as if it is accessing un-initialized variables. We must add some * code that pushes the default variable value on the stack and pops it * into the variable slot. This is done by the Variable.initialize() * method. The code that we compile for this loop looks like this: * * initialize iterator * initialize variables <-- HERE!!! * goto Iterate * Loop: : * : (code for <xsl:for-each> contents) * : * Iterate: node = iterator.next(); * if (node != END) goto Loop */ public void initializeVariables(ClassGenerator classGen, MethodGenerator methodGen) { final int n = elementCount(); for (int i = 0; i < n; i++) { final Object child = getContents().elementAt(i); if (child instanceof Variable) { Variable var = (Variable)child; var.initialize(classGen, methodGen); } } }