diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java index 185ab3996..16c444133 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java @@ -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); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index 9a15303bc..06962947a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -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