From d85f0d254eb7e01c2aee806b13b9848dd388f8fe Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 7 Feb 1999 19:35:54 +0000 Subject: [PATCH] copy jumps git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@210 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/StructuredBlock.java | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/jode/jode/flow/StructuredBlock.java b/jode/jode/flow/StructuredBlock.java index 0e348ec..187d371 100644 --- a/jode/jode/flow/StructuredBlock.java +++ b/jode/jode/flow/StructuredBlock.java @@ -271,6 +271,20 @@ public abstract class StructuredBlock { } } + /** + * This function copies the jump to this block. + * If the given jump is null, nothing bad happens. + * @param jump The jump that should be moved, may be null. + */ + public void copyJump(Jump jump) { + if (this.jump != null) + throw new AssertError("overriding with moveJump()"); + if (jump != null) { + this.jump = new Jump(jump); + this.jump.prev = this; + } + } + /** * Appends a block to this block. * @return the new combined block. @@ -309,12 +323,18 @@ public abstract class StructuredBlock { } /** - * Determines if there is a sub block, that flows through to the end - * of this block. If this returns true, you know that jump is null. + * Determines if there is a path, that flows through the end + * of this block. If there is such a path, it is forbidden to + * change the control flow in after this block and this method + * returns false. * @return true, if the jump may be safely changed. */ + public boolean flowMayBeChanged() { + return jump != null || jumpMayBeChanged(); + } + public boolean jumpMayBeChanged() { - return false; + return false; } public VariableSet propagateUsage() { @@ -501,7 +521,7 @@ public abstract class StructuredBlock { try { java.io.StringWriter strw = new java.io.StringWriter(); jode.TabbedPrintWriter writer = - new jode.TabbedPrintWriter(strw, " "); + new jode.TabbedPrintWriter(strw); writer.println(super.toString()); writer.tab(); dumpSource(writer);