boolean (LighterASTNode element, LighterASTNode target) { Queue<LighterASTNode> workList = new ArrayDeque<>(); workList.add(element); 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 == ASSIGNMENT_EXPRESSION && node.equals(findExpressionChild(tree, parent))) return true; if (type == POSTFIX_EXPRESSION || type == PREFIX_EXPRESSION) return true; } } IElementType tokenType = node.getTokenType(); if (tokenType != LAMBDA_EXPRESSION && tokenType != TYPE_PARAMETER_LIST && tokenType != ANONYMOUS_CLASS) { workList.addAll(tree.getChildren(node)); } } return false; }