src/com/google/javascript/jscomp/NodeUtil.java
/**
   * Returns true if the given node is either an LHS node in a destructuring pattern or if one of
   * its descendants contains an LHS node in a destructuring pattern. For example, in {@code var {a:
   * b = 3}}}, this returns true given the NAME b or the DEFAULT_VALUE node containing b.
   */
Returns true if the given node is either an LHS node in a destructuring pattern or if one of
its descendants contains an LHS node in a destructuring pattern. For example, in {@code var {a:
b = 3}}}, this returns true given the NAME b or the DEFAULT_VALUE node containing b.
Returns true if the given node is either an LHS node in a destructuring pattern or if one of its descendants contains an LHS node in a destructuring pattern . For example in { @code var { a : b = 3 }}} this returns true given the NAME b or the DEFAULT_VALUE node containing b .
private static boolean isLhsByDestructuringHelper(Node n) {
    Node parent = n.getParent();
    Node grandparent = n.getGrandparent();
    switch (parent.getToken()) {
      case ARRAY_PATTERN:
        return true; 
      case STRING_KEY:
        return grandparent.isObjectPattern(); 
      case OBJECT_PATTERN:
        return !n.isStringKey();
      case COMPUTED_PROP:
        if (n == parent.getSecondChild()) {
          return isLhsByDestructuringHelper(parent);
        }
        return false;
      case REST:
        return isLhsByDestructuringHelper(parent);
      case DEFAULT_VALUE:
        if (n == parent.getFirstChild()) {
          return isLhsByDestructuringHelper(parent);
        }
        return false;
      default:
        return false;
    }
  }
private static boolean isLhsByDestructuringHelper ( Node n ) { Node parent = n . getParent ( ) ; Node grandparent = n . getGrandparent ( ) ; switch ( parent . getToken ( ) ) { case ARRAY_PATTERN : return true ; case STRING_KEY : return grandparent . isObjectPattern ( ) ; case OBJECT_PATTERN : return ! n . isStringKey ( ) ; case COMPUTED_PROP : if ( n == parent . getSecondChild ( ) ) { return isLhsByDestructuringHelper ( parent ) ; } return false ; case REST : return isLhsByDestructuringHelper ( parent ) ; case DEFAULT_VALUE : if ( n == parent . getFirstChild ( ) ) { return isLhsByDestructuringHelper ( parent ) ; } return false ; default : return false ; } }
Returns true if the given node is either an LHS node in a destructuring pattern or if one of
 its descendants contains an LHS node in a destructuring pattern.
Returns true if the given node is either an LHS node in a destructuring pattern or if one of its descendants contains an LHS node in a destructuring pattern .
// "b" in var [b] = ... // the "b" in "var {a: b} = ..." // STRING_KEY children of object patterns are not LHS nodes, since shorthand (e.g. // "var {a} = ...") is normalized at parse-time. If n is not a STRING_KEY, it is // an OBJECT_PATTERN or a COMPUTED_PROP and contains a LHS node. // The first child of a COMPUTED_PROP is the property expression, not a LHS. // The second is the value, which in an object pattern will contain the LHS. // The only child of a REST node is the LHS. // The first child of a DEFAULT_VALUE is a NAME node and a potential LHS. // The second child is the value, so never a LHS node.