public static Node getAssignedValue ( Node n ) { checkState ( n . isName ( ) || n . isGetProp ( ) , n ) ; Node parent = n . getParent ( ) ; if ( NodeUtil . isNameDeclaration ( parent ) ) { return n . getFirstChild ( ) ; } else if ( parent . isAssign ( ) && parent . getFirstChild ( ) == n ) { return n . getNext ( ) ; } else { return null ; } }
For an assignment or variable declaration get the assigned value .