This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Refactor unpack’s newDEFSVOP logic; correct prototype
authorFather Chrysostomos <sprout@cpan.org>
Sun, 21 Aug 2011 08:37:42 +0000 (01:37 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 21 Aug 2011 08:37:42 +0000 (01:37 -0700)
commitea5703f415b018a4574fdbed54af0a53bd0e6095
tree64de8d4753fea26a5f97ada9d0861c1d6eae4111
parentf912a4747f84557c46b88101928c48622c8b8624
Refactor unpack’s newDEFSVOP logic; correct prototype

unpack is the only op that takes an implicit $_ for its second argu-
ment.  (For others it’s the first.)

Instead of special-casing unpack with its own ck_ routine, we can sim-
ply modify the logic in ck_fun to apply OA_DEFGV to the first optional
argument, not just the first argument.

Currently OA_DEFGV is not set in PL_opargs[OP_UNPACK], which means the
automatically-generated prototype is ($;$), instead of ($_).

This commit sets the flag on the op, changes it to use ck_fun
directly, and updates ck_fun and the prototype-generation code accord-
ingly.  I couldn’t put this in multiple commits, as the changes are
interdependent.
embed.h
op.c
opcode.h
proto.h
regen/opcodes
t/op/cproto.t