stack.push(((VariableResolver) instruction.cache).getValue());
break;
case Operator.GETFIELD:
try {
if (stack.isEmpty() || !(stack.peek() instanceof Class)) {
throw new CompileException("getfield without class", expr, blockStart);
}
Field field;
if (instruction.cache == null) {
instruction.cache = field = ((Class) stack.pop()).getField(instruction.expr);
}
else {
stack.discard();
field = (Field) instruction.cache;
}
stack.push(field.get(stack.pop()));
}
catch (Exception e) {
throw new CompileException("field access error", expr, blockStart, e);
}
break;
case Operator.STOREFIELD:
try {
if (stack.isEmpty() || !(stack.peek() instanceof Class)) {
throw new CompileException("storefield without class", expr, blockStart);
}
Class cls = (Class) stack.pop();
Object val = stack.pop();
cls.getField(instruction.expr).set(stack.pop(), val);
stack.push(val);
}
catch (Exception e) {
throw new CompileException("field access error", expr, blockStart, e);
}
break;
case Operator.LDTYPE:
try {
if (instruction.cache == null) {
instruction.cache = ParseTools.createClass(instruction.expr, pCtx);
}
stack.push(instruction.cache);
}
catch (ClassNotFoundException e) {
throw new CompileException("error", expr, blockStart, e);
}
break;
case Operator.INVOKE:
Object[] parms;
ExecutionStack call = new ExecutionStack();
while (!stack.isEmpty() && !(stack.peek() instanceof Class)) {
call.push(stack.pop());
}
if (stack.isEmpty()) {
throw new CompileException("invoke without class", expr, blockStart);
}
parms = new Object[call.size()];
for (int i = 0; !call.isEmpty(); i++) parms[i] = call.pop();
if ("<init>".equals(instruction.expr)) {
Constructor c;
if (instruction.cache == null) {
instruction.cache = c = ParseTools.getBestConstructorCandidate(parms, (Class) stack.pop(), false);
}
else {
c = (Constructor) instruction.cache;
}
try {
stack.push(c.newInstance(parms));
}
catch (Exception e) {
throw new CompileException("instantiation error", expr, blockStart, e);
}
}
else {
Method m;
if (instruction.cache == null) {
Class cls = (Class) stack.pop();
instruction.cache = m = ParseTools.getBestCandidate(parms, instruction.expr, cls,
cls.getDeclaredMethods(), false);
}
else {
stack.discard();
m = (Method) instruction.cache;
}
try {
stack.push(m.invoke(stack.isEmpty() ? null : stack.pop(), parms));
}
catch (Exception e) {
throw new CompileException("invokation error", expr, blockStart, e);
}
}
break;
case Operator.PUSH:
if (instruction.cache == null) {