From 8c0870745b3bee55e2758ff5be4819c29efca4e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Thu, 12 Nov 2015 19:46:34 +0100 Subject: [PATCH] AS3 direct editation - public ns fix --- .../flash/abc/avm2/parser/script/ActionScript3Parser.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java index 573691e81..28870550a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java @@ -561,6 +561,7 @@ public class ActionScript3Parser { int originalPrivateNs = privateNs; boolean inPkg = pkg != null; int cpos = 0; + int emptyNs = 0; looptrait: while (true) { s = lex(); @@ -601,8 +602,9 @@ public class ActionScript3Parser { } else { openedNamespaces.add(packageInternalNs = abcIndex.getSelectedAbc().constants.getNamespaceId(Namespace.KIND_PACKAGE_INTERNAL, abcIndex.getSelectedAbc().constants.getStringId("", true), 0, true)); } + emptyNs = abcIndex.getSelectedAbc().constants.getNamespaceId(Namespace.KIND_PACKAGE, "", 0, true); if (pkg != null && !pkg.isEmpty()) { //add "" namespace if not already present - openedNamespaces.add(abcIndex.getSelectedAbc().constants.getNamespaceId(Namespace.KIND_PACKAGE, "", 0, true)); + openedNamespaces.add(emptyNs); } openedNamespaces.add(privateNs = abcIndex.getSelectedAbc().constants.addNamespace(new Namespace(Namespace.KIND_PRIVATE, abcIndex.getSelectedAbc().constants.getStringId(pkg == null ? "" : pkg.toRawString() + ":?"/* + nameStr*/, true)))); @@ -828,7 +830,7 @@ public class ActionScript3Parser { List staticInit = new ArrayList<>(); List sinit2Variables = new ArrayList<>(); List traits2 = new ArrayList<>(); - GraphTargetItem constr2 = traits(scriptName, false, sinit2Variables, staticNeedsActivation, staticInit, importedClasses, privateNs, protectedNs, publicNs, packageInternalNs, protectedStaticNs, subNamespaces, pkg, subNameStr, nisInterface, traits2); + GraphTargetItem constr2 = traits(scriptName, false, sinit2Variables, staticNeedsActivation, staticInit, importedClasses, privateNs, protectedNs, emptyNs, packageInternalNs, protectedStaticNs, subNamespaces, pkg, subNameStr, nisInterface, traits2); if (nisInterface) { traits.add(new InterfaceAVM2Item(metadata, importedClasses, pkg, subNamespaces, isFinal, namespace, subNameStr, interfaces, traits2));