This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_leaveeval: use EVAL_KEEPERR
authorDavid Mitchell <davem@iabyn.com>
Tue, 9 Jun 2015 16:11:06 +0000 (17:11 +0100)
committerDavid Mitchell <davem@iabyn.com>
Fri, 19 Jun 2015 07:44:18 +0000 (08:44 +0100)
commit7051b8c3d4558ca104e4fd0a9b39141e79a8e67c
tree8a1c080b7978cd78cd9903dbd8dca7cec41b9720
parenta1f85fba6cf7499b0b79f72dea735d683ee0c946
pp_leaveeval: use EVAL_KEEPERR

In order shortly to allow pp_return to tail call pp_leaveval,
make pp_leaveval use the EVAL_KEEPERR flag bit of PL_in_eval
to decide whether to call CLEAR_ERRSV() rather than testing the
OPf_SPECIAL flag bit on the OP_LEAVEEVAL op (since we may no longer be
that op).

The two are equivalent (I checked this by running test test suite with
an assert that they were the same).

Note that pp_return already uses the EVAL_KEEPERR flag test, so this
commit makes the pp_return and pp_leavesub code blocks more similar.

I've also added some more tests, as I initially got the logic of this
wrong, and no core tests failed - only cpan/ ones.  In particular, no core
tests checked whether eval-string actually cleared $@ on success!
ext/XS-APItest/t/call.t
pp_ctl.c
t/op/eval.t