class RuboCop::AST::Node
def value_used? # rubocop:disable Metrics/MethodLength
`(...; nil)`, might that affect anything?
So, does the return value of this node matter? If we changed it to
change the return value
means we can transform it in ways which preserve the side effects, but
If we know that an expression is useful only for its side effects, that
effects, and some for both
Some expressions are evaluated for their value, some for their side
def value_used? # rubocop:disable Metrics/MethodLength # Be conservative and return true if we're not sure. return false if parent.nil? case parent.type when :array, :defined?, :dstr, :dsym, :eflipflop, :erange, :float, :hash, :iflipflop, :irange, :not, :pair, :regexp, :str, :sym, :when, :xstr parent.value_used? when :begin, :kwbegin begin_value_used? when :for for_value_used? when :case, :if case_if_value_used? when :while, :until, :while_post, :until_post while_until_value_used? else true end end