check for combineable operator

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@182 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent a06934e1fb
commit 47b3820f0d
  1. 3
      jode/jode/flow/CombineIfGotoExpressions.java
  2. 3
      jode/jode/flow/CreateExpression.java
  3. 2
      jode/jode/flow/CreateForInitializer.java
  4. 8
      jode/jode/flow/FlowBlock.java

@ -44,7 +44,8 @@ public class CombineIfGotoExpressions {
return false;
Expression expr = ib.getInstruction();
if (lastCombined.canCombine(expr) + e[1].canCombine(expr) <= 0)
if (!(expr.getOperator() instanceof CombineableOperator)
|| lastCombined.canCombine(expr) + e[1].canCombine(expr) <= 0)
/* Tricky, the above is true, iff one of the two
* Expressions conflict, or both fail. */
return false;

@ -72,11 +72,12 @@ public class CreateExpression {
Expression expr =
((InstructionBlock) sequBlock.subBlocks[0]).getInstruction();
if (!expr.isVoid()) {
if (--i == 0)
break;
} else if (lastExpression == null
|| !(expr.getOperator()
instanceof CombineableOperator)
|| lastExpression.canCombine(expr) <= 0)
return false;

@ -41,6 +41,8 @@ public class CreateForInitializer {
InstructionBlock init = (InstructionBlock) sequBlock.subBlocks[0];
if (!init.getInstruction().isVoid()
|| !(init.getInstruction().getOperator()
instanceof CombineableOperator)
|| !forBlock.conditionMatches(init))
return false;

@ -21,6 +21,7 @@ package jode.flow;
import java.util.*;
import jode.*;
import jode.decompiler.Expression;
import jode.decompiler.CombineableOperator;
/**
* A flow block is the structure of which the flow graph consists. A
@ -783,9 +784,10 @@ public class FlowBlock {
}
if (!createdForBlock
&& ((InstructionBlock)
lastModified).getInstruction().isVoid()) {
&& (((InstructionBlock)
lastModified).getInstruction().getOperator()
instanceof CombineableOperator)) {
/* The only jump is the jump of the last
* instruction lastModified, there is a big
* chance, that this is a for block, but we

Loading…
Cancel
Save