5 comments
Comment actions Permalink

Barry Kaplan wrote:

In what way is it recursive?

Passes all children provided that super methods (of
RecursiveElementVisitor) are called

--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

So PsiElementVisitor will only visit the top level elements? For a java
file just the one node 'PsiJavaFile' and nothing else?

Maxim Mossienko wrote:

Barry Kaplan wrote:

>> In what way is it recursive?


Passes all children provided that super methods (of
RecursiveElementVisitor) are called


--
Barry Kaplan
bkaplan@integratedtrading.com

0
Comment actions Permalink

Hi,

Simple (nonrecursive) visitor will receive notification about visiting
of the node it is applied to. E.g.

PsiElementVisitor visitor = ...;
PsiElement element = ...;

element.accept(visitor);

During accept call visitor will have called only 'visitXXX' for element.

Barry Kaplan wrote:

So PsiElementVisitor will only visit the top level elements? For a java
file just the one node 'PsiJavaFile' and nothing else?

Maxim Mossienko wrote:

>> Barry Kaplan wrote:
>>
>>> In what way is it recursive?
>>
>>
>> Passes all children provided that super methods (of
>> RecursiveElementVisitor) are called
>>



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Another way to put it is that PsiRecursiveElementVisitor.visitElement
calls

child.accept(this)

for each child of the element.

Since all default implementations in PsiElementVisitor end up calling
visitElement(), it effectively traverses the whole tree from top to leaves.

Friendly,
Dmitry

Maxim Mossienko wrote:

Hi,

Simple (nonrecursive) visitor will receive notification about visiting
of the node it is applied to. E.g.

PsiElementVisitor visitor = ...;
PsiElement element = ...;

element.accept(visitor);

During accept call visitor will have called only 'visitXXX' for element.

Barry Kaplan wrote:

>> So PsiElementVisitor will only visit the top level elements? For a java
>> file just the one node 'PsiJavaFile' and nothing else?
>>
>> Maxim Mossienko wrote:
>>
>>> Barry Kaplan wrote:
>>>
>>>> In what way is it recursive?
>>>
>>>
>>> Passes all children provided that super methods (of
>>> RecursiveElementVisitor) are called
>>>
>>



--
Dmitry Lomov
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Got it. Thanks!

Dmitry Lomov (JetBrains) wrote:

Another way to put it is that PsiRecursiveElementVisitor.visitElement
calls

child.accept(this)

for each child of the element.

Since all default implementations in PsiElementVisitor end up calling
visitElement(), it effectively traverses the whole tree from top to leaves.

Friendly,
Dmitry

Maxim Mossienko wrote:

>>Hi,
>>
>>Simple (nonrecursive) visitor will receive notification about visiting
>>of the node it is applied to. E.g.
>>
>>PsiElementVisitor visitor = ...;
>>PsiElement element = ...;
>>
>>element.accept(visitor);
>>
>>During accept call visitor will have called only 'visitXXX' for element.
>>
>>Barry Kaplan wrote:
>>
>>>So PsiElementVisitor will only visit the top level elements? For a java
>>>file just the one node 'PsiJavaFile' and nothing else?
>>>
>>>Maxim Mossienko wrote:
>>>
>>>
>>>>Barry Kaplan wrote:
>>>>
>>>>
>>>>>In what way is it recursive?
>>>>
>>>>
>>>>Passes all children provided that super methods (of
>>>>RecursiveElementVisitor) are called
>>>>
>>>
>>


--
Barry Kaplan
bkaplan@integratedtrading.com

0

Please sign in to leave a comment.