From 05039abd64c611f39e792c9c6546c4795fb96ada Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Mon, 27 Apr 2015 14:02:38 +0100 Subject: op_sibling_splice(): handle custom ops op_sibling_splice() decides whether a parent op has an op_last field that needs updating based on the op's class. However, it it didn't handle OP_CUSTOM ops. Spotted by Zefram. --- op.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'op.c') diff --git a/op.c b/op.c index 1581f45811..91ab762328 100644 --- a/op.c +++ b/op.c @@ -1325,10 +1325,19 @@ Perl_op_sibling_splice(OP *parent, OP *start, int del_count, OP* insert) if (!parent) goto no_parent; + /* ought to use OP_CLASS(parent) here, but that can't handle + * ex-foo OP_NULL ops. Also note that XopENTRYCUSTOM() can't + * either */ type = parent->op_type; - if (type == OP_NULL) - type = parent->op_targ; - type = PL_opargs[type] & OA_CLASS_MASK; + if (type == OP_CUSTOM) { + dTHX; + type = XopENTRYCUSTOM(parent, xop_class); + } + else { + if (type == OP_NULL) + type = parent->op_targ; + type = PL_opargs[type] & OA_CLASS_MASK; + } lastop = last_ins ? last_ins : start ? start : NULL; if ( type == OA_BINOP -- cgit v1.2.1