2012-07-27 22:39:31 +02:00
|
|
|
module Mutant
|
|
|
|
class Mutator
|
2012-07-30 22:39:03 +02:00
|
|
|
# Mutator on AST blocks
|
2012-08-09 23:07:22 +02:00
|
|
|
class Block < self
|
2012-07-27 22:39:31 +02:00
|
|
|
|
2012-08-13 20:40:00 +02:00
|
|
|
handle(Rubinius::AST::Block)
|
2012-07-31 19:45:46 +02:00
|
|
|
|
2012-07-27 22:39:31 +02:00
|
|
|
private
|
|
|
|
|
2012-07-31 04:00:05 +02:00
|
|
|
# Emit mutants
|
2012-07-30 22:39:03 +02:00
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2012-07-31 04:00:05 +02:00
|
|
|
def dispatch
|
|
|
|
array = node.array
|
|
|
|
emit_elements(array)
|
2012-08-13 20:40:00 +02:00
|
|
|
if array.length > 1
|
|
|
|
emit_element_presence(array)
|
|
|
|
else
|
|
|
|
emit_self([new_nil])
|
|
|
|
end
|
2012-07-27 22:39:31 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|