merge not generated names when combining.

create name on call of guessName
use hashCode as name if it is not yet guessed


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@689 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 2b38935f4e
commit 8a6f9a9b91
  1. 29
      jode/jode/decompiler/LocalInfo.java

@ -39,7 +39,7 @@ public class LocalInfo {
private static int serialnr = 0;
private static int nextAnonymousSlot = -1;
private int slot;
private boolean nameIsGenerated;
private boolean nameIsGenerated = false;
private boolean isUnique;
private String name;
private Type type;
@ -93,6 +93,8 @@ public class LocalInfo {
} else {
if (this != li) {
shadow = li;
if (!nameIsGenerated)
shadow.name = li.name;
// GlobalOptions.err.println("combining "+name+"("+type+") and "
// +li.name+"("+li.type+")");
li.setType(type);
@ -149,15 +151,12 @@ public class LocalInfo {
return getLocalInfo().name != null;
}
/**
* Get the name of this local.
*/
public String getName() {
public String guessName() {
if (shadow != null) {
while (shadow.shadow != null) {
shadow = shadow.shadow;
}
return shadow.getName();
return shadow.guessName();
}
if (name == null) {
Enumeration enum = hints.elements();
@ -165,7 +164,7 @@ public class LocalInfo {
LocalVarEntry entry = (LocalVarEntry) enum.nextElement();
if (type.isOfType(entry.getType())) {
name = entry.getName();
type = entry.getType();
setType(entry.getType());
return name;
}
}
@ -181,6 +180,22 @@ public class LocalInfo {
return name;
}
/**
* Get the name of this local.
*/
public String getName() {
if (shadow != null) {
while (shadow.shadow != null) {
shadow = shadow.shadow;
}
return shadow.getName();
}
if (name == null) {
return "local_" + slot + "_"+ Integer.toHexString(hashCode());
}
return name;
}
public boolean isNameGenerated() {
return nameIsGenerated;
}

Loading…
Cancel
Save