mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-12 14:41:54 +00:00
do not copy big byte arrays, store only references (ByteArrayRange) e.g in image tags
This commit is contained in:
@@ -241,34 +241,34 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
return getMultinameAtPos(getCaretPosition());
|
||||
}
|
||||
|
||||
public int getLocalDeclarationOfPos(int pos,Reference<String> type) {
|
||||
public int getLocalDeclarationOfPos(int pos, Reference<String> type) {
|
||||
Highlighting sh = Highlighting.search(specialHighlights, pos);
|
||||
Highlighting h = Highlighting.search(highlights, pos);
|
||||
|
||||
if (h == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
List<Highlighting> tms = Highlighting.searchAll(methodHighlights, pos, null, null, -1, -1);
|
||||
if (tms.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
for (Highlighting tm : tms) {
|
||||
|
||||
List<Highlighting> tm_tms = Highlighting.searchAll(methodHighlights, -1, "index", tm.getPropertyString("index"), -1, -1);
|
||||
List<Highlighting> tm_tms = Highlighting.searchAll(methodHighlights, -1, "index", tm.getPropertyString("index"), -1, -1);
|
||||
//is it already declaration?
|
||||
if ("true".equals(h.getPropertyString("declaration")) || (sh != null && "true".equals(sh.getPropertyString("declaration")))) {
|
||||
return -1; //no jump
|
||||
}
|
||||
|
||||
String lname=h.getPropertyString("localName");
|
||||
if("this".equals(lname)){
|
||||
Highlighting ch= Highlighting.search(classHighlights, pos);
|
||||
int cindex=(int)(long)ch.getPropertyLong("index");
|
||||
type.setVal(abc.instance_info.get(cindex).getName(abc.constants).getNameWithNamespace(abc.constants, true));
|
||||
String lname = h.getPropertyString("localName");
|
||||
if ("this".equals(lname)) {
|
||||
Highlighting ch = Highlighting.search(classHighlights, pos);
|
||||
int cindex = (int) (long) ch.getPropertyLong("index");
|
||||
type.setVal(abc.instance_info.get(cindex).getName(abc.constants).getNameWithNamespace(abc.constants, true));
|
||||
return ch.startPos;
|
||||
}
|
||||
|
||||
|
||||
Map<String, String> search = h.getProperties();
|
||||
search.remove("index");
|
||||
search.remove("subtype");
|
||||
@@ -293,50 +293,51 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean getPropertyTypeAtPos(int pos, Reference<Integer> abcIndex,Reference<Integer> classIndex, Reference<Integer> traitIndex, Reference<Boolean> classTrait, Reference<Integer> multinameIndex){
|
||||
|
||||
int m = getMultinameAtPos(pos,true);
|
||||
public boolean getPropertyTypeAtPos(int pos, Reference<Integer> abcIndex, Reference<Integer> classIndex, Reference<Integer> traitIndex, Reference<Boolean> classTrait, Reference<Integer> multinameIndex) {
|
||||
|
||||
int m = getMultinameAtPos(pos, true);
|
||||
if (m <= 0) {
|
||||
return false;
|
||||
}
|
||||
SyntaxDocument sd=(SyntaxDocument)getDocument();
|
||||
Token t = sd.getTokenAt(pos+1);
|
||||
SyntaxDocument sd = (SyntaxDocument) getDocument();
|
||||
Token t = sd.getTokenAt(pos + 1);
|
||||
Token lastToken = t;
|
||||
Token prev = null;
|
||||
while(t.type == TokenType.IDENTIFIER || t.type == TokenType.KEYWORD || t.type == TokenType.REGEX){
|
||||
Token prev = null;
|
||||
while (t.type == TokenType.IDENTIFIER || t.type == TokenType.KEYWORD || t.type == TokenType.REGEX) {
|
||||
prev = sd.getPrevToken(t);
|
||||
if(prev!=null){
|
||||
if(!".".equals(prev.getString(sd))){
|
||||
break;
|
||||
if (prev != null) {
|
||||
if (!".".equals(prev.getString(sd))) {
|
||||
break;
|
||||
}
|
||||
t = sd.getPrevToken(prev);
|
||||
}else{
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(t.type != TokenType.IDENTIFIER && t.type != TokenType.KEYWORD || t.type == TokenType.REGEX){
|
||||
if (t.type != TokenType.IDENTIFIER && t.type != TokenType.KEYWORD || t.type == TokenType.REGEX) {
|
||||
return false;
|
||||
}
|
||||
Reference<String> locTypeRef = new Reference<>("");
|
||||
getLocalDeclarationOfPos(t.start,locTypeRef);
|
||||
String currentType=locTypeRef.getVal();
|
||||
if(currentType.equals("*")){
|
||||
return false;
|
||||
}
|
||||
boolean found=false;
|
||||
Reference<String> locTypeRef = new Reference<>("");
|
||||
getLocalDeclarationOfPos(t.start, locTypeRef);
|
||||
String currentType = locTypeRef.getVal();
|
||||
if (currentType.equals("*")) {
|
||||
return false;
|
||||
}
|
||||
boolean found = false;
|
||||
t = sd.getNextToken(t);
|
||||
while(t!=lastToken && !currentType.equals("*")){
|
||||
while (t != lastToken && !currentType.equals("*")) {
|
||||
t = sd.getNextToken(t);
|
||||
String ident=t.getString(sd);
|
||||
String ident = t.getString(sd);
|
||||
found = false;
|
||||
loopi:for(int i=0;i<abcList.size();i++){
|
||||
loopi:
|
||||
for (int i = 0; i < abcList.size(); i++) {
|
||||
ABC a = abcList.get(i).getABC();
|
||||
int cindex=a.findClassByName(currentType);
|
||||
if(cindex>-1){
|
||||
int cindex = a.findClassByName(currentType);
|
||||
if (cindex > -1) {
|
||||
InstanceInfo ii = a.instance_info.get(cindex);
|
||||
for(int j=0;j<ii.instance_traits.traits.size();j++){
|
||||
for (int j = 0; j < ii.instance_traits.traits.size(); j++) {
|
||||
Trait tr = ii.instance_traits.traits.get(j);
|
||||
if(ident.equals(tr.getName(a).getName(a.constants, new ArrayList<String>(), false /*NOT RAW!*/))){
|
||||
if (ident.equals(tr.getName(a).getName(a.constants, new ArrayList<String>(), false /*NOT RAW!*/))) {
|
||||
classIndex.setVal(cindex);
|
||||
abcIndex.setVal(i);
|
||||
traitIndex.setVal(j);
|
||||
@@ -347,11 +348,11 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
break loopi;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ClassInfo ci = a.class_info.get(cindex);
|
||||
for(int j=0;j<ci.static_traits.traits.size();j++){
|
||||
for (int j = 0; j < ci.static_traits.traits.size(); j++) {
|
||||
Trait tr = ci.static_traits.traits.get(j);
|
||||
if(ident.equals(tr.getName(a).getName(a.constants, new ArrayList<String>(), false /*NOT RAW!*/))){
|
||||
if (ident.equals(tr.getName(a).getName(a.constants, new ArrayList<String>(), false /*NOT RAW!*/))) {
|
||||
classIndex.setVal(cindex);
|
||||
abcIndex.setVal(i);
|
||||
traitIndex.setVal(j);
|
||||
@@ -364,22 +365,22 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!found){
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
t = sd.getNextToken(t);
|
||||
if(!".".equals(t.getString(sd))){
|
||||
if (!".".equals(t.getString(sd))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public int getMultinameAtPos(int pos) {
|
||||
return getMultinameAtPos(pos, false);
|
||||
}
|
||||
|
||||
|
||||
public int getMultinameAtPos(int pos, boolean codeOnly) {
|
||||
Highlighting tm = Highlighting.search(methodHighlights, pos);
|
||||
Trait currentTrait = null;
|
||||
@@ -408,11 +409,11 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
lastIns = ins;
|
||||
}
|
||||
if (selIns != null) {
|
||||
if (!codeOnly && ((selIns.definition instanceof ConstructSuperIns) || (selIns.definition instanceof CallSuperIns)|| (selIns.definition instanceof CallSuperVoidIns))) {
|
||||
if (!codeOnly && ((selIns.definition instanceof ConstructSuperIns) || (selIns.definition instanceof CallSuperIns) || (selIns.definition instanceof CallSuperVoidIns))) {
|
||||
Highlighting tc = Highlighting.search(classHighlights, pos);
|
||||
if(tc!=null){
|
||||
int cindex = (int)(long)tc.getPropertyLong("index");
|
||||
if(cindex>-1){
|
||||
if (tc != null) {
|
||||
int cindex = (int) (long) tc.getPropertyLong("index");
|
||||
if (cindex > -1) {
|
||||
return abc.instance_info.get(cindex).super_index;
|
||||
}
|
||||
}
|
||||
@@ -425,21 +426,20 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(codeOnly){
|
||||
|
||||
}
|
||||
if (codeOnly) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Highlighting ch = Highlighting.search(classHighlights, pos);
|
||||
if(ch!=null){
|
||||
if (ch != null) {
|
||||
Highlighting th = Highlighting.search(traitHighlights, pos);
|
||||
if (th != null) {
|
||||
currentTrait = abc.findTraitByTraitId((int) (long) ch.getPropertyLong("index"), (int) (long) th.getPropertyLong("index"));
|
||||
currentTrait = abc.findTraitByTraitId((int) (long) ch.getPropertyLong("index"), (int) (long) th.getPropertyLong("index"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (currentTrait instanceof TraitMethodGetterSetter) {
|
||||
currentMethod = ((TraitMethodGetterSetter) currentTrait).method_info;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user