private static boolean checkPreExpressions ( Node n , Node expressionRoot , Predicate < Node > predicate ) { for ( Node p = n ; p != expressionRoot ; p = p . getParent ( ) ) { Node oldestSibling = p . getParent ( ) . getFirstChild ( ) ; // Evaluate a destructuring assignment right-to-left. if ( oldestSibling . isDestructuringPattern ( ) ) { if ( p . isDestructuringPattern ( ) ) { if ( p . getNext ( ) != null && predicate . apply ( p . getNext ( ) ) ) { return true ; } } continue ; } for ( Node cur = oldestSibling ; cur != p ; cur = cur . getNext ( ) ) { if ( predicate . apply ( cur ) ) { return true ; } } } return false ; }
Given an expression by its root and sub - expression n return true if the predicate is true for some expression evaluated before n .