allow second block to see all variables declared in first block

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

@ -100,22 +100,18 @@ public class SequentialBlock extends StructuredBlock {
* any local Variable, but lets the first sub block do this.
*/
declare = new VariableSet();
/* First we can forget any variable that is already declared.
*/
used.subtractExact(done);
/* Second, tell the first sub block that he must declare all
* variables _we_ use. */
* variables _we_ use.
*/
subBlocks[0].used.unionExact(used);
subBlocks[0].makeDeclaration(done);
/* Now add the variables to the done set, since the first
* sub block has declared them.
*/
done.unionExact(used);
subBlocks[1].makeDeclaration(done);
/* Now undo the change to done. Note that the second instruction
* made done and used disjunct.
*/
done.subtractExact(used);
/* 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. */
VariableSet doneFirst = (VariableSet) done.clone();
doneFirst.unionExact(subBlocks[0].used);
subBlocks[1].makeDeclaration(doneFirst);
}
public void dumpInstruction(TabbedPrintWriter writer)

Loading…
Cancel
Save