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. * any local Variable, but lets the first sub block do this.
*/ */
declare = new VariableSet(); 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 /* Second, tell the first sub block that he must declare all
* variables _we_ use. */ * variables _we_ use.
*/
subBlocks[0].used.unionExact(used); subBlocks[0].used.unionExact(used);
subBlocks[0].makeDeclaration(done); subBlocks[0].makeDeclaration(done);
/* Now add the variables to the done set, since the first
* sub block has declared them. /* Now add the variables used in the first block to the done
*/ * set of the second block, since the first sub block has
done.unionExact(used); * declared them. */
subBlocks[1].makeDeclaration(done); VariableSet doneFirst = (VariableSet) done.clone();
/* Now undo the change to done. Note that the second instruction doneFirst.unionExact(subBlocks[0].used);
* made done and used disjunct. subBlocks[1].makeDeclaration(doneFirst);
*/
done.subtractExact(used);
} }
public void dumpInstruction(TabbedPrintWriter writer) public void dumpInstruction(TabbedPrintWriter writer)

Loading…
Cancel
Save