lib/preval/visitors/attr_accessor.rb in preval-0.4.0 vs lib/preval/visitors/attr_accessor.rb in preval-0.4.1

- old
+ new

@@ -27,13 +27,16 @@ # this is a setter method node[1, 0, 0].length == 1 && # there is exactly one required param node[1, 0].body[1..-1].none? && # there are no other params - node[2, 0, 0, 0]&.is?(:stmts_new) && - # there is only one statement in the body - node[2, 0, 1].is?(:assign) && - # the only statement is an assignment + ( + node[2, 0].type_match?(:stmts_new, :assign) || ( + node[2, 0, 0].type_match?(:stmts_new, :void_stmt) && + node[2, 0].type_match?(:stmts_add, :assign) + ) + ) && + # there is only one statement in the body and it's an assignment node[2, 0, 1].type_match?(:var_field, :var_ref) && # assigning a variable node[2, 0, 1, 0, 0].is?(:@ivar) && # assigning to an instance variable node[0].body[0..-2] == node[2, 0, 1, 0, 0].body[1..-1] &&