|
|
@ -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) |
|
|
|