summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-12-18 20:48:40 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-12-18 20:48:40 -0800
commitc75b48285099abf58b5c90c62f8088a00a8c2b66 (patch)
tree36cb59bf1232abcd8e94d1b0ee33119c00938b1f
parent0a872c7df46b0d0c100826616b6580f25de86070 (diff)
downloadperl-c75b48285099abf58b5c90c62f8088a00a8c2b66.tar.gz
Fix deparsing of require "a".$1
Commit 30fcd6c41 tried to deparse ‘no 6’ correctly by checking whether the kidop of a require has the OPpCONST_NOVER flag set, but it did not check the op type, so it ended up with a false positive for any binop (OPpCONST_NOVER being 2).
-rw-r--r--dist/B-Deparse/Deparse.pm5
-rw-r--r--dist/B-Deparse/t/deparse.t3
2 files changed, 7 insertions, 1 deletions
diff --git a/dist/B-Deparse/Deparse.pm b/dist/B-Deparse/Deparse.pm
index 977ce4d4ab..3ca229df16 100644
--- a/dist/B-Deparse/Deparse.pm
+++ b/dist/B-Deparse/Deparse.pm
@@ -1889,7 +1889,10 @@ sub pp_require {
} else {
$self->unop(
$op, $cx,
- $op->first->private & OPpCONST_NOVER ? "no" : $opname,
+ $op->first->name eq 'const'
+ && $op->first->private & OPpCONST_NOVER
+ ? "no"
+ : $opname,
1, # llafr does not apply
);
}
diff --git a/dist/B-Deparse/t/deparse.t b/dist/B-Deparse/t/deparse.t
index 2c3efd5797..22f2cb533e 100644
--- a/dist/B-Deparse/t/deparse.t
+++ b/dist/B-Deparse/t/deparse.t
@@ -893,3 +893,6 @@ pipe local *FH, local *FH;
####
# [perl #74740] -(f()) vs -f()
$_ = -(f());
+####
+# require <binop>
+require 'a' . $1;