Sha256: c9af03599d65bb274a1141c8aa8fc46c58ae191b54a9b68d69a1d3d3e5cbe231

Contents?: true

Size: 1.11 KB

Versions: 30

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8

module Mutant
  class Mutator
    class Node
      # Mutator for arguments node
      class Arguments < self

        handle(:args)

      private

        # Perform dispatch
        #
        # @return [undefined]
        #
        # @api private
        #
        def dispatch
          emit_children_mutations
          emit_mlhs_expansion
        end

        # Emit mlhs expansions
        #
        # @return [undefined]
        #
        # @api private
        #
        def emit_mlhs_expansion
          mlhs_childs_with_index.each do |child, index|
            dup_children = children.dup
            dup_children.delete_at(index)
            dup_children.insert(index, *child.children)
            emit_self(*dup_children)
          end
        end

        # Return mlhs childs
        #
        # @return [Enumerable<Parser::AST::Node, Fixnum>]
        #
        # @api private
        #
        def mlhs_childs_with_index
          children.each_with_index.select do |child, index|
            child.type == :mlhs
          end
        end

      end # Arguments
    end # Node
  end # Mutator
end # Mutant

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
mutant-0.5.16 lib/mutant/mutator/node/arguments.rb
mutant-0.5.15 lib/mutant/mutator/node/arguments.rb
mutant-0.5.14 lib/mutant/mutator/node/arguments.rb
mutant-0.5.13 lib/mutant/mutator/node/arguments.rb
mutant-0.5.12 lib/mutant/mutator/node/arguments.rb
mutant-0.5.11 lib/mutant/mutator/node/arguments.rb
mutant-0.5.10 lib/mutant/mutator/node/arguments.rb
mutant-0.5.9 lib/mutant/mutator/node/arguments.rb
mutant-0.5.8 lib/mutant/mutator/node/arguments.rb
mutant-0.5.7 lib/mutant/mutator/node/arguments.rb
mutant-0.5.6 lib/mutant/mutator/node/arguments.rb
mutant-0.5.5 lib/mutant/mutator/node/arguments.rb
mutant-0.5.4 lib/mutant/mutator/node/arguments.rb
mutant-0.5.3 lib/mutant/mutator/node/arguments.rb
mutant-0.5.2 lib/mutant/mutator/node/arguments.rb
mutant-0.5.1 lib/mutant/mutator/node/arguments.rb
mutant-0.5.0 lib/mutant/mutator/node/arguments.rb
mutant-0.3.6 lib/mutant/mutator/node/arguments.rb
mutant-0.3.5 lib/mutant/mutator/node/arguments.rb
mutant-0.3.4 lib/mutant/mutator/node/arguments.rb