bug fix: declaration of assign expressions

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@664 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 8732c43abe
commit f13ae08bc9
  1. 26
      jode/jode/flow/SequentialBlock.java

@ -19,6 +19,7 @@
package jode.flow; package jode.flow;
import jode.decompiler.TabbedPrintWriter; import jode.decompiler.TabbedPrintWriter;
import jode.decompiler.LocalInfo;
import jode.expr.LocalStoreOperator; import jode.expr.LocalStoreOperator;
/** /**
@ -167,20 +168,19 @@ public class SequentialBlock extends StructuredBlock {
public void makeDeclaration(VariableSet done) { public void makeDeclaration(VariableSet done) {
if (subBlocks[0] instanceof InstructionBlock) { if (subBlocks[0] instanceof InstructionBlock) {
/* Special case: If the first block is an InstructionBlock, /* Special case: If the first block is an InstructionBlock,
* it can declare the variable it uses for us. * it can declare the variable it writes to in a special way
* * and that declaration will last for the second sub block.
* Now add the variables used in the first block to the done
* set of the second block, since the first sub block has
* declared them.
*/ */
declare = new VariableSet(); LocalInfo local =
((InstructionBlock) subBlocks[0]).checkDeclaration(done);
subBlocks[0].makeDeclaration(done); if (local != null) {
done.unionExact(subBlocks[0].declare); done.addElement(local);
subBlocks[1].makeDeclaration(done); super.makeDeclaration(done);
done.subtractExact(subBlocks[0].declare); done.removeElement(local);
} else return;
super.makeDeclaration(done); }
}
super.makeDeclaration(done);
} }
public void dumpInstruction(TabbedPrintWriter writer) public void dumpInstruction(TabbedPrintWriter writer)

Loading…
Cancel
Save