class Crispr::Mutations::ControlFlow

def mutations_for(node)

Returns:
  • (Array) - mutated nodes

Parameters:
  • node (Parser::AST::Node) -- the AST node to inspect
def mutations_for(node)
  return [] unless node.is_a?(Parser::AST::Node)
  case node.type
  when :next
    [Parser::AST::Node.new(:break, node.children), Parser::AST::Node.new(:nil)]
  when :break
    [Parser::AST::Node.new(:next, node.children), Parser::AST::Node.new(:nil)]
  when :return
    [Parser::AST::Node.new(:return, []), Parser::AST::Node.new(:nil)]
  else
    []
  end
end