mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
remove highly non-obvious not necessary anymore code
This commit is contained in:
@@ -32,7 +32,6 @@ public abstract class JavaRecursiveElementVisitor extends JavaElementVisitor {
|
||||
// This stack thing is intended to prevent exponential child traversing due to visitReferenceExpression calls both visitRefElement
|
||||
// and visitExpression.
|
||||
private final Stack<PsiReferenceExpression> myRefExprsInVisit = new Stack<PsiReferenceExpression>();
|
||||
private final Stack<PsiBinaryExpression> myBinaryExpressions = new Stack<PsiBinaryExpression>();
|
||||
|
||||
@Override
|
||||
public void visitElement(PsiElement element) {
|
||||
@@ -40,24 +39,6 @@ public abstract class JavaRecursiveElementVisitor extends JavaElementVisitor {
|
||||
myRefExprsInVisit.pop();
|
||||
myRefExprsInVisit.push(null);
|
||||
}
|
||||
else if (element instanceof PsiBinaryExpression) {
|
||||
//implement smart traversing to avoid stack overflow
|
||||
if (!myBinaryExpressions.isEmpty() && myBinaryExpressions.peek() == element) {
|
||||
return;
|
||||
}
|
||||
PsiElement child = element.getFirstChild();
|
||||
while (child != null) {
|
||||
if (child instanceof PsiBinaryExpression) {
|
||||
myBinaryExpressions.push((PsiBinaryExpression)child);
|
||||
}
|
||||
child.accept(this);
|
||||
child = child.getNextSibling();
|
||||
if (child == null) {
|
||||
child = myBinaryExpressions.isEmpty() ? null : myBinaryExpressions.pop();
|
||||
if (child != null) child = child.getFirstChild();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
*/
|
||||
package com.intellij.psi.jsp;
|
||||
|
||||
import com.intellij.psi.PsiReferenceExpression;
|
||||
import com.intellij.psi.PsiBinaryExpression;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReferenceExpression;
|
||||
import com.intellij.util.containers.Stack;
|
||||
|
||||
/**
|
||||
@@ -27,7 +26,6 @@ public abstract class JavaJspRecursiveElementVisitor extends JavaJspElementVisit
|
||||
// This stack thing is intended to prevent exponential child traversing due to visitReferenceExpression calls both visitRefElement
|
||||
// and visitExpression.
|
||||
private final Stack<PsiReferenceExpression> myRefExprsInVisit = new Stack<>();
|
||||
private final Stack<PsiBinaryExpression> myBinaryExpressions = new Stack<>();
|
||||
|
||||
@Override
|
||||
public void visitElement(PsiElement element) {
|
||||
@@ -35,24 +33,6 @@ public abstract class JavaJspRecursiveElementVisitor extends JavaJspElementVisit
|
||||
myRefExprsInVisit.pop();
|
||||
myRefExprsInVisit.push(null);
|
||||
}
|
||||
else if (element instanceof PsiBinaryExpression) {
|
||||
//implement smart traversing to avoid stack overflow
|
||||
if (!myBinaryExpressions.isEmpty() && myBinaryExpressions.peek() == element) {
|
||||
return;
|
||||
}
|
||||
PsiElement child = element.getFirstChild();
|
||||
while (child != null) {
|
||||
if (child instanceof PsiBinaryExpression) {
|
||||
myBinaryExpressions.push((PsiBinaryExpression)child);
|
||||
}
|
||||
child.accept(this);
|
||||
child = child.getNextSibling();
|
||||
if (child == null) {
|
||||
child = myBinaryExpressions.isEmpty() ? null : myBinaryExpressions.pop();
|
||||
if (child != null) child = child.getFirstChild();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user