From 5d051ee03641d21c898bf366fb1caee7baf7e646 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Fri, 2 Oct 2015 17:19:22 +0100 Subject: 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. --- op.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'op.c') 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 block. C supplies the expression that will be locally assigned to a lexical variable, and C supplies the body of the C construct; they are consumed by this function and become part of the constructed op tree. -C is the pad offset of the scalar lexical variable that will -be affected. If it is 0, the global C<$_> will be used. +C 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); } /* -- cgit v1.2.1