src/com/google/javascript/jscomp/NodeUtil.java
/**
   * @return true iff the result of the expression is consumed.
   */
@return true iff the result of the expression is consumed.
@return true iff the result of the expression is consumed .
static boolean isExpressionResultUsed(Node expr) {
    Node parent = expr.getParent();
    switch (parent.getToken()) {
      case BLOCK:
      case EXPR_RESULT:
        return false;
      case CAST:
        return isExpressionResultUsed(parent);
      case HOOK:
      case AND:
      case OR:
        return (expr == parent.getFirstChild()) || isExpressionResultUsed(parent);
      case COMMA:
        Node grandparent = parent.getParent();
        if (grandparent.isCall() && parent == grandparent.getFirstChild()) {
          if (expr == parent.getFirstChild()
              && parent.hasTwoChildren()
              && expr.getNext().isName()
              && "eval".equals(expr.getNext().getString())) {
            return true;
          }
        }
        return (expr == parent.getFirstChild()) ? false : isExpressionResultUsed(parent);
      case FOR:
        return (parent.getSecondChild() == expr);
      default:
        break;
    }
    return true;
  }
static boolean isExpressionResultUsed ( Node expr ) { Node parent = expr . getParent ( ) ; switch ( parent . getToken ( ) ) { case BLOCK : case EXPR_RESULT : return false ; case CAST : return isExpressionResultUsed ( parent ) ; case HOOK : case AND : case OR : return ( expr == parent . getFirstChild ( ) ) || isExpressionResultUsed ( parent ) ; case COMMA : Node grandparent = parent . getParent ( ) ; if ( grandparent . isCall ( ) && parent == grandparent . getFirstChild ( ) ) { if ( expr == parent . getFirstChild ( ) && parent . hasTwoChildren ( ) && expr . getNext ( ) . isName ( ) && "eval" . equals ( expr . getNext ( ) . getString ( ) ) ) { return true ; } } return ( expr == parent . getFirstChild ( ) ) ? false : isExpressionResultUsed ( parent ) ; case FOR : return ( parent . getSecondChild ( ) == expr ) ; default : break ; } return true ; }
@return true iff the result of the expression is consumed.
@return true iff the result of the expression is consumed .
// Semantically, a direct call to eval is different from an indirect // call to an eval. See ECMA-262 S15.1.2.1. So it's OK for the first // expression to a comma to be a no-op if it's used to indirect // an eval. This we pretend that this is "used". // Only an expression whose result is in the condition part of the // expression is used.