use of org.candle.decompiler.intermediate.expression.Resolved in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitSIPUSH.
public void visitSIPUSH(SIPUSH instruction) {
Resolved resolved = new Resolved(context.getCurrentInstruction(), Type.SHORT, instruction.getValue().toString());
context.getExpressions().push(resolved);
LOG.debug("Pushing: " + resolved);
}
use of org.candle.decompiler.intermediate.expression.Resolved in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitLCMP.
public void visitLCMP(LCMP instruction) {
Expression left = context.getExpressions().pop();
Expression right = context.getExpressions().pop();
MultiConditional eq = new MultiConditional(context.getCurrentInstruction(), left, right, OperationType.EQ);
MultiConditional logic = new MultiConditional(context.getCurrentInstruction(), left, right, OperationType.GREATER);
Resolved r0 = new Resolved(context.getCurrentInstruction(), Type.INT, "0");
Resolved rN = new Resolved(context.getCurrentInstruction(), Type.INT, "-1");
Resolved rP = new Resolved(context.getCurrentInstruction(), Type.INT, "1");
Ternary tern2 = new Ternary(context.getCurrentInstruction(), ObjectType.INT, logic, rP, rN);
Ternary tern1 = new Ternary(context.getCurrentInstruction(), Type.INT, eq, r0, tern2);
context.getExpressions().push(tern1);
}
use of org.candle.decompiler.intermediate.expression.Resolved in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitConversionInstruction.
public void visitConversionInstruction(ConversionInstruction instruction) {
ConstantPoolGen cpg = context.getMethodGen().getConstantPool();
Expression right = context.getExpressions().pop();
Type type = instruction.getType(cpg);
//now see what type it is.
LOG.debug("To Type: " + type);
Resolved resolve = new Resolved(context.getCurrentInstruction(), type, type.toString());
Cast cast = new Cast(context.getCurrentInstruction(), resolve, right);
context.getExpressions().push(cast);
}
use of org.candle.decompiler.intermediate.expression.Resolved in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitLDC2_W.
public void visitLDC2_W(LDC2_W instruction) {
//load from constant pool.
LOG.debug("Loading from constant pool" + instruction.getClass());
MethodGen mg = context.getMethodGen();
ConstantPoolGen cpg = mg.getConstantPool();
Type type = instruction.getType(cpg);
Object instructionValue = instruction.getValue(cpg);
if (Type.STRING == type) {
Expression resolved = new StringLiteral(context.getCurrentInstruction(), instructionValue.toString());
context.getExpressions().push(resolved);
return;
} else {
}
StringBuilder resolvedValue = new StringBuilder();
if (instructionValue instanceof ConstantClass) {
String clzName = getClassName((ConstantClass) instructionValue, cpg.getConstantPool());
resolvedValue.append(clzName);
} else {
resolvedValue.append(instructionValue.toString());
}
Expression resolved = new Resolved(context.getCurrentInstruction(), type, resolvedValue.toString());
context.getExpressions().push(resolved);
}
use of org.candle.decompiler.intermediate.expression.Resolved in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitIFGE.
@Override
public void visitIFGE(IFGE obj) {
Expression right = new Resolved(context.getCurrentInstruction(), null, "0");
Expression left = context.getExpressions().pop();
processMultiConditionalStatement(OperationType.GREATER_EQUAL, left, right);
}
Aggregations