...
key | description | type | |||||
---|---|---|---|---|---|---|---|
caller.type | Type in which the calling method was located | Type | |||||
caller.args | The arguments that have been passed to the caller | Array | |||||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="13622c93caa782c5-285fa0a7-4c2e4fef-bff5a3dc-4d8940eeac0d535c2db22d97"><ac:plain-text-body><![CDATA[ | caller call.clean | Called clean like | Boolean | ]]></ac:plain-text-body></ac:structured-macro> | caller.args | The arguments that have been passed to the caller | Array |
call.lineNo | The line number of the file of the type where the method has been called | int | |||||
call.preferedReturnType | Type that the code wants to work with afterwards | Type | |||||
call.arguments | Types passed in for all arguments | Array | |||||
call.argument.<argument> | Type for a particular argument | Type |
...
Code Block | ||
---|---|---|
| ||
[Fill(data="type")] private static const typeInfo:XML; |
This would be equal to writing:
Code Block | ||
---|---|---|
| ||
private static const typeInfo:XML = describeType(Foo);
|
To preset a property if the compiler doesn't recognize (or ignore) that meta-data it is possible to set data like:
...
This way the code does have a standard content even when its not compiled with this system.
Variables do not have caller information available.
Method argument declarations
Method arguments should also be inject-able. The syntax is slightly different as it doesn't utilize the "data" property but naming the arguments in the meta data:
Code Block | ||
---|---|---|
| ||
[Fill(args="caller.args")]
function foo(args:Array=null) {}
|
This means that the argument will be filled on call:
Code Block | ||
---|---|---|
| ||
[Fill(args="caller.args")]
function foo(args:Array=null) {}
function bar(a:String, b:int) {
foo();
}
|
will be transformed to an equivalent of
Code Block | ||
---|---|---|
| ||
function foo(args:Array=null) {}
function bar(a:String, b:int) {
foo([a,b]);
}
|
This means: always the calling code is rewritten, not the method itself!
Handling data
All the injected data would need to be made accessible using regular ActionScript3 data types. While a XML can be nicely edited and stepped through it also is a quite heavy in its consumption and ultimately unnecessary if you use other code. To make life easier, there should be a possible way of automatic type conversion.
Code Block | ||
---|---|---|
| ||
[Fill(data="type")]
const type: XML; // Type as in describe-type
]
[Fill(data="type")]
const type: Object; // describe-type xml in a object tree
[File(data="compile.time")]
const time: int; // Time as Integer;
[File(data="compile.time")]
const time: String; // Time as String;
[File(data="compile.time")]
const time: Date; // Time as Date;
[File(bar="caller.argument.content")]
function foo(content:*, bar:Class=null); // Content type as class
[File(bar="caller.argument.content")]
function foo(content:*, bar:String=null); // Content type as String
[File(bar="caller.argument.content")]
function foo(content:*, bar:XML=null); // Content type as XML
|
...