src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/ForEach.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
|
3 * @LastModified: Oct 2017 |
3 */ |
4 */ |
4 /* |
5 /* |
5 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * contributor license agreements. See the NOTICE file distributed with |
7 * contributor license agreements. See the NOTICE file distributed with |
7 * this work for additional information regarding copyright ownership. |
8 * this work for additional information regarding copyright ownership. |
21 * $Id: ForEach.java,v 1.2.4.1 2005/09/01 15:23:46 pvedula Exp $ |
22 * $Id: ForEach.java,v 1.2.4.1 2005/09/01 15:23:46 pvedula Exp $ |
22 */ |
23 */ |
23 |
24 |
24 package com.sun.org.apache.xalan.internal.xsltc.compiler; |
25 package com.sun.org.apache.xalan.internal.xsltc.compiler; |
25 |
26 |
26 import java.util.Enumeration; |
|
27 import java.util.Vector; |
|
28 |
|
29 import com.sun.org.apache.bcel.internal.generic.BranchHandle; |
27 import com.sun.org.apache.bcel.internal.generic.BranchHandle; |
30 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; |
28 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; |
31 import com.sun.org.apache.bcel.internal.generic.GOTO; |
29 import com.sun.org.apache.bcel.internal.generic.GOTO; |
32 import com.sun.org.apache.bcel.internal.generic.IFGT; |
30 import com.sun.org.apache.bcel.internal.generic.IFGT; |
33 import com.sun.org.apache.bcel.internal.generic.InstructionHandle; |
31 import com.sun.org.apache.bcel.internal.generic.InstructionHandle; |
40 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ReferenceType; |
38 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ReferenceType; |
41 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ResultTreeType; |
39 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ResultTreeType; |
42 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; |
40 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; |
43 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError; |
41 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError; |
44 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; |
42 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; |
|
43 import java.util.ArrayList; |
45 import java.util.Iterator; |
44 import java.util.Iterator; |
|
45 import java.util.List; |
46 |
46 |
47 /** |
47 /** |
48 * @author Jacek Ambroziak |
48 * @author Jacek Ambroziak |
49 * @author Santiago Pericas-Geertsen |
49 * @author Santiago Pericas-Geertsen |
50 * @author Morten Jorgensen |
50 * @author Morten Jorgensen |
95 // Save current node and current iterator on the stack |
95 // Save current node and current iterator on the stack |
96 il.append(methodGen.loadCurrentNode()); |
96 il.append(methodGen.loadCurrentNode()); |
97 il.append(methodGen.loadIterator()); |
97 il.append(methodGen.loadIterator()); |
98 |
98 |
99 // Collect sort objects associated with this instruction |
99 // Collect sort objects associated with this instruction |
100 final Vector sortObjects = new Vector(); |
100 final List<Sort> sortObjects = new ArrayList<>(); |
101 Iterator<SyntaxTreeNode> children = elements(); |
101 Iterator<SyntaxTreeNode> children = elements(); |
102 while (children.hasNext()) { |
102 while (children.hasNext()) { |
103 final Object child = children.next(); |
103 final SyntaxTreeNode child = children.next(); |
104 if (child instanceof Sort) { |
104 if (child instanceof Sort) { |
105 sortObjects.addElement(child); |
105 sortObjects.add((Sort)child); |
106 } |
106 } |
107 } |
107 } |
108 |
108 |
109 if ((_type != null) && (_type instanceof ResultTreeType)) { |
109 if ((_type != null) && (_type instanceof ResultTreeType)) { |
110 // Store existing DOM on stack - must be restored when loop is done |
110 // Store existing DOM on stack - must be restored when loop is done |