Search in sources :

Example 16 with Resolved

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

the class MethodIntermediateVisitor method visitICONST.

public void visitICONST(ICONST instruction) {
    LOG.debug("Loading: " + instruction.getValue().toString());
    Resolved cons = new Resolved(context.getCurrentInstruction(), Type.INT, instruction.getValue().toString());
    context.getExpressions().push(cons);
}
Also used : Resolved(org.candle.decompiler.intermediate.expression.Resolved)

Example 17 with Resolved

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

the class MethodIntermediateVisitor method visitIFLT.

//Process all single-value conditionals.
@Override
public void visitIFLT(IFLT instruction) {
    Expression left = context.getExpressions().pop();
    //TODO: this should probably be resolved to it's left expression value for the resovled value.
    Expression right = new Resolved(context.getCurrentInstruction(), null, "0");
    processMultiConditionalStatement(OperationType.LESS, left, right);
}
Also used : TypedExpression(org.candle.decompiler.intermediate.expression.TypedExpression) Expression(org.candle.decompiler.intermediate.expression.Expression) Resolved(org.candle.decompiler.intermediate.expression.Resolved)

Example 18 with Resolved

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

the class MethodIntermediateVisitor method visitFCONST.

public void visitFCONST(FCONST instruction) {
    Resolved cons = new Resolved(context.getCurrentInstruction(), Type.FLOAT, instruction.getValue().toString());
    context.getExpressions().push(cons);
}
Also used : Resolved(org.candle.decompiler.intermediate.expression.Resolved)

Example 19 with Resolved

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

the class MethodIntermediateVisitor method visitDCONST.

public void visitDCONST(DCONST instruction) {
    Resolved cons = new Resolved(context.getCurrentInstruction(), Type.DOUBLE, instruction.getValue().toString());
    context.getExpressions().push(cons);
}
Also used : Resolved(org.candle.decompiler.intermediate.expression.Resolved)

Example 20 with Resolved

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

the class MethodIntermediateVisitor method visitGETSTATIC.

public void visitGETSTATIC(GETSTATIC instruction) {
    LOG.debug("Getting static..");
    MethodGen mg = context.getMethodGen();
    ConstantPoolGen cpg = mg.getConstantPool();
    String referencedClassName = instruction.getReferenceType(cpg).toString();
    String thisClassName = context.getJavaClass().getClassName();
    String resolved = null;
    if (StringUtils.equals(referencedClassName, thisClassName)) {
        resolved = instruction.getFieldName(cpg);
    } else {
        resolved = referencedClassName + "." + instruction.getFieldName(cpg);
    }
    Resolved cons = new Resolved(context.getCurrentInstruction(), instruction.getType(cpg), resolved);
    context.getExpressions().push(cons);
}
Also used : Resolved(org.candle.decompiler.intermediate.expression.Resolved)

Aggregations

Resolved (org.candle.decompiler.intermediate.expression.Resolved)20 Expression (org.candle.decompiler.intermediate.expression.Expression)11 TypedExpression (org.candle.decompiler.intermediate.expression.TypedExpression)10 ArithmeticType (org.candle.decompiler.intermediate.expression.ArithmeticType)4 OperationType (org.candle.decompiler.intermediate.expression.OperationType)4 ArrayList (java.util.ArrayList)2 ConstantClass (org.apache.bcel.classfile.ConstantClass)2 InstructionHandle (org.apache.bcel.generic.InstructionHandle)2 AbstractIntermediate (org.candle.decompiler.intermediate.code.AbstractIntermediate)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 ObjectType (org.apache.bcel.generic.ObjectType)1 Select (org.apache.bcel.generic.Select)1 CaseIntermediate (org.candle.decompiler.intermediate.code.CaseIntermediate)1 StatementIntermediate (org.candle.decompiler.intermediate.code.StatementIntermediate)1 Assignment (org.candle.decompiler.intermediate.expression.Assignment)1 Case (org.candle.decompiler.intermediate.expression.Case)1 Cast (org.candle.decompiler.intermediate.expression.Cast)1 ConstantArray (org.candle.decompiler.intermediate.expression.ConstantArray)1 Declaration (org.candle.decompiler.intermediate.expression.Declaration)1