From a3d73608cba6b0926a1f711a0bc31acc7bcb7ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 21 Feb 2021 07:53:50 +0100 Subject: [PATCH] Fixed: #1610 AS3 unnecessary adding namespaces --- CHANGELOG.md | 1 + .../flash/abc/types/traits/TraitClass.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e58948af..2b49d545c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ All notable changes to this project will be documented in this file. - Graphviz Graph not showing AS3 exception end - #1609 First frame missing in frame to PDF export - AS3 with statement decompilation +- AS3 unnecessary adding namespaces ### Changed - #1565, #1407, #1350 On BinaryData SWF save, parent SWF is saved 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 1cb18b8e4..8f48b3d41 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 @@ -217,7 +217,17 @@ public class TraitClass extends Trait implements TraitWithSlot { AbcIndexing index = new AbcIndexing(abc.getSwf()); //for simplification of String(this) - convertData.thisHasDefaultToPrimitive = null == index.findProperty(new AbcIndexing.PropertyDef("toString", new TypeItem(instanceInfo.getName(abc.constants).getNameWithNamespace(abc.constants, true)), abc, abc.constants.getNamespaceId(Namespace.KIND_PACKAGE, DottedChain.TOPLEVEL, abc.constants.getStringId("", true), true)), false, true); + int sIndex = abc.constants.getStringId("", false); + if (sIndex > -1) { + int nsIndex = abc.constants.getNamespaceId(Namespace.KIND_PACKAGE, DottedChain.TOPLEVEL, sIndex, false); + if (nsIndex > -1) { + convertData.thisHasDefaultToPrimitive = null == index.findProperty(new AbcIndexing.PropertyDef("toString", new TypeItem(instanceInfo.getName(abc.constants).getNameWithNamespace(abc.constants, true)), abc, nsIndex), false, true); + } else { + convertData.thisHasDefaultToPrimitive = true; + } + } else { + convertData.thisHasDefaultToPrimitive = true; + } //class initializer int bodyIndex = abc.findBodyIndex(classInfo.cinit_index);