lib/mutant/mutator/node/send.rb in mutant-0.5.19 vs lib/mutant/mutator/node/send.rb in mutant-0.5.20
- old
+ new
@@ -1,7 +1,5 @@
-# encoding: utf-8
-
module Mutant
class Mutator
class Node
# Namespace for send mutators
@@ -181,15 +179,23 @@
# @return [undefined]
#
# @api private
#
def emit_implicit_self
- if receiver.type == :self &&
- !KEYWORDS.include?(selector) &&
- !attribute_assignment? &&
- !OP_ASSIGN.include?(parent_type)
- emit_receiver(nil)
- end
+ emit_receiver(nil) if allow_implicit_self?
+ end
+
+ # Test if implicit self is allowed
+ #
+ # @return [Boolean]
+ #
+ # @api private
+ #
+ def allow_implicit_self?
+ n_self?(receiver) &&
+ !KEYWORDS.include?(selector) &&
+ !attribute_assignment? &&
+ !OP_ASSIGN.include?(parent_type)
end
# Test for assignment
#
# FIXME: This also returns true for <= operator!