[Qt-creator] parser ?error? + SymbolVisitor
Marek Jasovsky
jasovsky.marek at gmail.com
Tue Mar 17 11:54:46 CET 2009
Hi
2009/3/17 Roberto Raggi <roberto.raggi at trolltech.com>
>
> Hi,
>
> On 16.03.2009, at 19:43, Marek Jasovsky wrote:
>
> Hi
>
> for this short one line code snippet, I get same AST as if I had no
> parameters of the function.
> void foo(int a, int b) { return 0; }
>
>
> you are right, as default our default visitor does not visit the
> parameters. I fixed it, in our local repository, you will get the patch with
> the next update or you can apply the following patch to your local repo.
>
> diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
> index 19373cd..1f05114 100644
> --- a/src/shared/cplusplus/AST.cpp
> +++ b/src/shared/cplusplus/AST.cpp
> @@ -1682,6 +1682,10 @@ FunctionDeclaratorAST
> *FunctionDeclaratorAST::clone(MemoryPool *pool) co
> void FunctionDeclaratorAST::accept0(ASTVisitor *visitor)
> {
> if (visitor->visit(this)) {
> + accept(parameters, visitor);
> + for (SpecifierAST *it = cv_qualifier_seq; it; it = it->next)
> + accept(it, visitor);
> + accept(exception_specification, visitor);
> }
> visitor->endVisit(this);
> }
>
thanks for the patch
>
> btw. if I have Block as result from SymbolVisitor pass... how can I analyze
> code which is found deeper than the Block?
>
>
> what do you mean with analyze code?
>
so far with current code I can find all functions, and their respective
parameters. for function body there is CPlusPlus::Block.
question now is: how can I find local variables declarations within this
Block? how can I visit AST of this Block? (there always is body as compound
statement or similar.)
How can I retrieve this compound statement within Block? I know you are
somehow doing this in checks / code completion but I could not find this in
the code
Thanks
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20090317/49cc4ef1/attachment.html
More information about the Qt-creator-old
mailing list