Fix captured arguments not handling splat

This commit is contained in:
Michael Miller 2022-03-12 14:31:39 -07:00
parent ea46af00a6
commit 151926fd25
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF

View file

@ -12,7 +12,7 @@ module Spectator
{% if method.block_arg %}&{{method.block_arg}}{% elsif method.accepts_block? %}&{% end %} {% if method.block_arg %}&{{method.block_arg}}{% elsif method.accepts_block? %}&{% end %}
){% if method.return_type %} : {{method.return_type}}{% end %}{% if !method.free_vars.empty? %} forall {{method.free_vars.splat}}{% end %} ){% if method.return_type %} : {{method.return_type}}{% end %}{% if !method.free_vars.empty? %} forall {{method.free_vars.splat}}{% end %}
%args = ::Spectator::Arguments.capture( %args = ::Spectator::Arguments.capture(
{{method.args.map(&.internal_name).splat(",")}} {% for arg, i in method.args %}{% if i == method.splat_index %}*{% end %}{{arg.internal_name}}, {% end %}
{% if method.double_splat %}**{{method.double_splat}}{% end %} {% if method.double_splat %}**{{method.double_splat}}{% end %}
) )
%call = ::Spectator::MethodCall.new({{method.name.symbolize}}, %args) %call = ::Spectator::MethodCall.new({{method.name.symbolize}}, %args)
@ -50,7 +50,7 @@ module Spectator
{% if method.block_arg %}&{{method.block_arg}}{% elsif method.accepts_block? %}&{% end %} {% if method.block_arg %}&{{method.block_arg}}{% elsif method.accepts_block? %}&{% end %}
){% if method.return_type %} : {{method.return_type}}{% end %}{% if !method.free_vars.empty? %} forall {{method.free_vars.splat}}{% end %} ){% if method.return_type %} : {{method.return_type}}{% end %}{% if !method.free_vars.empty? %} forall {{method.free_vars.splat}}{% end %}
%args = ::Spectator::Arguments.capture( %args = ::Spectator::Arguments.capture(
{{method.args.map(&.internal_name).splat(",")}} {% for arg, i in method.args %}{% if i == method.splat_index %}*{% end %}{{arg.internal_name}}, {% end %}
{% if method.double_splat %}**{{method.double_splat}}{% end %} {% if method.double_splat %}**{{method.double_splat}}{% end %}
) )
%call = ::Spectator::MethodCall.new({{method.name.symbolize}}, %args) %call = ::Spectator::MethodCall.new({{method.name.symbolize}}, %args)