boolean (LighterASTNode expression, LighterASTNode target) { Queue<LighterASTNode> workList = new ArrayDeque<>(); workList.add(expression); while(!workList.isEmpty()) { LighterASTNode node = workList.poll(); if (isReferenceToLocal(node, target)) { LighterASTNode parent = tree.getParent(node); if (parent != null) { IElementType type = parent.getTokenType(); if (type == REFERENCE_EXPRESSION || type == ARRAY_ACCESS_EXPRESSION) return true; } } IElementType tokenType = node.getTokenType(); if (tokenType == CONDITIONAL_EXPRESSION || tokenType == SWITCH_EXPRESSION || (tokenType == POLYADIC_EXPRESSION || tokenType == BINARY_EXPRESSION) && firstChildOfType(tree, node, SHORT_CIRCUIT) != null) { ContainerUtil.addIfNotNull(workList, findExpressionChild(tree, node)); } else if (tokenType != LAMBDA_EXPRESSION && tokenType != TYPE_PARAMETER_LIST && tokenType != ANONYMOUS_CLASS) { workList.addAll(tree.getChildren(node)); } } return false; }