Search in sources :

Example 6 with Expression

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

Example 7 with Expression

use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.

the class MethodIntermediateVisitor method visitDUP2_X2.

public void visitDUP2_X2(DUP2_X2 instruction) {
    Expression one = context.getExpressions().pop();
    Expression two = context.getExpressions().pop();
    Expression three = context.getExpressions().pop();
    Expression four = context.getExpressions().pop();
    //push on 1, 2
    context.getExpressions().push(two);
    context.getExpressions().push(one);
    //push on 1, 2, 3, 4
    context.getExpressions().push(four);
    context.getExpressions().push(three);
    context.getExpressions().push(two);
    context.getExpressions().push(one);
}
Also used : TypedExpression(org.candle.decompiler.intermediate.expression.TypedExpression) Expression(org.candle.decompiler.intermediate.expression.Expression)

Example 8 with Expression

use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.

the class MethodIntermediateVisitor method visitPUTFIELD.

public void visitPUTFIELD(PUTFIELD instruction) {
    ConstantPoolGen cpg = context.getMethodGen().getConstantPool();
    String fieldName = instruction.getFieldName(cpg);
    Expression right = context.getExpressions().pop();
    Expression left = context.getExpressions().pop();
    FieldAccess fieldRef = new FieldAccess(context.getCurrentInstruction(), left, fieldName);
    Assignment assignment = new Assignment(context.getCurrentInstruction(), fieldRef, right);
    StatementIntermediate complete = new StatementIntermediate(context.getCurrentInstruction(), assignment);
    context.pushIntermediateToInstruction(complete);
}
Also used : Assignment(org.candle.decompiler.intermediate.expression.Assignment) TypedExpression(org.candle.decompiler.intermediate.expression.TypedExpression) Expression(org.candle.decompiler.intermediate.expression.Expression) StatementIntermediate(org.candle.decompiler.intermediate.code.StatementIntermediate) FieldAccess(org.candle.decompiler.intermediate.expression.FieldAccess)

Example 9 with Expression

use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.

the class MethodIntermediateVisitor method handleSwitch.

public void handleSwitch() {
    Expression switchVal = context.getExpressions().pop();
    Switch switchExpression = new Switch(context.getCurrentInstruction(), switchVal);
    MultiBranchIntermediate mbi = new MultiBranchIntermediate(context.getCurrentInstruction(), switchExpression);
    context.pushIntermediateToInstruction(mbi);
}
Also used : Switch(org.candle.decompiler.intermediate.expression.Switch) TypedExpression(org.candle.decompiler.intermediate.expression.TypedExpression) Expression(org.candle.decompiler.intermediate.expression.Expression) MultiBranchIntermediate(org.candle.decompiler.intermediate.code.MultiBranchIntermediate)

Example 10 with Expression

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

Aggregations

Expression (org.candle.decompiler.intermediate.expression.Expression)52 TypedExpression (org.candle.decompiler.intermediate.expression.TypedExpression)46 Resolved (org.candle.decompiler.intermediate.expression.Resolved)11 StatementIntermediate (org.candle.decompiler.intermediate.code.StatementIntermediate)10 ArithmeticType (org.candle.decompiler.intermediate.expression.ArithmeticType)10 OperationType (org.candle.decompiler.intermediate.expression.OperationType)10 ArrayList (java.util.ArrayList)6 Assignment (org.candle.decompiler.intermediate.expression.Assignment)6 BooleanBranchIntermediate (org.candle.decompiler.intermediate.code.BooleanBranchIntermediate)5 Return (org.candle.decompiler.intermediate.expression.Return)5 ArrayAccess (org.candle.decompiler.intermediate.expression.ArrayAccess)4 GeneratedVariable (org.candle.decompiler.intermediate.expression.GeneratedVariable)4 MethodInvocation (org.candle.decompiler.intermediate.expression.MethodInvocation)4 MultiConditional (org.candle.decompiler.intermediate.expression.MultiConditional)4 Variable (org.candle.decompiler.intermediate.expression.Variable)4 IntermediateVariable (org.candle.decompiler.intermediate.IntermediateVariable)3 ArrayCreation (org.candle.decompiler.intermediate.expression.ArrayCreation)3 Declaration (org.candle.decompiler.intermediate.expression.Declaration)3 NewConstantArrayInstance (org.candle.decompiler.intermediate.expression.NewConstantArrayInstance)3 AbstractIntermediate (org.candle.decompiler.intermediate.code.AbstractIntermediate)2