Skip to content

Commit eacdeb7

Browse files
committed
Recursive visitor must visit leaves and composite elements itself
1 parent 66f075b commit eacdeb7

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/com/goide/psi/GoRecursiveVisitor.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2015 Sergey Ignatov, Alexander Zolotov, Florin Patan
2+
* Copyright 2013-2016 Sergey Ignatov, Alexander Zolotov, Florin Patan
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,21 +24,19 @@
2424
public class GoRecursiveVisitor extends GoVisitor {
2525
@Override
2626
public void visitCompositeElement(@NotNull GoCompositeElement o) {
27+
super.visitCompositeElement(o);
2728
for (PsiElement psiElement : o.getChildren()) {
28-
if (psiElement instanceof GoCompositeElement) {
29-
psiElement.accept(this);
30-
ProgressIndicatorProvider.checkCanceled();
31-
}
29+
psiElement.accept(this);
30+
ProgressIndicatorProvider.checkCanceled();
3231
}
3332
}
3433

3534
@Override
3635
public void visitFile(@NotNull PsiFile file) {
36+
super.visitFile(file);
3737
for (PsiElement psiElement : file.getChildren()) {
38-
if (psiElement instanceof GoCompositeElement) {
39-
psiElement.accept(this);
40-
ProgressIndicatorProvider.checkCanceled();
41-
}
38+
psiElement.accept(this);
39+
ProgressIndicatorProvider.checkCanceled();
4240
}
4341
}
4442
}

0 commit comments

Comments
 (0)