Sha256: 6431c43fdb333cdf081fc5980119e930ac5802bbd90cf8dd14670e677b1896a5

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

module Mutant
  class Mutator
    class Node
      # Abstract mutator for literal AST nodes
      class Literal < self
        include AbstractType

      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
          new_send(new_float(0), :/, new_float(0))
        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
          new_send(new_float(1), :/, new_float(0))
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.2.7 lib/mutant/mutator/node/literal.rb
mutant-0.2.6 lib/mutant/mutator/node/literal.rb
mutant-0.2.5 lib/mutant/mutator/node/literal.rb
mutant-0.2.4 lib/mutant/mutator/node/literal.rb
mutant-0.2.3 lib/mutant/mutator/node/literal.rb
mutant-0.2.2 lib/mutant/mutator/node/literal.rb
mutant-0.2.1 lib/mutant/mutator/node/literal.rb
mutant-0.2.0 lib/mutant/mutator/node/literal.rb