summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-10-02 17:19:22 +0100
committerDavid Mitchell <davem@iabyn.com>2015-10-02 17:23:23 +0100
commit5d051ee03641d21c898bf366fb1caee7baf7e646 (patch)
tree26fb55d97521454facd4b45552201c65c052d091 /op.c
parent9ff1a054e52a031d80d4625192ca222e15bb9c69 (diff)
downloadperl-5d051ee03641d21c898bf366fb1caee7baf7e646.tar.gz
given(): remove support for lexical $_
There is dead code that used to allow my $_; ... given ($foo) { # lexical $_ aliased to $foo here } Now that lexical $_ has been removed, remove the code. I've left the signatures of the newFOO() functions unchanged; they just expect a target of 0 to always be passed now.
Diffstat (limited to 'op.c')
-rw-r--r--op.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/op.c b/op.c
index a6b361f546..399cf3024a 100644
--- a/op.c
+++ b/op.c
@@ -7452,9 +7452,10 @@ S_newGIVWHENOP(pTHX_ OP *cond, OP *block,
OP *o;
PERL_ARGS_ASSERT_NEWGIVWHENOP;
+ PERL_UNUSED_ARG(entertarg); /* used to indicate targ of lexical $_ */
enterop = S_alloc_LOGOP(aTHX_ enter_opcode, block, NULL);
- enterop->op_targ = ((entertarg == NOT_IN_PAD) ? 0 : entertarg);
+ enterop->op_targ = 0;
enterop->op_private = 0;
o = newUNOP(leave_opcode, 0, (OP *) enterop);
@@ -7573,8 +7574,7 @@ Constructs, checks, and returns an op tree expressing a C<given> block.
C<cond> supplies the expression that will be locally assigned to a lexical
variable, and C<block> supplies the body of the C<given> construct; they
are consumed by this function and become part of the constructed op tree.
-C<defsv_off> is the pad offset of the scalar lexical variable that will
-be affected. If it is 0, the global C<$_> will be used.
+C<defsv_off> must be zero (it used to identity the pad slot of lexical $_).
=cut
*/
@@ -7583,11 +7583,14 @@ OP *
Perl_newGIVENOP(pTHX_ OP *cond, OP *block, PADOFFSET defsv_off)
{
PERL_ARGS_ASSERT_NEWGIVENOP;
+ PERL_UNUSED_ARG(defsv_off);
+
+ assert(!defsv_off);
return newGIVWHENOP(
ref_array_or_hash(cond),
block,
OP_ENTERGIVEN, OP_LEAVEGIVEN,
- defsv_off);
+ 0);
}
/*