Fix emit of naked splat

[Fix #724]
This commit is contained in:
Markus Schirp 2018-12-24 09:19:32 +00:00
parent d702379d5f
commit 97599aaad0
2 changed files with 18 additions and 1 deletions

View file

@ -9,6 +9,8 @@ module Mutant
handle(:array)
children :first
private
# Emit mutations
@ -19,7 +21,7 @@ module Mutant
emit_type
mutate_body
return unless children.one?
emit(children.first)
emit(first) unless n_splat?(first)
end
# Mutate body

View file

@ -8,3 +8,18 @@ Mutant::Meta::Example.add :lvasgn do
mutation 'a = false'
mutation 'a = nil'
end
Mutant::Meta::Example.add :array, :lvasgn do
source 'a = *b'
singleton_mutations
mutation 'a__mutant__ = *b'
mutation 'a = nil'
mutation 'a = self'
mutation 'a = []'
mutation 'a = [nil]'
mutation 'a = [self]'
mutation 'a = [*self]'
mutation 'a = [*nil]'
mutation 'a = [b]'
end