Search in sources :

Example 1 with Ternary

use of org.candle.decompiler.intermediate.expression.Ternary 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);
}
Also used : TypedExpression(org.candle.decompiler.intermediate.expression.TypedExpression) Expression(org.candle.decompiler.intermediate.expression.Expression) Ternary(org.candle.decompiler.intermediate.expression.Ternary) Resolved(org.candle.decompiler.intermediate.expression.Resolved) MultiConditional(org.candle.decompiler.intermediate.expression.MultiConditional)

Aggregations

Expression (org.candle.decompiler.intermediate.expression.Expression)1 MultiConditional (org.candle.decompiler.intermediate.expression.MultiConditional)1 Resolved (org.candle.decompiler.intermediate.expression.Resolved)1 Ternary (org.candle.decompiler.intermediate.expression.Ternary)1 TypedExpression (org.candle.decompiler.intermediate.expression.TypedExpression)1