bug fix: declaration of assign expression

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

@ -96,13 +96,13 @@ public class InstructionBlock extends InstructionContainer {
return declare != null && !declare.isEmpty(); return declare != null && !declare.isEmpty();
} }
/** /**
* Make the declarations, i.e. initialize the declare variable * Check if this is an local store instruction to a not yet declared
* to correct values. This will declare every variable that * variable. In that case mark this as declaration and return the
* is marked as used, but not done. * variable.
* @param done The set of the already declare variables.
*/ */
public void makeDeclaration(VariableSet done) { public LocalInfo checkDeclaration(VariableSet done) {
if (instr.getOperator() instanceof LocalStoreOperator) { if (instr.getOperator() instanceof LocalStoreOperator) {
LocalInfo local = LocalInfo local =
((LocalStoreOperator) instr.getOperator()).getLocalInfo(); ((LocalStoreOperator) instr.getOperator()).getLocalInfo();
@ -115,13 +115,26 @@ public class InstructionBlock extends InstructionContainer {
if (instr instanceof ComplexExpression) if (instr instanceof ComplexExpression)
((ComplexExpression) instr) ((ComplexExpression) instr)
.getSubExpressions()[0].makeInitializer(); .getSubExpressions()[0].makeInitializer();
done.addElement(local); return local;
super.makeDeclaration(done);
done.removeElement(local);
return;
} }
} }
super.makeDeclaration(done); return null;
}
/**
* Make the declarations, i.e. initialize the declare variable
* to correct values. This will declare every variable that
* is marked as used, but not done.
* @param done The set of the already declare variables.
*/
public void makeDeclaration(VariableSet done) {
LocalInfo local = checkDeclaration(done);
if (local != null) {
done.addElement(local);
super.makeDeclaration(done);
done.removeElement(local);
} else
super.makeDeclaration(done);
} }
public void dumpInstruction(TabbedPrintWriter writer) public void dumpInstruction(TabbedPrintWriter writer)

Loading…
Cancel
Save