mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 11:30:54 +00:00
Issue #1019 Namespace imports fix
This commit is contained in:
@@ -126,27 +126,34 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
return writer;
|
||||
}
|
||||
|
||||
protected DottedChain findCustomNs(int link_ns_index, ABC abc) {
|
||||
String nsname = "";
|
||||
if (link_ns_index <= 0) {
|
||||
return null;
|
||||
}
|
||||
DottedChain name = abc.constants.getNamespace(link_ns_index).getName(abc.constants);
|
||||
for (ABCContainerTag abcTag : abc.getAbcTags()) {
|
||||
DottedChain dc = abcTag.getABC().nsValueToName(name);
|
||||
nsname = dc.getLast();
|
||||
|
||||
if (nsname == null) {
|
||||
break;
|
||||
}
|
||||
if (!nsname.isEmpty()) {
|
||||
return dc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public GraphTextWriter getModifiers(ABC abc, boolean isStatic, GraphTextWriter writer) {
|
||||
if ((kindFlags & ATTR_Override) > 0) {
|
||||
writer.appendNoHilight("override ");
|
||||
}
|
||||
Multiname m = getName(abc);
|
||||
if (m != null) {
|
||||
String nsname = "";
|
||||
for (ABCContainerTag abcTag : abc.getAbcTags()) {
|
||||
if (m.namespace_index == -1) {
|
||||
break;
|
||||
}
|
||||
DottedChain dc = abcTag.getABC().nsValueToName(abc.constants.getNamespace(m.namespace_index).getName(abc.constants));
|
||||
nsname = dc.getLast();
|
||||
|
||||
if (nsname == null) {
|
||||
break;
|
||||
}
|
||||
if (!nsname.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
DottedChain dc = findCustomNs(m.namespace_index, abc);
|
||||
String nsname = dc != null ? dc.getLast() : null;
|
||||
|
||||
Namespace ns = m.getNamespace(abc.constants);
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
newimport = oldimport.add(name);
|
||||
}
|
||||
|
||||
if (newimport.isEmpty()) {
|
||||
if (!newimport.isEmpty()) {
|
||||
/* if(ns.kind==Namespace.KIND_PACKAGE){
|
||||
newimport+=".*";
|
||||
}*/
|
||||
@@ -169,16 +169,13 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
name = "*";
|
||||
}
|
||||
DottedChain newimport = ns.getName(abc.constants);
|
||||
|
||||
if (parseUsagesFromNS(abc, imports, uses, namespace_index, ignorePackage, name)) {
|
||||
return;
|
||||
} else if ((ns.kind != Namespace.KIND_PACKAGE) && (ns.kind != Namespace.KIND_PACKAGE_INTERNAL)) {
|
||||
return;
|
||||
}
|
||||
newimport = newimport.add(name);
|
||||
//WUT?
|
||||
/*if (newimport.contains(":")) {
|
||||
return;
|
||||
}*/
|
||||
if (!imports.contains(newimport)) {
|
||||
DottedChain pkg = newimport.getWithoutLast(); //.substring(0, newimport.lastIndexOf('.'));
|
||||
if (pkg.equals(InitVectorAVM2Item.VECTOR_PACKAGE)) { //special case - is imported always
|
||||
|
||||
Reference in New Issue
Block a user