use of org.candle.decompiler.intermediate.expression.MultiConditional in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitIFNONNULL.
@Override
public void visitIFNONNULL(IFNONNULL instruction) {
Expression left = context.getExpressions().pop();
Expression right = new NullLiteral(context.getCurrentInstruction());
MultiConditional conditional = new MultiConditional(context.getCurrentInstruction(), left, right, OperationType.NE);
BooleanBranchIntermediate line = new BooleanBranchIntermediate(context.getCurrentInstruction(), conditional);
context.pushIntermediateToInstruction(line);
}
use of org.candle.decompiler.intermediate.expression.MultiConditional in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method processComparator.
protected void processComparator() {
Expression left = context.getExpressions().pop();
Expression right = context.getExpressions().pop();
MultiConditional conditional = new MultiConditional(context.getCurrentInstruction(), left, right, OperationType.EQ);
BooleanBranchIntermediate line = new BooleanBranchIntermediate(this.context.getCurrentInstruction(), conditional);
context.pushIntermediateToInstruction(line);
}
use of org.candle.decompiler.intermediate.expression.MultiConditional 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.MultiConditional in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitIFNULL.
@Override
public void visitIFNULL(IFNULL instruction) {
Expression left = context.getExpressions().pop();
Expression right = new NullLiteral(context.getCurrentInstruction());
MultiConditional conditional = new MultiConditional(context.getCurrentInstruction(), left, right, OperationType.EQ);
BooleanBranchIntermediate line = new BooleanBranchIntermediate(context.getCurrentInstruction(), conditional);
context.pushIntermediateToInstruction(line);
}
use of org.candle.decompiler.intermediate.expression.MultiConditional in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method processMultiConditionalStatement.
public void processMultiConditionalStatement(OperationType operation, Expression left, Expression right) {
MultiConditional conditional = new MultiConditional(context.getCurrentInstruction(), left, right, operation);
//context.getExpressions().push(conditional);
BooleanBranchIntermediate line = new BooleanBranchIntermediate(this.context.getCurrentInstruction(), conditional);
//check to see whether you need to negate.
//if the conditional's target is greater than the conditional's next statement, don't negate.
BranchHandle branchHandle = (BranchHandle) context.getCurrentInstruction();
int next = branchHandle.getNext().getPosition();
int target = branchHandle.getTarget().getPosition();
//Important. Make sure the expression "true" is pointed towards the lower branch.
if (target > next) {
line.getExpression().negate();
}
context.pushIntermediateToInstruction(line);
}
Aggregations