2013-07-28 16:03:06 -07:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2013-01-01 21:41:39 +01:00
|
|
|
module Mutant
|
|
|
|
class Mutator
|
|
|
|
class Node
|
2013-01-04 22:16:03 +01:00
|
|
|
|
|
|
|
# Mutator for while expressions
|
2013-12-29 22:32:26 +01:00
|
|
|
class ConditionalLoop < self
|
2013-01-01 21:41:39 +01:00
|
|
|
|
2013-12-29 22:32:26 +01:00
|
|
|
handle(:until, :while)
|
2013-01-01 21:41:39 +01:00
|
|
|
|
2013-06-21 15:06:39 +02:00
|
|
|
children :condition, :body
|
|
|
|
|
2013-01-01 21:41:39 +01:00
|
|
|
private
|
|
|
|
|
|
|
|
# Emit mutations
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def dispatch
|
2013-06-21 15:06:39 +02:00
|
|
|
emit_condition_mutations
|
2014-04-07 13:22:48 +00:00
|
|
|
emit_body_mutations if body
|
2013-07-05 03:09:07 +02:00
|
|
|
emit_body(nil)
|
2014-04-07 13:22:48 +00:00
|
|
|
emit_body(RAISE)
|
2013-09-07 23:10:25 -07:00
|
|
|
emit_nil
|
2013-01-01 21:41:39 +01:00
|
|
|
end
|
|
|
|
|
2013-06-04 10:25:13 +02:00
|
|
|
end # While
|
|
|
|
end # Node
|
|
|
|
end # Mutator
|
|
|
|
end # Mutant
|