use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.
the class ArrayForToEnhancedFor method firstMatchesGeneratedVariables.
private boolean firstMatchesGeneratedVariables(StatementIntermediate first, GeneratedVariable generatedArrayRef, GeneratedVariable generatedArrayIterator) {
Declaration childDeclaration = (Declaration) first.getExpression();
Expression right = childDeclaration.getAssignment().getRightHandSide();
if (right instanceof ArrayAccess) {
ArrayAccess apr = (ArrayAccess) right;
if (!(apr.getIndex() instanceof Variable)) {
return false;
}
if (!(apr.getArray() instanceof Variable)) {
return false;
}
// cast both to variable. check the variables match the name and type of the ones found above.
Variable arrayPosition = (Variable) apr.getArray();
Variable arrayRef = (Variable) apr.getArray();
if (!StringUtils.equals(arrayPosition.getName(), generatedArrayIterator.getName())) {
return false;
}
if (!StringUtils.equals(arrayRef.getName(), generatedArrayRef.getName())) {
return false;
}
return true;
}
return true;
}
use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitLRETURN.
public void visitLRETURN(LRETURN instruction) {
Expression exp = context.getExpressions().pop();
Return ret = new Return(context.getCurrentInstruction(), exp);
processReturn(ret);
}
use of org.candle.decompiler.intermediate.expression.Expression in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitDUP.
// Now provide the suplication visitors
public void visitDUP(DUP instruction) {
Expression exp = context.getExpressions().pop();
try {
Expression dup = (Expression) exp.clone();
dup.setInstructionHandle(context.getCurrentInstruction());
context.getExpressions().push(dup);
context.getExpressions().push(exp);
} catch (CloneNotSupportedException e) {
LOG.error("Exception duplicating expression: " + exp.toString(), e);
}
}
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);
}
use of org.candle.decompiler.intermediate.expression.Expression 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);
}
Aggregations