summaryrefslogtreecommitdiff
path: root/op.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-12-04 16:07:45 -0800
committerFather Chrysostomos <sprout@cpan.org>2014-12-04 18:56:12 -0800
commit6d4eed2136c73d9331ed2edb2e7650c90b974ea7 (patch)
tree76655c4fa4e84d2b439e501caa33ebd856132b5d /op.h
parent2310e17474d466b55500d4967d2d30e25058760c (diff)
downloadperl-6d4eed2136c73d9331ed2edb2e7650c90b974ea7.tar.gz
Return fresh scalar from join(const,const)
$ perl5.20.1 -Ilib -le 'for(1,2) { push @_, \join "x", 1 } print for @_' SCALAR(0x7fb131005438) SCALAR(0x7fb131005648) $ ./perl -Ilib -le 'for(1,2) { push @_, \join "x", 1 } print for @_' SCALAR(0x7fe612831b30) SCALAR(0x7fe612831b30) Notice how we now get two references to the same scalar. I broke this accidentally in 987c9691. If join has two arguments, it gets con- verted to a stringify op. The stringify op might get constant-folded, and folding of stringify is special, because the parser uses it itself to implement qq(). So I had ck_join set op_folded to flag the op as being a folded join. Only that came too late, because op_convert_list(OP_STRINGIFY,...) folds the op before it returns it. Hence, the folded constant was flagged the wrong way, and stopped being implicitly copied by refgen (\).
Diffstat (limited to 'op.h')
-rw-r--r--op.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/op.h b/op.h
index 161c1a5eea..befdc79ee4 100644
--- a/op.h
+++ b/op.h
@@ -139,6 +139,10 @@ Deprecated. Use C<GIMME_V> instead.
/* On OP_PADRANGE, push @_ */
/* On OP_DUMP, has no label */
/* On OP_UNSTACK, in a C-style for loop */
+/* There is no room in op_flags for this one, so it has its own bit-
+ field member (op_folded) instead. The flag is only used to tell
+ op_convert_list to set op_folded. */
+#define OPf_FOLDED 1<<16
/* old names; don't use in new code, but don't break them, either */
#define OPf_LIST OPf_WANT_LIST