summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-11-17 12:23:17 +0000
committerDavid Mitchell <davem@iabyn.com>2017-11-23 08:52:16 +0000
commitd962625ff9208c2f683374d283f74eee759c2202 (patch)
tree31c972b1a35dffd0599590e25d7409bd4cd243fa /op.c
parented34dca8117dd19b8eb9b3668892fd309157c5ad (diff)
downloadperl-d962625ff9208c2f683374d283f74eee759c2202.tar.gz
add OPpCONCAT_NESTED flag
This flag makes no functional difference to runtime (it merely flags that an optimisation has been performed), but it will shortly be used to assist Deparse and warnings. OPf_STACKED, when set on a OP_CONCAT, normally indicates .=; but it also gets set to optimise $a . $b . $c into ($a . $b) .= $c so that the first concat's PADTMP (which holds the result of $a.$b) can be reused. Set a flag in this case to help deparse and warn distinguish the cases.
Diffstat (limited to 'op.c')
-rw-r--r--op.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/op.c b/op.c
index 8a185a1915..ec45f2c50b 100644
--- a/op.c
+++ b/op.c
@@ -10850,7 +10850,10 @@ Perl_ck_concat(pTHX_ OP *o)
/* reuse the padtmp returned by the concat child */
if (kid->op_type == OP_CONCAT && !(kid->op_private & OPpTARGET_MY) &&
!(kUNOP->op_first->op_flags & OPf_MOD))
+ {
o->op_flags |= OPf_STACKED;
+ o->op_private |= OPpCONCAT_NESTED;
+ }
return o;
}