1 /* |
1 /* |
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 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. |
18 * limitations under the License. |
19 * limitations under the License. |
19 */ |
20 */ |
20 |
21 |
21 package com.sun.org.apache.xalan.internal.xsltc.compiler; |
22 package com.sun.org.apache.xalan.internal.xsltc.compiler; |
22 |
23 |
23 import java.util.Vector; |
|
24 |
|
25 import com.sun.org.apache.bcel.internal.generic.CHECKCAST; |
24 import com.sun.org.apache.bcel.internal.generic.CHECKCAST; |
26 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; |
25 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; |
27 import com.sun.org.apache.bcel.internal.generic.Instruction; |
|
28 import com.sun.org.apache.bcel.internal.generic.InstructionList; |
|
29 import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE; |
26 import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE; |
30 import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL; |
27 import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL; |
31 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; |
28 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; |
|
29 import com.sun.org.apache.bcel.internal.generic.Instruction; |
|
30 import com.sun.org.apache.bcel.internal.generic.InstructionList; |
32 import com.sun.org.apache.bcel.internal.generic.LocalVariableGen; |
31 import com.sun.org.apache.bcel.internal.generic.LocalVariableGen; |
33 import com.sun.org.apache.bcel.internal.generic.NEW; |
32 import com.sun.org.apache.bcel.internal.generic.NEW; |
34 import com.sun.org.apache.bcel.internal.generic.PUSH; |
33 import com.sun.org.apache.bcel.internal.generic.PUSH; |
35 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; |
34 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; |
36 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; |
35 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; |
38 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NodeSetType; |
37 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NodeSetType; |
39 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ResultTreeType; |
38 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ResultTreeType; |
40 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; |
39 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; |
41 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; |
40 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; |
42 import com.sun.org.apache.xml.internal.utils.XML11Char; |
41 import com.sun.org.apache.xml.internal.utils.XML11Char; |
|
42 import java.util.ArrayList; |
|
43 import java.util.List; |
43 |
44 |
44 /** |
45 /** |
45 * @author Jacek Ambroziak |
46 * @author Jacek Ambroziak |
46 * @author Santiago Pericas-Geertsen |
47 * @author Santiago Pericas-Geertsen |
47 * @author Morten Jorgensen |
48 * @author Morten Jorgensen |
59 protected Instruction _storeInstruction; // Instruction to load JVM variable |
60 protected Instruction _storeInstruction; // Instruction to load JVM variable |
60 protected Expression _select; // Reference to variable expression |
61 protected Expression _select; // Reference to variable expression |
61 protected String select; // Textual repr. of variable expr. |
62 protected String select; // Textual repr. of variable expr. |
62 |
63 |
63 // References to this variable (when local) |
64 // References to this variable (when local) |
64 protected Vector<VariableRefBase> _refs = new Vector<>(2); |
65 protected List<VariableRefBase> _refs = new ArrayList<>(2); |
65 |
66 |
66 // Used to make sure parameter field is not added twice |
67 // Used to make sure parameter field is not added twice |
67 protected boolean _ignore = false; |
68 protected boolean _ignore = false; |
68 |
69 |
69 /** |
70 /** |
76 /** |
77 /** |
77 * Add a reference to this variable. Called by VariableRef when an |
78 * Add a reference to this variable. Called by VariableRef when an |
78 * expression contains a reference to this variable. |
79 * expression contains a reference to this variable. |
79 */ |
80 */ |
80 public void addReference(VariableRefBase vref) { |
81 public void addReference(VariableRefBase vref) { |
81 _refs.addElement(vref); |
82 _refs.add(vref); |
82 } |
83 } |
83 |
84 |
84 /** |
85 /** |
85 * When a variable is overriden by another, e.g. via xsl:import, |
86 * When a variable is overriden by another, e.g. via xsl:import, |
86 * its references need to be copied or otherwise it may be |
87 * its references need to be copied or otherwise it may be |