2013-01-01 13:50:36 -05:00
|
|
|
module Mutant
|
|
|
|
class Mutator
|
|
|
|
class Node
|
2013-01-04 16:16:03 -05:00
|
|
|
|
|
|
|
# Abstract base class for assignment mutators
|
2013-01-01 13:50:36 -05:00
|
|
|
class Assignment < self
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2013-01-04 16:16:03 -05:00
|
|
|
# Abstract base class for variable assignments
|
2013-01-01 13:50:36 -05:00
|
|
|
class Variable < self
|
|
|
|
|
|
|
|
# Emit mutants
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def dispatch
|
|
|
|
emit_attribute_mutations(:name) do |mutation|
|
|
|
|
mutation.name = "#{self.class::PREFIX}#{mutation.name}".to_sym
|
2013-01-09 14:43:06 -05:00
|
|
|
mutation
|
2013-01-01 13:50:36 -05:00
|
|
|
end
|
|
|
|
emit_attribute_mutations(:value)
|
|
|
|
end
|
|
|
|
|
2013-01-04 16:16:03 -05:00
|
|
|
# Mutator for local variable assignments
|
2013-01-01 13:50:36 -05:00
|
|
|
class Local < self
|
|
|
|
PREFIX = ''.freeze
|
|
|
|
handle(Rubinius::AST::LocalVariableAssignment)
|
|
|
|
end
|
|
|
|
|
2013-01-04 16:16:03 -05:00
|
|
|
# Mutator for instance variable assignments
|
2013-01-01 13:50:36 -05:00
|
|
|
class Instance < self
|
|
|
|
PREFIX = '@'.freeze
|
|
|
|
handle(Rubinius::AST::InstanceVariableAssignment)
|
|
|
|
end
|
|
|
|
|
2013-01-04 16:16:03 -05:00
|
|
|
# Mutator for class variable assignments
|
2013-01-01 13:50:36 -05:00
|
|
|
class Class < self
|
|
|
|
PREFIX = '@@'.freeze
|
|
|
|
handle(Rubinius::AST::ClassVariableAssignment)
|
|
|
|
end
|
|
|
|
|
2013-01-04 16:16:03 -05:00
|
|
|
# Mutator for global variable assignments
|
2013-01-01 13:50:36 -05:00
|
|
|
class Global < self
|
|
|
|
PREFIX = '$'.freeze
|
|
|
|
handle(Rubinius::AST::GlobalVariableAssignment)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|