From 54b8baaf47aba3b35aec997644270e6a1c5c9b5a Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 2 Dec 2016 12:55:11 +0100 Subject: [PATCH] java duplicates index: don't dispose light AST nodes because they might be needed by other indices in the same file --- .../psi/impl/source/tree/LightTreeUtil.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/LightTreeUtil.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/LightTreeUtil.java index f25eb7447a1a..e8c48824369d 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/LightTreeUtil.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/LightTreeUtil.java @@ -36,26 +36,21 @@ public class LightTreeUtil { @Nullable public static LighterASTNode firstChildOfType(@NotNull LighterAST tree, @Nullable LighterASTNode node, @NotNull IElementType type) { - return node == null ? null : firstChildOfType(tree.getChildren(node), type); - } + if (node == null) return null; - @Nullable - public static LighterASTNode firstChildOfType(@NotNull List children, @NotNull IElementType type) { + List children = tree.getChildren(node); for (int i = 0; i < children.size(); ++i) { LighterASTNode child = children.get(i); if (child.getTokenType() == type) return child; } - return null; } @Nullable public static LighterASTNode firstChildOfType(@NotNull LighterAST tree, @Nullable LighterASTNode node, @NotNull TokenSet types) { - return node == null ? null : firstChildOfType(tree.getChildren(node), types); - } + if (node == null) return null; - @Nullable - public static LighterASTNode firstChildOfType(@NotNull List children, @NotNull TokenSet types) { + List children = tree.getChildren(node); for (int i = 0; i < children.size(); ++i) { LighterASTNode child = children.get(i); if (types.contains(child.getTokenType())) return child; @@ -97,11 +92,6 @@ public class LightTreeUtil { @NotNull public static List getChildrenOfType(@NotNull LighterAST tree, @NotNull LighterASTNode node, @NotNull TokenSet types) { List children = tree.getChildren(node); - return getChildrenOfType(children, types); - } - - @NotNull - public static List getChildrenOfType(List children, @NotNull TokenSet types) { List result = null; for (int i = 0, size = children.size(); i < size; ++i) {