Re: Re: [Synopsis-changes] r1489 - SymbolLookup::Walker::visit(( PTree::Declaration *)

Stefan Seefeld <[email protected]>
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
Gilles J. Seguin wrote:
> On Sat, 2005-05-07 at 20:41, [email protected] wrote:
> 
> that is not obvious right away, why this thing disappear ?
> the thing is SymbolLookup::Walker::visit( PTree::Declaration *)
> in Modified: trunk/src/Synopsis/SymbolLookup/Walker.cc
> 
> my understanding is that the current scope has surely declaration.
> what i am missing.
> 
> 
> what is the difference between Visitor and Walker ?
> subclassing Visitor is no fun.
>  (means the mechanism obliges the use of double pointers)
> 
> keep the answer short, just want to know if i am lost here.

The answer is indeed in the difference between Visitor and Walker:

A Visitor is just a means to recover type information about the
visited PTree::Nodes. The SymbolLookup::Walker is a device to
traverse the parse tree, adjusting the 'current scope' to make
symbol lookup more convenient.

Declarations in general don't introduce new scopes, but
function definitions do. Up to now the only way to discover
whether a declaration was a function definition or not was to
inspect the subtree. With my recent addition of 'FunctionDefinition'
as a subclass of 'Declaration' it is now possibly to simply
use polymorphism to make that difference, and thus there is
no need for a Walker to deal with declarations, only the
function definitions.

To see how SymbolLookup::Walker is used have a look into
tests/Cxx/src/SymbolLookup.cc, an applet that is used during
the regression testing of symbol lookup.

HTH,
		Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.