Search in sources :

Example 1 with FieldAccess

use of org.candle.decompiler.intermediate.expression.FieldAccess 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 2 with FieldAccess

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

the class MethodIntermediateVisitor method visitGETFIELD.

public void visitGETFIELD(GETFIELD instruction) {
    LOG.debug("Getting field..");
    Expression target = context.getExpressions().pop();
    MethodGen mg = context.getMethodGen();
    ConstantPoolGen cpg = mg.getConstantPool();
    FieldAccess ref = new FieldAccess(context.getCurrentInstruction(), target, instruction.getFieldName(cpg));
    context.getExpressions().push(ref);
}
Also used : TypedExpression(org.candle.decompiler.intermediate.expression.TypedExpression) Expression(org.candle.decompiler.intermediate.expression.Expression) FieldAccess(org.candle.decompiler.intermediate.expression.FieldAccess)

Aggregations

Expression (org.candle.decompiler.intermediate.expression.Expression)2 FieldAccess (org.candle.decompiler.intermediate.expression.FieldAccess)2 TypedExpression (org.candle.decompiler.intermediate.expression.TypedExpression)2 StatementIntermediate (org.candle.decompiler.intermediate.code.StatementIntermediate)1 Assignment (org.candle.decompiler.intermediate.expression.Assignment)1