class Mutest::Mutator::Node::Rescue

Mutator for rescue nodes

Constants

RESCUE_INDICES

Public Instance Methods

dispatch() click to toggle source

Emit mutations

@return [undefined]

# File lib/mutest/mutator/node/rescue.rb, line 17
def dispatch
  mutate_body
  mutate_rescue_bodies
  mutate_else_body
end

Private Instance Methods

emit_concat(child) click to toggle source

Emit concatenation with body

@param [Parser::AST::Node] child

@return [undefined]

# File lib/mutest/mutator/node/rescue.rb, line 41
def emit_concat(child)
  if body
    emit(s(:begin, body, child))
  else
    emit(child)
  end
end
mutate_body() click to toggle source

Emit body mutations

@return [undefined]

# File lib/mutest/mutator/node/rescue.rb, line 52
def mutate_body
  return unless body

  emit_body_mutations
  emit(body)
end
mutate_else_body() click to toggle source

Emit else body mutations

@return [undefined]

# File lib/mutest/mutator/node/rescue.rb, line 62
def mutate_else_body
  return unless else_body

  emit_else_body_mutations
  emit_concat(else_body)
end
mutate_rescue_bodies() click to toggle source

Mutate child by name

@return [undefined]

# File lib/mutest/mutator/node/rescue.rb, line 28
def mutate_rescue_bodies
  children_indices(RESCUE_INDICES).each do |index|
    mutate_child(index)
    resbody_body = AST::Meta::Resbody.new(children.fetch(index)).body
    emit_concat(resbody_body) if resbody_body
  end
end