Sha256: f42869949fb2cf4b91d045ce399d7ddaf515ac018ab9e3aed711ccacbe50182d

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents

module Mutant
  class Mutator
    class Node

      # Abstract base class for assignment mutators
      class Assignment < self

      private

        # Abstract base class for variable assignments
        class Variable < self

          # Emit mutants
          #
          # @return [undefined]
          #
          # @api private
          #
          def dispatch
            emit_attribute_mutations(:name) do |mutation|
              mutation.name = "#{self.class::PREFIX}#{mutation.name}".to_sym
              mutation
            end
            emit_attribute_mutations(:value)
          end

          # Mutator for local variable assignments
          class Local < self
            PREFIX = ''.freeze
            handle(Rubinius::AST::LocalVariableAssignment)
          end

          # Mutator for instance variable assignments
          class Instance < self
            PREFIX = '@'.freeze
            handle(Rubinius::AST::InstanceVariableAssignment)
          end

          # Mutator for class variable assignments
          class Class < self
            PREFIX = '@@'.freeze
            handle(Rubinius::AST::ClassVariableAssignment)
          end

          # Mutator for global variable assignments
          class Global < self
            PREFIX = '$'.freeze
            handle(Rubinius::AST::GlobalVariableAssignment)
          end

        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mutant-0.2.20 lib/mutant/mutator/node/assignment.rb
mutant-0.2.17 lib/mutant/mutator/node/assignment.rb
mutant-0.2.16 lib/mutant/mutator/node/assignment.rb
mutant-0.2.15 lib/mutant/mutator/node/assignment.rb
mutant-0.2.14 lib/mutant/mutator/node/assignment.rb
mutant-0.2.13 lib/mutant/mutator/node/assignment.rb