diff --git a/CHANGELOG.md b/CHANGELOG.md index cdc8b89bc..7817ddc9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file. - AS3 direct editation - namespace definition without explicit value - AS3 direct editation - var/const outside package - AS3 interfaces - internal modifier on methods +- AS3 direct editation - interface method namespace ### Changed - AS1/2/3 P-code - format Number values with EcmaScript toString function 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 3b19824cd..b5f9c734f 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 @@ -626,6 +626,8 @@ public class ActionScript3Parser { NamespaceItem protectedNs = new NamespaceItem(pkg.name.toRawString().isEmpty() ? classNameStr : pkg.name.toRawString() + ":" + classNameStr, Namespace.KIND_PROTECTED); NamespaceItem staticProtectedNs = new NamespaceItem(pkg.name.toRawString().isEmpty() ? classNameStr : pkg.name.toRawString() + ":" + classNameStr, Namespace.KIND_STATIC_PROTECTED); NamespaceItem packageInternalNs = new NamespaceItem(pkg.name, Namespace.KIND_PACKAGE_INTERNAL); + NamespaceItem interfaceNs = new NamespaceItem(pkg.name.toRawString().isEmpty() ? classNameStr : pkg.name.toRawString() + ":" + classNameStr, Namespace.KIND_NAMESPACE); + openedNamespaces = new ArrayList<>(openedNamespaces); allOpenedNamespaces.add(openedNamespaces); @@ -690,6 +692,9 @@ public class ActionScript3Parser { throw new AVM2ParseException("Cannot compile native code", lexer.yyline()); } else if (s.group == SymbolGroup.IDENTIFIER) { customNs = s.value.toString(); + if (isInterface) { + throw new AVM2ParseException("Namespace attributes are not permitted on interface methods", lexer.yyline()); + } } else if (namespace != null) { throw new AVM2ParseException("Only one access identifier allowed", lexer.yyline()); } @@ -733,6 +738,11 @@ public class ActionScript3Parser { } s = lex(); } + + if (isInterface) { + namespace = interfaceNs; + } + if (namespace == null && customNs == null) { namespace = packageInternalNs; } @@ -799,7 +809,7 @@ public class ActionScript3Parser { } else { lexer.pushback(s); } - + MethodAVM2Item ft = method(allOpenedNamespaces, outsidePackage, isPrivate, metadata, namespace, isInterface, customNs, new Reference<>(false), importedClasses, isOverride, isFinal, thisType, openedNamespaces, isStatic, fname, true, new ArrayList<>()); if (isGetter) {