This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #113684] Make redo/last/next/dump accept expr
authorFather Chrysostomos <sprout@cpan.org>
Fri, 27 Jul 2012 21:26:39 +0000 (14:26 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 27 Jul 2012 22:53:47 +0000 (15:53 -0700)
commit1f039d60d3646db9ab9065236e00c45cbf099138
tree5741b355170ef4eeb30f3b089dfb1ce5e77fb0c1
parent4b7c0884db5c600085cea2e6463d72ec6e4357f9
[perl #113684] Make redo/last/next/dump accept expr

These functions have been allowing arbitrary expressions, but would
treat anything that did not resolve to a const op as the empty string.
Not only were arguments swallowed up without warning, but constant
folding could change the behaviour.  Computed labels are allowed for
goto, and there is no reason to disallow them for these other ops.
This can also come in handy for certain types of code generators.

In the process of modifying pp functions to accept arbitrary labels,
I noticed that the label and loop-popping code was identical in three
functions, so I moved it out into a separate static function, to make
the changes easier.

I also had to reorder newLOOPEX significantly, because code under the
goto branch needed to a apply to last, and vice versa.  Using multiple
gotos to switch between the branches created too much of a mess.

I also eliminated the use of SP from pp_last, to avoid copying the
value back and forth between SP and PL_stack_sp.
op.c
pp_ctl.c
t/lib/croak/pp_ctl
t/op/loopctl.t