free_mutant/lib/mutant/mutator/node/define.rb

46 lines
831 B
Ruby
Raw Normal View History

module Mutant
class Mutator
class Node
2013-06-04 17:43:36 -04:00
# Namespace for define mutations
class Define < self
2012-12-10 11:26:56 -05:00
private
# Emit mutations
#
# @return [undefined]
#
# @api private
#
def dispatch
2013-06-21 09:06:07 -04:00
emit_arguments_mutations
if body
emit_body_mutations
else
emit_body(NEW_OBJECT)
end
2012-12-10 11:26:56 -05:00
end
2013-06-21 09:06:07 -04:00
# Mutator for instance method defines
2013-06-04 17:43:36 -04:00
class Instance < self
2013-06-21 09:06:07 -04:00
handle :def
2013-06-04 17:43:36 -04:00
2013-06-21 09:06:07 -04:00
children :name, :arguments, :body
2013-06-04 17:43:36 -04:00
end # Instance
2013-06-21 09:06:07 -04:00
# Mutator for singleton method defines
2013-06-04 17:43:36 -04:00
class Singleton < self
2013-06-21 09:06:07 -04:00
handle :defs
2013-06-04 17:43:36 -04:00
2013-06-21 09:06:07 -04:00
children :subject, :name, :arguments, :body
2013-06-04 17:43:36 -04:00
end # Singelton
2013-06-21 09:06:07 -04:00
end # Define
end # Node
end # Mutator
end # Mutant