From 667e79316d322f40bc85b26c7755e7fa46ce5204 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Fri, 21 Jun 2013 15:26:41 +0200 Subject: [PATCH] Use child nameing in assignment mutator --- lib/mutant/mutator/node/assignment.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/mutant/mutator/node/assignment.rb b/lib/mutant/mutator/node/assignment.rb index 7ce12d2b..fc7ade97 100644 --- a/lib/mutant/mutator/node/assignment.rb +++ b/lib/mutant/mutator/node/assignment.rb @@ -6,8 +6,8 @@ module Mutant # Mutator for variable assignment class Variable < self - NAME_INDEX = 0 - VALUE_INDEX = 1 + + children :name, :value MAP = IceNine.deep_freeze( :gvasgn => '$', @@ -27,8 +27,8 @@ module Mutant # @api private # def dispatch - emit_name_mutations - mutate_child(VALUE_INDEX) + mutate_name + emit_value_mutations end # Emit name mutations @@ -37,10 +37,10 @@ module Mutant # # @api private # - def emit_name_mutations - name = children[NAME_INDEX] + def mutate_name + prefix = MAP.fetch(node.type) Mutator::Util::Symbol.each(name) do |name| - emit_child_update(NAME_INDEX, "#{MAP.fetch(node.type)}#{name}") + emit_name("#{prefix}#{name}") end end