From 8732c43abee11be51270ff9223074aab695a46f0 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 28 Apr 1999 08:14:24 +0000 Subject: [PATCH] bug fix: declaration of assign expression git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@663 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/InstructionBlock.java | 33 +++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/jode/jode/flow/InstructionBlock.java b/jode/jode/flow/InstructionBlock.java index d910c58..35c3b6e 100644 --- a/jode/jode/flow/InstructionBlock.java +++ b/jode/jode/flow/InstructionBlock.java @@ -96,13 +96,13 @@ public class InstructionBlock extends InstructionContainer { return declare != null && !declare.isEmpty(); } + /** - * 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. + * Check if this is an local store instruction to a not yet declared + * variable. In that case mark this as declaration and return the + * variable. */ - public void makeDeclaration(VariableSet done) { + public LocalInfo checkDeclaration(VariableSet done) { if (instr.getOperator() instanceof LocalStoreOperator) { LocalInfo local = ((LocalStoreOperator) instr.getOperator()).getLocalInfo(); @@ -115,13 +115,26 @@ public class InstructionBlock extends InstructionContainer { if (instr instanceof ComplexExpression) ((ComplexExpression) instr) .getSubExpressions()[0].makeInitializer(); - done.addElement(local); - super.makeDeclaration(done); - done.removeElement(local); - return; + return local; } } - 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)