use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitDRETURN.
public void visitDRETURN(DRETURN instruction) {
Expression exp = context.getExpressions().pop();
Return ret = new Return(context.getCurrentInstruction(), exp);
processReturn(ret);
}
use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitSWAP.
public void visitSWAP(SWAP instruction) {
Expression one = context.getExpressions().pop();
Expression two = context.getExpressions().pop();
context.getExpressions().push(one);
context.getExpressions().push(two);
}
use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitFRETURN.
public void visitFRETURN(FRETURN instruction) {
Expression exp = context.getExpressions().pop();
Return ret = new Return(context.getCurrentInstruction(), exp);
processReturn(ret);
}
use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitNEWARRAY.
/**
* Decompiles "new primitive array" operations.
*/
public void visitNEWARRAY(NEWARRAY instruction) {
// first, check to see if the next instruction is a DUP. If so,
// this is probably a constant array value.
Expression count = context.getExpressions().pop();
ArrayCreation nai = null;
if (context.getCurrentInstruction().getNext().getInstruction() instanceof DUP) {
nai = new NewConstantArrayInstance(context.getCurrentInstruction(), instruction.getType(), count);
} else {
nai = new ArrayCreation(context.getCurrentInstruction(), instruction.getType(), count);
}
context.getExpressions().push(nai);
}
use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitINVOKESTATIC.
public void visitINVOKESTATIC(INVOKESTATIC instruction) {
// collect all parameters from the stack.
ConstantPoolGen cpg = context.getMethodGen().getConstantPool();
Type[] types = instruction.getArgumentTypes(context.getMethodGen().getConstantPool());
final List<Expression> parameters = new ArrayList<Expression>(types.length);
for (int i = 0, j = types.length; i < j; i++) {
Expression param = context.getExpressions().pop();
LOG.debug("Parameter: " + param);
parameters.add(param);
}
Resolved resolvedType = new Resolved(context.getCurrentInstruction(), Type.CLASS, instruction.getLoadClassType(cpg).getClassName());
String methodName = instruction.getMethodName(cpg);
// create the expression..
MethodInvocation methodInvocation = new MethodInvocation(context.getCurrentInstruction(), resolvedType, methodName, parameters);
Type returned = instruction.getReturnType(context.getMethodGen().getConstantPool());
if (returned == BasicType.VOID) {
LOG.debug("This is a void return type!!");
StatementIntermediate completeLine = new StatementIntermediate(context.getCurrentInstruction(), methodInvocation);
context.pushIntermediateToInstruction(completeLine);
} else {
context.getExpressions().push(methodInvocation);
}
}
Aggregations