[Qt-creator] parser ?error? + SymbolVisitor

Roberto Raggi roberto.raggi at trolltech.com
Tue Mar 17 11:42:17 CET 2009


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);
  }




>
> 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?

ciao robe


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20090317/da24991d/attachment.html 


More information about the Qt-creator-old mailing list