Fixed AS3 interfaces - internal modifier on methods

This commit is contained in:
Jindra Petřík
2023-03-19 22:43:41 +01:00
parent f51d1d8ee2
commit a62f1c0626
3 changed files with 11 additions and 7 deletions
@@ -697,27 +697,28 @@ public class ActionScript3Parser {
case PUBLIC:
namespace = publicNs;
if (isInterface) {
throw new AVM2ParseException("Interface cannot have public, private or protected modifier", lexer.yyline());
throw new AVM2ParseException("Interface members cannot be declared public, private, protected, or internal", lexer.yyline());
}
break;
case PRIVATE:
isPrivate = true;
namespace = privateNs;
if (isInterface) {
throw new AVM2ParseException("Interface cannot have public, private or protected modifier", lexer.yyline());
throw new AVM2ParseException("Interface members cannot be declared public, private, protected, or internal", lexer.yyline());
}
break;
case PROTECTED:
namespace = protectedNs;
if (isInterface) {
throw new AVM2ParseException("Interface cannot have public, private or protected modifier", lexer.yyline());
throw new AVM2ParseException("Interface members cannot be declared public, private, protected, or internal", lexer.yyline());
}
break;
case INTERNAL:
namespace = packageInternalNs;
break;
if (isInterface) {
throw new AVM2ParseException("Interface members cannot be declared public, private, protected, or internal", lexer.yyline());
}
break;
case PREPROCESSOR:
if (((String)s.value).toLowerCase().equals("namespace")) {
expectedType(SymbolType.PARENT_OPEN);
@@ -349,7 +349,9 @@ public abstract class Trait implements Cloneable, Serializable {
Namespace ns = m.getNamespace(abc.constants);
if (ns.kind == Namespace.KIND_NAMESPACE && nsname == null && !insideInterface) {
if (insideInterface) {
//no namespace identifier
} else if (ns.kind == Namespace.KIND_NAMESPACE && nsname == null) {
writer.append("§§namespace(\"");
writer.append(Helper.escapeActionScriptString(ns.getRawName(abc.constants)));
writer.append("\") ");