From f13ae08bc9135db0d1920c0fd2454afc953179a0 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 28 Apr 1999 08:14:56 +0000 Subject: [PATCH] bug fix: declaration of assign expressions git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@664 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/SequentialBlock.java | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/jode/jode/flow/SequentialBlock.java b/jode/jode/flow/SequentialBlock.java index 80f7c5a..6f8b27f 100644 --- a/jode/jode/flow/SequentialBlock.java +++ b/jode/jode/flow/SequentialBlock.java @@ -19,6 +19,7 @@ package jode.flow; import jode.decompiler.TabbedPrintWriter; +import jode.decompiler.LocalInfo; import jode.expr.LocalStoreOperator; /** @@ -167,20 +168,19 @@ public class SequentialBlock extends StructuredBlock { public void makeDeclaration(VariableSet done) { if (subBlocks[0] instanceof InstructionBlock) { /* Special case: If the first block is an InstructionBlock, - * it can declare the variable it uses for us. - * - * 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. + * it can declare the variable it writes to in a special way + * and that declaration will last for the second sub block. */ - declare = new VariableSet(); - - subBlocks[0].makeDeclaration(done); - done.unionExact(subBlocks[0].declare); - subBlocks[1].makeDeclaration(done); - done.subtractExact(subBlocks[0].declare); - } else - super.makeDeclaration(done); + LocalInfo local = + ((InstructionBlock) subBlocks[0]).checkDeclaration(done); + if (local != null) { + done.addElement(local); + super.makeDeclaration(done); + done.removeElement(local); + return; + } + } + super.makeDeclaration(done); } public void dumpInstruction(TabbedPrintWriter writer)