Sha256: 57dd558fff75d656181398b48d646c75ff53a834f24616788d31ebf6ac092d5c

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

module Mutant
  class Mutator
    class Node

      # Mutator for super without parantheses
      class ZSuper < self

        handle(Rubinius::AST::ZSuper)

        # Emit mutations
        #
        # @return [undefined]
        #
        # @api private
        #
        def dispatch
          emit_node(Rubinius::AST::Super, new(Rubinius::AST::ActualArguments))
        end

      end

      # Mutator for super with parantheses
      class Super < self
        handle(Rubinius::AST::Super)

      private

        # Emit mutations
        #
        # @return [undefined]
        #
        # @api private
        #
        def dispatch
          emit_node(Rubinius::AST::ZSuper)
          emit_without_block
          emit_attribute_mutations(:block) if node.block
          emit_attribute_mutations(:arguments) 
        end

        # Emit without block mutation
        #
        # @return [undefined]
        #
        # @api private
        #
        def emit_without_block
          dup = dup_node
          dup.block = nil
          emit(dup)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.2.14 lib/mutant/mutator/node/super.rb
mutant-0.2.13 lib/mutant/mutator/node/super.rb