From f2c8547aa3db6ebe6b2a2f8c19ee5d7271b06619 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 28 Apr 1999 09:21:34 +0000 Subject: [PATCH] merge only locals with same name or generated name git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@672 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/StructuredBlock.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/jode/jode/flow/StructuredBlock.java b/jode/jode/flow/StructuredBlock.java index c26ce2c..9d50e8c 100644 --- a/jode/jode/flow/StructuredBlock.java +++ b/jode/jode/flow/StructuredBlock.java @@ -426,6 +426,12 @@ public abstract class StructuredBlock { while (enum.hasMoreElements()) { LocalInfo local = (LocalInfo) enum.nextElement(); + /* First generate the names for the locals, since this may + * also change their types, if they are in the local + * variable table. + */ + String localName = local.getName(); + // Merge with all locals in this block, that use the same // slot and have compatible type. int size = done.size(); @@ -442,11 +448,17 @@ public abstract class StructuredBlock { * of prevLocal (it has already a name) doesn't match * the intersected type. * - * A special case: this mustn't be merged, since it is - * special. "this" can't be assigned to. + * We don't want to merge variables, whose names are + * not generated by us and differ. + * + * And don't merge "this" with any other variable + * since it mustn't be written to. */ if (prevLocal.getType().isOfType(local.getType()) - && prevLocal.getName() != "this") { + && prevLocal.getName() != "this" + && (!prevLocal.isNameGenerated() + || !local.isNameGenerated() + || localName.equals(prevLocal.getName()))) { local.combineWith(prevLocal); continue next_used; }