mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
index-based iteration in hot spots
This commit is contained in:
@@ -19,6 +19,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class PsiSuperMethodUtil {
|
||||
@@ -69,7 +70,9 @@ public class PsiSuperMethodUtil {
|
||||
|
||||
public static boolean isSuperMethod(PsiMethod method, PsiMethod superMethod) {
|
||||
HierarchicalMethodSignature signature = method.getHierarchicalMethodSignature();
|
||||
for (HierarchicalMethodSignature supsig : signature.getSuperSignatures()) {
|
||||
List<HierarchicalMethodSignature> superSignatures = signature.getSuperSignatures();
|
||||
for (int i = 0, superSignaturesSize = superSignatures.size(); i < superSignaturesSize; i++) {
|
||||
HierarchicalMethodSignature supsig = superSignatures.get(i);
|
||||
PsiMethod supsigme = supsig.getMethod();
|
||||
if (superMethod.equals(supsigme) || isSuperMethod(supsigme, superMethod)) return true;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,9 @@ public abstract class StubBase<T extends PsiElement> extends UserDataHolderBase
|
||||
|
||||
private int countChildren(final IElementType elementType) {
|
||||
int count = 0;
|
||||
for (StubElement childStub : getChildrenStubs()) {
|
||||
List<StubElement> childrenStubs = getChildrenStubs();
|
||||
for (int i = 0, childrenStubsSize = childrenStubs.size(); i < childrenStubsSize; i++) {
|
||||
StubElement childStub = childrenStubs.get(i);
|
||||
if (childStub.getStubType() == elementType) count++;
|
||||
}
|
||||
|
||||
@@ -132,7 +134,9 @@ public abstract class StubBase<T extends PsiElement> extends UserDataHolderBase
|
||||
|
||||
private int countChildren(final TokenSet types) {
|
||||
int count = 0;
|
||||
for (StubElement childStub : getChildrenStubs()) {
|
||||
List<StubElement> childrenStubs = getChildrenStubs();
|
||||
for (int i = 0, childrenStubsSize = childrenStubs.size(); i < childrenStubsSize; i++) {
|
||||
StubElement childStub = childrenStubs.get(i);
|
||||
if (types.contains(childStub.getStubType())) count++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user