-
Notifications
You must be signed in to change notification settings - Fork 4
Building a compiler: special cases
Strict mode (default) or ECMAScript mode.
Optional infer types option introduced by Apache Royale.
Infers for initializers and method result types.
Similiar to --source-path
in the MXML compiler, and optional main class file.
This form of reference lookup does not allow zero or more than one package definition in a file, and the definition at the package must match exactly the source path in the source tree.
Similiar to --include-sources
(recursive directory or specific file) and --doc-sources
in the MXML compiler.
This form of reference lookup allows multiple package definitions within a file.
HARMAN introduced additional forms of embedding data with encryption.
The Vector
class is treated in a special way for compatibility. The program or an external library defines the __AS3__.vec.Vector
class and the verifier automatically turns it into a generic class with a type parameter.
Code generation
An ActionScript 3 compiler should generate a multiname for a Vector
type with type arguments as follows:
TypeName(QName(PackageNamespace("__AS3__.vec"),"Vector")<QName(PackageNamespace(""),"Number")>)
An ActionScript 3 compiler should generate a Class
object for a Vector
type with type arguments as follows:
getlex QName(PackageNamespace("__AS3__.vec"),"Vector")
getlex QName(PackageNamespace(""),"Number")
applytype (1)
Remember of static protected
.
Used by MXML components for event handling. For example, consider the creationComplete="someCall()"
attribute in a XML file, containing zero or more directives.
Certain property attributes in MXML components may have values containing at most one braces group, containing a single expression that locates a bindable property.
Example from Apache Royale:
<j:TextInput id="databinding_ti">
<j:beads>
<j:TextPrompt prompt="Using databinding"/>
</j:beads>
</j:TextInput>
<j:Label text="The TextInput field text value is: {databinding_ti.text}"/>
What about string literals, in case you want to escape the braces? Supporting them might not be an issue.
Inline constants are replaced by their compile-time constant value.
CONFIG::DEBUG
package {
import flash.display.Sprite;
// Definitions may be nested in blocks.
{
public class Main extends Sprite {
{
protected var xy: *
}
}
}
}
var x: Number
{
class Example {
function f(): void {
// "x" is visible at this scope.
x
}
}
}
// "Example" is visible at this scope.
Example
Properties from imported packages, when fully qualified, shadow variable names in scope.
- Use a
xmlns
prefix assigned to the full package name with a trailling.*
sequence, as inxmlns:fb="foo.bar.*"
. - Use a
xmlns
prefix assigned to*
to import the top-level package. - Use the
import
directive in afx:Script
tag and refer lexically to a component in the MXML.
- The
Object
and*
data types are fully dynamic, thus they may be mixed freely in operations, such as addition, property and query operators and iteration. - There are
dynamic
classes, which allow for dynamic property operations and iteration.
In case it is necessary, the flash_proxy
namespace is defined as:
public namespace flash_proxy = "http://www.adobe.com/2006/actionscript/flash/proxy";