Project

General

Profile

« Previous | Next » 

Revision f53dfab9

Added by jeremyevans (Jeremy Evans) almost 4 years ago

Add support for anonymous rest and keyword rest argument forwarding

This allows for the following syntax:

def foo(*) bar(*) end def baz(**) quux(**) end 

This is a natural addition after the introduction of anonymous
block forwarding. Anonymous rest and keyword rest arguments were
already supported in method parameters, this just allows them to
be used as arguments to other methods. The same advantages of
anonymous block forwarding apply to rest and keyword rest argument
forwarding.

This has some minor changes to #parameters output. Now, instead
of [:rest], [:keyrest], you get [:rest, :*], [:keyrest, :**].
These were already used for ... forwarding, so I think it makes
it more consistent to include them in other cases. If we want to
use [:rest], [:keyrest] in both cases, that is also possible.

I don't think the previous behavior of [:rest], [:keyrest] in
the non-... case and [:rest, :*], [:keyrest, :**] in the ...
case makes sense, but if we did want that behavior, we'll have to
make more substantial changes, such as using a different ID in the
... forwarding case.

Implements [Feature #18351]