From 05ba7c096a1637812610fe686e02f626fa5a39f0 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Wed, 12 Jun 2019 11:57:54 +0100 Subject: [PATCH] Perl_op_lvalue_flags(): skip OPf_WANT_VOID ops. Currently this function asserts that its 'o' argument is non-VOID; later when recursing an OP_LIST, it skips any kids which are VOID. This commit changes it so that the assert becomes a return, and OP_LIST doesn't check whether its kids are VOID. Doing it this way makes it easier to shortly make Perl_op_lvalue_flags() non-recursive. The only functional difference is that on debugging builds, Perl_op_lvalue_flags() will no longer fail an assert if inadvertently called with a VOID op. --- op.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/op.c b/op.c index d9febcb..60b5844 100644 --- a/op.c +++ b/op.c @@ -4189,7 +4189,10 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) return o; } - assert( (o->op_flags & OPf_WANT) != OPf_WANT_VOID ); + /* elements of a list might be in void context because the list is + in scalar context or because they are attribute sub calls */ + if ((o->op_flags & OPf_WANT) == OPf_WANT_VOID) + return o; if (type == OP_PRTF || type == OP_SPRINTF) type = OP_ENTERSUB; @@ -4524,10 +4527,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) case OP_LIST: localize = 0; for (kid = cLISTOPo->op_first; kid; kid = OpSIBLING(kid)) - /* elements might be in void context because the list is - in scalar context or because they are attribute sub calls */ - if ( (kid->op_flags & OPf_WANT) != OPf_WANT_VOID ) - op_lvalue(kid, type); + op_lvalue(kid, type); break; case OP_COREARGS: -- 1.8.3.1