Mirror of the JODE repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
jode/jode/jode/decompiler/LocalVariableRangeList.java

68 lines
1.7 KiB

package jode;
import sun.tools.java.*;
public class LocalVariableRangeList implements LocalVariable {
class MyLocalInfo extends LocalInfo {
int start;
int length;
MyLocalInfo next;
MyLocalInfo(int slot, int s, int l, Identifier n, Type t) {
super (slot);
start = s;
length = l;
setName(n);
setType(t);
next = null;
}
}
MyLocalInfo list = null;
int slot;
LocalVariableRangeList(int slot) {
this.slot = slot;
}
private void add(MyLocalInfo li) {
MyLocalInfo before = null;
MyLocalInfo after = list;
while (after != null && after.start < li.start) {
before = after;
after = after.next;
}
if (after != null && li.start + li.length > after.start)
throw new AssertError("non disjoint locals");
li.next = after;
if (before == null)
list = li;
else
before.next = li;
}
private LocalInfo find(int addr) {
MyLocalInfo li = list;
while (li != null && addr > li.start+li.length)
li = li.next;
if (li == null || li.start > addr) {
LocalInfo temp = new LocalInfo(slot);
return temp;
}
return li;
}
public void addLocal(int start, int length,
Identifier name, Type type) {
MyLocalInfo li = new MyLocalInfo(slot,start,length,name,type);
add (li);
}
public LocalInfo getInfo(int addr) {
return find(addr);
}
public void combine(int addr1, int addr2) {
throw new AssertError("combine called on RangeList");
}
}