From 19c90b0a4cbc8065c6fe504a04f54e9f0a2d4bf4 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 5 May 1999 20:55:29 +0000 Subject: [PATCH] Expression rework (ComplexExpression removed) not a CatchBlock any more git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@771 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/FinallyBlock.java | 43 ++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/jode/jode/flow/FinallyBlock.java b/jode/jode/flow/FinallyBlock.java index 111fe8d..f03a9e2 100644 --- a/jode/jode/flow/FinallyBlock.java +++ b/jode/jode/flow/FinallyBlock.java @@ -23,11 +23,50 @@ package jode.flow; * * @author Jochen Hoenicke */ -public class FinallyBlock extends CatchBlock { +public class FinallyBlock extends StructuredBlock { + /** + * The catch block. + */ + StructuredBlock subBlock; public FinallyBlock() { } + /** + * Sets the catch block. + * @param subBlock the catch block. + */ + public void setCatchBlock(StructuredBlock subBlock) { + this.subBlock = subBlock; + subBlock.outer = this; + subBlock.setFlowBlock(flowBlock); + } + + /* The implementation of getNext[Flow]Block is the standard + * implementation */ + + /** + * Replaces the given sub block with a new block. + * @param oldBlock the old sub block. + * @param newBlock the new sub block. + * @return false, if oldBlock wasn't a direct sub block. + */ + public boolean replaceSubBlock(StructuredBlock oldBlock, + StructuredBlock newBlock) { + if (subBlock == oldBlock) + subBlock = newBlock; + else + return false; + return true; + } + + /** + * Returns all sub block of this structured block. + */ + public StructuredBlock[] getSubBlocks() { + return new StructuredBlock[] { subBlock }; + } + /** * Returns the block where the control will normally flow to, when * the given sub block is finished (not ignoring the jump @@ -51,7 +90,7 @@ public class FinallyBlock extends CatchBlock { writer.print("finally"); writer.openBrace(); writer.tab(); - catchBlock.dumpSource(writer); + subBlock.dumpSource(writer); writer.untab(); } }