2012-07-31 19:45:46 +02:00
|
|
|
module Mutant
|
|
|
|
class Mutator
|
|
|
|
# Abstract mutator for literal AST nodes
|
2012-08-09 23:07:22 +02:00
|
|
|
class Literal < self
|
2012-07-31 19:45:46 +02:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# Return new float literal
|
|
|
|
#
|
|
|
|
# @param [#to_f] value
|
|
|
|
#
|
|
|
|
# @return [Rubinius::Node::FloatLiteral]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def new_float(value)
|
|
|
|
new(Rubinius::AST::FloatLiteral, value)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Return AST representing NaN
|
|
|
|
#
|
|
|
|
# @return [Rubinius::Node::AST]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def nan
|
2012-08-01 15:55:49 +02:00
|
|
|
new_send(new_float(0), :/, new_float(0))
|
2012-07-31 19:45:46 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# Return AST representing negative infinity
|
|
|
|
#
|
|
|
|
# @return [Rubinius::Node::AST]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def negative_infinity
|
|
|
|
new(Rubinius::AST::Negate, infinity)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Return AST representing infinity
|
|
|
|
#
|
|
|
|
# @return [Rubinius::Node::AST]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def infinity
|
2012-08-01 15:55:49 +02:00
|
|
|
new_send(new_float(1), :/, new_float(0))
|
2012-07-31 19:45:46 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|