use of org.candle.decompiler.intermediate.expression.ConstructorInvocation in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitINVOKESPECIAL.
public void visitINVOKESPECIAL(INVOKESPECIAL instruction) {
LOG.debug("Invoking special.");
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);
}
// now, get the target that we are calling the method on.
Expression target = context.getExpressions().pop();
// collect the method name we are calling.
String methodName = instruction.getMethodName(context.getMethodGen().getConstantPool());
MethodInvocation methodInvocation = null;
// create the expression..
if (StringUtils.equals(Constants.CONSTRUCTOR_NAME, methodName)) {
LOG.debug(target.getClass());
// TODO: Figure out why the dup / new causes issues.
if (target instanceof NewInstance) {
// get rid of this.
context.getExpressions().pop();
}
methodInvocation = new ConstructorInvocation(context.getCurrentInstruction(), target, methodName, parameters);
} else {
methodInvocation = new MethodInvocation(context.getCurrentInstruction(), target, methodName, parameters);
}
LOG.debug("Pushing: " + methodInvocation);
context.getExpressions().push(methodInvocation);
}
Aggregations