[metaas-dev] Sorting methods by name output parameters

David Holroyd dave at badgers-in-foil.co.uk
Wed May 7 22:16:58 UTC 2008


Hi there!

On Tue, May 06, 2008 at 09:17:23AM +0200, Florian Salihovic wrote:
> I'm currently working on a code generator for my own needs. Metaas is
> a great help so far. But in order to navigate through my classes a lil
> easier i have this habit to write my methods in alphabetical order. I
> thought of sorting the code regarding my needs with metaas, but the
> list regarding the methods is read only. Do i have to sort the classes
> by hand?

Well, I'm sorry to say that in-place modification of the contents of
code blocks is not supported yet :(

The underlying Abstract Syntax Tree data structure could allow this kind
of change with a bit of work, but the public API doesn't have the
features yet.

I accept patches! ;)

The only way of really doing this currently might be to walk the entire
contents of the ASCompilationUnit, creating a duplicate of everything,
but adding the duplicate methods in alphabetical order.  That would
really be a lot of effort though.


> Also i'd like to know if some sort of output parameters are planned to
> be implemented in the nearer future (whitespaces between operands and
> operators, additional linebreaks between methods...).

I have had some thoughts, and getting the configuration data to the
places that need it seems to be the main challenge.

i.e. it should be possible to tweak the settings in the
ActionScriptFactory and then an ASBlock.newIf(...) should just do the
right thing -- however, I don't yet have a simple way to get at that
info from within the ASTStatementlList instance.  Maybe one could walk
up the AST to the root node, and have the instance object there hold a
reference to the factory..?  Well, there are other bugs to fix first I
think.

It is on my TODO list though!


ta,
dave

-- 
http://david.holroyd.me.uk/



More information about the metaas-dev mailing list