summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-02-18 10:46:53 +0000
committerDavid Mitchell <davem@iabyn.com>2017-02-18 10:46:53 +0000
commitd8f2fe0966b076afb4b85eb04d1524b6af37e344 (patch)
treea04ee71aa85ca4b7418ad21915a024b0a1d04447 /op.c
parentf62fd06d790b3f8da5a193403a316ebbea86ba52 (diff)
downloadperl-d8f2fe0966b076afb4b85eb04d1524b6af37e344.tar.gz
pp_multideref: tweak an assertion
My recent commit v5.25.9-89-g43dbb3c added an assertion to the effect that in @{ local $a[0]{b}[1] } = 1; the 'local' could only appear at the end of a block and so asserted that the next op should be OP_LEAVE. However, this: @{1, local $a[0]{b}[1] } = 1; inserts an OP_LIST before the OP_LEAVE. Improve the assert to cope with any number of OP_NULL or OP_LISTs before the OP_LEAVE.
Diffstat (limited to 'op.c')
-rw-r--r--op.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/op.c b/op.c
index f16c6b509a..66c4a9b1b4 100644
--- a/op.c
+++ b/op.c
@@ -13193,7 +13193,13 @@ S_maybe_multideref(pTHX_ OP *start, OP *orig_o, UV orig_action, U8 hints)
* block of code would need rethinking.
*/
if (is_deref && (o->op_private & OPpLVAL_INTRO)) {
- assert(o->op_next->op_type == OP_LEAVE);
+#ifdef DEBUGGING
+ OP *n = o->op_next;
+ while (n && ( n->op_type == OP_NULL
+ || n->op_type == OP_LIST))
+ n = n->op_next;
+ assert(n && n->op_type == OP_LEAVE);
+#endif
o->op_private &= ~OPpDEREF;
is_deref = FALSE;
}