mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix splat argument expansion in method redefinition
The constructed previous_def call was malformed for stub methods. Resolves the original issue in https://github.com/icy-arctic-fox/spectator/issues/49
This commit is contained in:
parent
fd372226ab
commit
abbd6ffd71
2 changed files with 9 additions and 5 deletions
6
spec/issues/github_issue_49_spec.cr
Normal file
6
spec/issues/github_issue_49_spec.cr
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
require "../spec_helper"
|
||||||
|
|
||||||
|
# https://github.com/icy-arctic-fox/spectator/issues/49
|
||||||
|
Spectator.describe "GitHub Issue #49" do
|
||||||
|
mock File
|
||||||
|
end
|
|
@ -133,13 +133,12 @@ module Spectator
|
||||||
if method.splat_index
|
if method.splat_index
|
||||||
method.args.each_with_index do |arg, i|
|
method.args.each_with_index do |arg, i|
|
||||||
if i == method.splat_index
|
if i == method.splat_index
|
||||||
original += '*'
|
|
||||||
if arg.internal_name && arg.internal_name.size > 0
|
if arg.internal_name && arg.internal_name.size > 0
|
||||||
original += "#{arg.internal_name}, "
|
original += "*#{arg.internal_name}, "
|
||||||
end
|
end
|
||||||
original += "**#{method.double_splat}, " if method.double_splat
|
original += "**#{method.double_splat}, " if method.double_splat
|
||||||
elsif i > method.splat_index
|
elsif i > method.splat_index
|
||||||
original += "#{arg.name}: #{arg.internal_name}"
|
original += "#{arg.name}: #{arg.internal_name}, "
|
||||||
else
|
else
|
||||||
original += "#{arg.internal_name}, "
|
original += "#{arg.internal_name}, "
|
||||||
end
|
end
|
||||||
|
@ -283,9 +282,8 @@ module Spectator
|
||||||
if method.splat_index
|
if method.splat_index
|
||||||
method.args.each_with_index do |arg, i|
|
method.args.each_with_index do |arg, i|
|
||||||
if i == method.splat_index
|
if i == method.splat_index
|
||||||
original += '*'
|
|
||||||
if arg.internal_name && arg.internal_name.size > 0
|
if arg.internal_name && arg.internal_name.size > 0
|
||||||
original += "#{arg.internal_name}, "
|
original += "*#{arg.internal_name}, "
|
||||||
end
|
end
|
||||||
original += "**#{method.double_splat}, " if method.double_splat
|
original += "**#{method.double_splat}, " if method.double_splat
|
||||||
elsif i > method.splat_index
|
elsif i > method.splat_index
|
||||||
|
|
Loading…
Reference in a new issue