summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorStephen McCamant <smcc@mit.edu>2002-10-30 20:35:29 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-11-06 20:08:53 +0000
commit62e36f8a468863e09ecdb7f4dfc6bb112b1a327e (patch)
treedf0bc03c411fb6239a942181d61e6ee8b2b1b680 /ext
parentf5e3445d922108beb0eda8afa05a86411da18e40 (diff)
downloadperl-62e36f8a468863e09ecdb7f4dfc6bb112b1a327e.tar.gz
Re: [PATCH] [perl #18175] B::Concise,-exec doesn't handle // operator well
Message-ID: <15808.53041.181907.308803@syllepsis.MIT.EDU> plus a test case in ext/B/t/concise.t plus a (less intrusive, but less future-proof) fix for a similar problem in B::walkoptree_exec(). p4raw-id: //depot/perl@18114
Diffstat (limited to 'ext')
-rw-r--r--ext/B/B.pm2
-rw-r--r--ext/B/B/Concise.pm5
-rw-r--r--ext/B/t/concise.t12
3 files changed, 14 insertions, 5 deletions
diff --git a/ext/B/B.pm b/ext/B/B.pm
index 564b6758cc..c1bd852d20 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -176,7 +176,7 @@ sub walkoptree_exec {
$op->$method($level);
$ppname = $op->name;
if ($ppname =~
- /^(or|and|mapwhile|grepwhile|entertry|range|cond_expr)$/)
+ /^(d?or(assign)?|and(assign)?|mapwhile|grepwhile|entertry|range|cond_expr)$/)
{
print $prefix, uc($1), " => {\n";
walkoptree_exec($op->other, $method, $level + 1);
diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm
index 161bf6b28c..11660883c1 100644
--- a/ext/B/B/Concise.pm
+++ b/ext/B/B/Concise.pm
@@ -1,5 +1,5 @@
package B::Concise;
-# Copyright (C) 2000, 2001 Stephen McCamant. All rights reserved.
+# Copyright (C) 2000-2002 Stephen McCamant. All rights reserved.
# This program is free software; you can redistribute and/or modify it
# under the same terms as Perl itself.
@@ -234,8 +234,7 @@ sub walk_exec {
last if $opsseen{$$op}++;
push @$targ, $op;
my $name = $op->name;
- if ($name
- =~ /^(or|and|(map|grep)while|entertry|range|cond_expr)$/) {
+ if (class($op) eq "LOGOP") {
my $ar = [];
push @$targ, $ar;
push @todo, [$op->other, $ar];
diff --git a/ext/B/t/concise.t b/ext/B/t/concise.t
index a567a73202..86a645c001 100644
--- a/ext/B/t/concise.t
+++ b/ext/B/t/concise.t
@@ -6,7 +6,7 @@ BEGIN {
require './test.pl';
}
-plan tests => 4;
+plan tests => 5;
require_ok("B::Concise");
@@ -24,3 +24,13 @@ is($op_base, 1, "Smallest OP sequence number");
is($op_base_p1, 2, "Second-smallest OP sequence number");
is($cop_base, 1, "Smallest COP sequence number");
+
+# test that with -exec B::Concise navigates past logops (bug #18175)
+
+$out = runperl(
+ switches => ["-MO=Concise,-exec"],
+ prog => q{$a//=$b && print q/foo/},
+ stderr => 1,
+);
+
+like($out, qr/"foo"/, "-exec option with //=");