Question
Access and manipulate all ASTs for a given project
Hi,
I would like to do the following: for every item in a Flex project (MXML documents, AS classes, etc.) I would like to gain access to its AST (so for MXML, this is after it gets converted to the equivalent AS) and for each of those I would like to walk it and output information about it (this is for a code analysis and optimisation tool).
By digging around I've found flash.swf.tools.as3.EvaluatorAdapter and the interface it implements which seem to be what I want in order to walk an AST, but I can't seem to figure out what I need to do before that. All the examples and documentation are for very high level things (load a source, set the output, call build()) and not for this sort of more custom tool.
Is there some documentation out there about the various phases that Flex goes through to build its output, and what they map to in the code? I'm guessing I need to call whatever finds all the files that are involved, then parse them, and possibly after that call a few evaluators that may tweak the tree, and then put my own. But it's a big code base, I've been walking all over it, and I'm a little stumped.
Thanks for any pointers!
I would like to do the following: for every item in a Flex project (MXML documents, AS classes, etc.) I would like to gain access to its AST (so for MXML, this is after it gets converted to the equivalent AS) and for each of those I would like to walk it and output information about it (this is for a code analysis and optimisation tool).
By digging around I've found flash.swf.tools.as3.EvaluatorAdapter and the interface it implements which seem to be what I want in order to walk an AST, but I can't seem to figure out what I need to do before that. All the examples and documentation are for very high level things (load a source, set the output, call build()) and not for this sort of more custom tool.
Is there some documentation out there about the various phases that Flex goes through to build its output, and what they map to in the code? I'm guessing I need to call whatever finds all the files that are involved, then parse them, and possibly after that call a few evaluators that may tweak the tree, and then put my own. But it's a big code base, I've been walking all over it, and I'm a little stumped.
Thanks for any pointers!
