summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-25 22:07:12 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-07-25 22:20:15 -0700
commit06b58b76f31d491371d0ab0c38cec33c1c7ba4ab (patch)
treeab708f3fc62b8ac9cb4ba208b96735eaace0c2e3 /op.c
parent42409c4069deb2417b838a49810ecbce306a72b9 (diff)
downloadperl-06b58b76f31d491371d0ab0c38cec33c1c7ba4ab.tar.gz
Don’t let ?: folding affect truncate
truncate(${\1} ? foo : bar, 0) and truncate(1 ? foo : bar, 0) should behave the same way, but were treated differently, due to the way ?: is folded in the latter case. Now that foldedness is recorded in the op tree (cc2ebcd7902), we can use the OPpCONST_FOLDED flag to distin- guish truncate(1 ? foo : bar, 0) from truncate(foo, 0).
Diffstat (limited to 'op.c')
-rw-r--r--op.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/op.c b/op.c
index 52e600ff8a..b4332271ef 100644
--- a/op.c
+++ b/op.c
@@ -10031,7 +10031,8 @@ Perl_ck_trunc(pTHX_ OP *o)
if (kid->op_type == OP_NULL)
kid = (SVOP*)kid->op_sibling;
if (kid && kid->op_type == OP_CONST &&
- (kid->op_private & OPpCONST_BARE))
+ (kid->op_private & (OPpCONST_BARE|OPpCONST_FOLDED))
+ == OPpCONST_BARE)
{
o->op_flags |= OPf_SPECIAL;
kid->op_private &= ~OPpCONST_STRICT;