Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[perl #119797] Fix if/else in lvalue sub
When if/else/unless is the last thing in an lvalue sub, the lvalue context is not always propagated properly and scope exit tries to copy things, including arrays, resulting in ‘Bizarre copy of ARRAY’. This commit fixes the bizarre copy by flagging any leave op that is part of an lvalue sub’s return sequence, using the OPpLEAVE flag added for this purpose in the previous commit. Then pp_leave uses that flag to avoid copying return values, but protects them via the mortals stack just like pp_leavesublv (actually pp_ctl.c:S_return_lvalues). For ‘if’ and ‘unless’ without ‘else’, the lvalue context was not being propagated, resulting in arrays’ getting flattened despite the lvalue context. op_lvalue_flags in op.c needed to handle AND and OR ops, which ‘if’ and ‘unless’ compile to, to make this work.
- Loading branch information
Father Chrysostomos
committed
Oct 24, 2013
1 parent
4c3ed74
commit 2ec7f6f
Showing
6 changed files
with
74 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters