Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] ajc AST Documentation

The place this is meant to be is on the eclipse wiki for extending AJ/AJDT:

http://wiki.eclipse.org/index.php/Developer%27s_guide_to_building_tools_on_top_of_AJDT_and_AspectJ

But there isn't a whole lot there and it is a little out of date, so
also see these bugs:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=110465
https://bugs.eclipse.org/bugs/show_bug.cgi?id=211201

The AST support is far from complete and traditionally the users
provide patches back that augment what we have with what they need and
I commit them.


>  1) The framework, which I'm extending is using the ASTNode and ASTVisitor
>  from the package org.aspectj.org.eclipse.jdt.internal.compiler in
>  project org.eclipse.jdt.core to build a graph. However, the ASTNode
>  class in that package does not provide a way to get the underlying
>  AST. So how can I make some modifications on it like described in the
>  article in Reference [1]?

See the bug reports on creating AjASTVisitors - best place to find
what does and doesn't work is look at the test cases you can reach
them by browsing cvs

http://dev.eclipse.org/viewcvs/index.cgi/org.aspectj/modules/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java?root=Tools_Project&view=markup
http://dev.eclipse.org/viewcvs/index.cgi/org.aspectj/modules/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/?root=Tools_Project

>  2) Can I modify an AST and then directly let ajc "compile" that
>  modified AST? Or do I first have to write the changes back to the
>  code and compile the code? I would like to do something like
>
>
>  // get AST
>  // modify AST
>  Main main = new Main().runMain(modifiedAST);
>
>  but I can't find an entry point for this. Shouldn't tools be able to
>  make performance improving modifications to the AST and then compile
>  without changing the underlying source code?

We could do that, I don't believe we do at the moment.

>  For these and probably other questions, I would love to have
>  something like a documentation other than the source code.
>
>  Any hints?

All I have is what is above, I don't do much with the AST and as I
say, I rely on contributions from people using it to extend it.

Andy.


Back to the top