compiler: added support for abstract classes in ActionScript

When a developer attempts to instantiate an abstract class with the "new" keyword, the compiler will report an error. This is a compile time check for now, but emitters could hypothetically add runtime checks too.

The abstract modifier is allowed on classes only at this time, and trying to use it on other definitions, like interfaces, methods, and variables results in a syntax problem.

To enable abstract classes, use the new allow-abstract-classes compiler option. Support for abstract classes is disabled by default, meaning using this experimental new syntax is completely opt-in. Even if the syntax widely adopted, we should keep it disabled by default in the compiler to avoid syntax conflicts when using the compiler for code intelligence with other SDKs. To enable it by default for a particular SDK, modify the appropriate frameworks/*-config.xml file.

Behind the scenes, When the "abstract" keyword is encountered as a modifier on a class, [RoyaleAbstract] metadata is created. This allows bytecode to store whether a class is abstract, without actually having to update the bytecode format and runtimes that support it. The metadata also allows classes in libraries to remain abstract when compiled to SWC.
23 files changed