Node (Node node) { PsiExpression thatAnchor = node.myAnchor; if(thatAnchor == null) return this; if(thatAnchor == myAnchor) { assert node instanceof Cond; Cond cond = (Cond)node; assert myCondition == cond.myCondition; if(myLimit == cond.myLimit) { return new Cond(myAnchor, myCondition, myLimit, myThenBranch.prepend(cond.myThenBranch), myElseBranch.prepend(cond.myElseBranch)); } assert myLimit > cond.myLimit; return this; } if(PsiTreeUtil.isAncestor(myCondition, thatAnchor, false)) { return this; } return new Cons(node, this); }