/
Expression.java
166 lines (144 loc) · 5.49 KB
/
Expression.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package com.sun.org.apache.xalan.internal.xsltc.compiler;
import com.sun.org.apache.bcel.internal.generic.BranchHandle;
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
import com.sun.org.apache.bcel.internal.generic.GOTO_W;
import com.sun.org.apache.bcel.internal.generic.IFEQ;
import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
import com.sun.org.apache.bcel.internal.generic.InstructionList;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.BooleanType;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NodeSetType;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
import java.util.Vector;
abstract class Expression
extends SyntaxTreeNode
{
protected Type _type;
protected FlowList _trueList = new FlowList();
protected FlowList _falseList = new FlowList();
Expression() {}
public Type getType()
{
return _type;
}
public abstract String toString();
public boolean hasPositionCall()
{
return false;
}
public boolean hasLastCall()
{
return false;
}
public Object evaluateAtCompileTime()
{
return null;
}
public Type typeCheck(SymbolTable paramSymbolTable)
throws TypeCheckError
{
return typeCheckContents(paramSymbolTable);
}
public void translate(ClassGenerator paramClassGenerator, MethodGenerator paramMethodGenerator)
{
ErrorMsg localErrorMsg = new ErrorMsg("NOT_IMPLEMENTED_ERR", getClass(), this);
getParser().reportError(2, localErrorMsg);
}
public final InstructionList compile(ClassGenerator paramClassGenerator, MethodGenerator paramMethodGenerator)
{
InstructionList localInstructionList2 = paramMethodGenerator.getInstructionList();
InstructionList localInstructionList1;
paramMethodGenerator.setInstructionList(localInstructionList1 = new InstructionList());
translate(paramClassGenerator, paramMethodGenerator);
paramMethodGenerator.setInstructionList(localInstructionList2);
return localInstructionList1;
}
public void translateDesynthesized(ClassGenerator paramClassGenerator, MethodGenerator paramMethodGenerator)
{
translate(paramClassGenerator, paramMethodGenerator);
if ((_type instanceof BooleanType)) {
desynthesize(paramClassGenerator, paramMethodGenerator);
}
}
public void startIterator(ClassGenerator paramClassGenerator, MethodGenerator paramMethodGenerator)
{
if (!(_type instanceof NodeSetType)) {
return;
}
Expression localExpression = this;
if ((localExpression instanceof CastExpr)) {
localExpression = ((CastExpr)localExpression).getExpr();
}
if (!(localExpression instanceof VariableRefBase))
{
InstructionList localInstructionList = paramMethodGenerator.getInstructionList();
localInstructionList.append(paramMethodGenerator.loadContextNode());
localInstructionList.append(paramMethodGenerator.setStartNode());
}
}
public void synthesize(ClassGenerator paramClassGenerator, MethodGenerator paramMethodGenerator)
{
ConstantPoolGen localConstantPoolGen = paramClassGenerator.getConstantPool();
InstructionList localInstructionList = paramMethodGenerator.getInstructionList();
_trueList.backPatch(localInstructionList.append(ICONST_1));
BranchHandle localBranchHandle = localInstructionList.append(new GOTO_W(null));
_falseList.backPatch(localInstructionList.append(ICONST_0));
localBranchHandle.setTarget(localInstructionList.append(NOP));
}
public void desynthesize(ClassGenerator paramClassGenerator, MethodGenerator paramMethodGenerator)
{
InstructionList localInstructionList = paramMethodGenerator.getInstructionList();
_falseList.add(localInstructionList.append(new IFEQ(null)));
}
public FlowList getFalseList()
{
return _falseList;
}
public FlowList getTrueList()
{
return _trueList;
}
public void backPatchFalseList(InstructionHandle paramInstructionHandle)
{
_falseList.backPatch(paramInstructionHandle);
}
public void backPatchTrueList(InstructionHandle paramInstructionHandle)
{
_trueList.backPatch(paramInstructionHandle);
}
public MethodType lookupPrimop(SymbolTable paramSymbolTable, String paramString, MethodType paramMethodType)
{
Object localObject = null;
Vector localVector = paramSymbolTable.lookupPrimop(paramString);
if (localVector != null)
{
int i = localVector.size();
int j = Integer.MAX_VALUE;
for (int k = 0; k < i; k++)
{
MethodType localMethodType = (MethodType)localVector.elementAt(k);
if (localMethodType.argsCount() == paramMethodType.argsCount())
{
if (localObject == null) {
localObject = localMethodType;
}
int m = paramMethodType.distanceTo(localMethodType);
if (m < j)
{
j = m;
localObject = localMethodType;
}
}
}
}
return (MethodType)localObject;
}
}
/* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\com\sun\org\apache\xalan\internal\xsltc\compiler\Expression.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/