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!"
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!"
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 wrote:
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!"
So PsiElementVisitor will only visit the top level elements? For a java
file just the one node 'PsiJavaFile' and nothing else?
Maxim Mossienko wrote:
>> In what way is it recursive?
--
Barry Kaplan
bkaplan@integratedtrading.com
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:
>> 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!"
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:
>> 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!"
Got it. Thanks!
Dmitry Lomov (JetBrains) 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