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
stable
jochen 26 years ago
parent 8c947fef35
commit f2c8547aa3
  1. 18
      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;
}

Loading…
Cancel
Save