[Qt-creator] parser ?error? + SymbolVisitor
Marek Jasovsky
jasovsky.marek at gmail.com
Tue Mar 17 12:08:40 CET 2009
Hi
thanks for answer
2009/3/17 Roberto Raggi <roberto.raggi at trolltech.com>
>
> Hi,
>
> On 17.03.2009, at 11:54, Marek Jasovsky wrote:
>
>
>
>> 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.)
>
>
> you can do this
>
> for (unsigned i = 0; i < block->memberCount(); ++i) {
> Symbol *member = block->memberAt(i);
> // ### do something with `member' here
> }
>
what are those members of the block? compound statements, or what? (what
derived classes of Symbol)
how do I know for 100% what class was this Block originally? do I have to go
back to the AST from the block (some way, not sure if I know this
precisely?)
or the current state of code is, that you only make a Block from the body of
a method, without taking care of real body?
>
>
> 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
>
>
> if you have an CompoundStatementAST you can get the Block symbol with the
> following code
>
> virtual bool visit(CompoundStatementAST *ast) {
> Block *block = ast->symbol->asBlock();
> // ...
> }
>
> but, at least for now, you can't get the CompoundStatementAST back from a
> Block symbol. But you can easily write a new pass that will create a map
> from Block* to CompoundStatementAST*
>
what do you mean by this new pass?
Thanks a lot
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20090317/7c66c713/attachment.html
More information about the Qt-creator-old
mailing list