Prev | Current Page 863 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


*/
class Inspected implements haxe.rtti.Infos
{
public static function main()
{
var i = new Inspected();
trace(i.inspect());
}
public var name(default, setName) : String;
public function new() { }
private function setName(n : String)
{
return name = n;
}
public function inspect()
{
var p = new haxe.rtti.XmlParser();
// the access to __rtti must be untyped because the field does not exist
// at compile time.
return p.processElement(Xml.parse(untyped Inspected.__rtti).firstElement());
}
}
The inspect() method processes the content of the XML document contained in Inspected.__rtti
and returns it as an enumerator that describes the class. In the following code, the output of the trace()
invocation has been formatted and commented to show how the information is returned.
TClassdecl(
// an object that contains the Class-specific information
{
// the file name without extension where the type is declared
// the module is null if the type name corresponds to the filename
module = > Analyzer,
// the full path including package names separated by a dot ???.


Pages:
851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875