Sha256: 7b307c2e84907fd6dd9c84aee9a857d905b643d6e4994b1e2924331c792be39a

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Mutant
  class Mutator
    class Node
      class ProcargZero < self
        MAP = {
          ::Parser::AST::Node => :emit_argument_node_mutations,
          Symbol              => :emit_argument_symbol_mutations
        }.freeze

        private_constant(*constants(false))

        handle :procarg0

        children :argument

      private

        # Emit mutations
        #
        # @return [undefined]
        def dispatch
          __send__(MAP.fetch(argument.class))
        end

        # Emit argument symbol mutations
        #
        # @return [undefined]
        def emit_argument_symbol_mutations
          emit_type(:"_#{argument}") unless argument.to_s.start_with?('_')
        end

        # Emit argument node mutations
        #
        # @return [undefined]
        def emit_argument_node_mutations
          emit_argument_mutations
          first = Mutant::Util.one(argument.children)
          emit_type(first)
        end
      end # ProcargZero
    end # Node
  end # Mutator
end # Mutant

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mutant-0.9.1 lib/mutant/mutator/node/procarg_zero.rb
mutant-0.9.0 lib/mutant/mutator/node/procarg_zero.rb
mutant-0.8.24 lib/mutant/mutator/node/procarg_zero.rb
mutant-0.8.23 lib/mutant/mutator/node/procarg_zero.rb
mutant-0.8.22 lib/mutant/mutator/node/procarg_zero.rb
mutant-0.8.21 lib/mutant/mutator/node/procarg_zero.rb