public static Node getBestLValue ( Node n ) { Node parent = n . getParent ( ) ; if ( isFunctionDeclaration ( n ) || isClassDeclaration ( n ) ) { return n . getFirstChild ( ) ; } else if ( n . isClassMembers ( ) ) { return getBestLValue ( parent ) ; } else if ( parent . isName ( ) ) { return parent ; } else if ( parent . isAssign ( ) ) { return parent . getFirstChild ( ) ; } else if ( mayBeObjectLitKey ( parent ) || parent . isComputedProp ( ) ) { return parent ; } else if ( ( parent . isHook ( ) && parent . getFirstChild ( ) != n ) || parent . isOr ( ) || parent . isAnd ( ) || ( parent . isComma ( ) && parent . getFirstChild ( ) != n ) ) { return getBestLValue ( parent ) ; } else if ( parent . isCast ( ) ) { return getBestLValue ( parent ) ; } return null ; }
Find the l - value that the given r - value is being assigned to .