Sha256: 0adae4f772896464ca71c0ddd7e1fb5f860a101a73f42efcc473dd6449e95f83

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

module Mutant
  class Mutator
    class Node
      # Mutator base class for assignments
      class Assignment < self

        # Mutator for variable assignment
        class Variable < self

          children :name, :value

          MAP = IceNine.deep_freeze(
            :gvasgn => '$',
            :cvasgn => '@@',
            :ivasgn => '@',
            :lvasgn => ''
          )

          handle *MAP.keys

        private

          # Perform dispatch
          #
          # @return [undefined]
          #
          # @api private
          #
          def dispatch
            mutate_name
            emit_value_mutations
          end

          # Emit name mutations
          #
          # @return [undefined]
          #
          # @api private
          #
          def mutate_name
            prefix = MAP.fetch(node.type)
            Mutator::Util::Symbol.each(name, self) do |name|
              emit_name("#{prefix}#{name}")
            end
          end

        end # Variable
      end # Assignment
    end # Node
  end # Mutator
end # Mutant

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mutant-0.3.0.beta9 lib/mutant/mutator/node/assignment.rb
mutant-0.3.0.beta8 lib/mutant/mutator/node/assignment.rb
mutant-0.3.0.beta7 lib/mutant/mutator/node/assignment.rb
mutant-0.3.0.beta6 lib/mutant/mutator/node/assignment.rb
mutant-0.3.0.beta5 lib/mutant/mutator/node/assignment.rb
mutant-0.3.0.beta4 lib/mutant/mutator/node/assignment.rb
mutant-0.3.0.beta3 lib/mutant/mutator/node/assignment.rb