From: Jarkko Hietaniemi Date: Sat, 25 Nov 2000 17:39:08 +0000 (+0000) Subject: Undo #7848. Some of the code seems to use walkoptree(), X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f6c2d85bfbab1ff4d6196adc4caad35434546a3a;p=p5sagit%2Fp5-mst-13.2.git Undo #7848. Some of the code seems to use walkoptree(), some walkoptree_slow(). An unfinished renaming? Now the sub is walkoptree() (which is @EXPORT_OK), the walkoptree_slow() is a typeglob alias to walkoptree. This makes the tests to pass, at least. p4raw-id: //depot/perl@7854 --- diff --git a/ext/B/B.pm b/ext/B/B.pm index 5a064d4..a9ea704 100644 --- a/ext/B/B.pm +++ b/ext/B/B.pm @@ -9,13 +9,12 @@ package B; use XSLoader (); require Exporter; @ISA = qw(Exporter); -@EXPORT_OK = - qw(minus_c ppname save_BEGINs - class peekop cast_I32 cstring cchar hash threadsv_names - main_root main_start main_cv svref_2object opnumber amagic_generation - walkoptree_slow walkoptree_exec walksymtable - parents comppadlist sv_undef compile_stats timing_info - begin_av init_av end_av); +@EXPORT_OK = qw(minus_c ppname save_BEGINs + class peekop cast_I32 cstring cchar hash threadsv_names + main_root main_start main_cv svref_2object opnumber amagic_generation + walkoptree_slow walkoptree walkoptree_exec walksymtable + parents comppadlist sv_undef compile_stats timing_info + begin_av init_av end_av); sub OPf_KIDS (); use strict; @B::SV::ISA = 'B::OBJECT'; @@ -81,7 +80,7 @@ sub peekop { return sprintf("%s (0x%x) %s", class($op), $$op, $op->name); } -sub walkoptree_slow { +sub walkoptree { my($op, $method, $level) = @_; $op_count++; # just for statistics $level ||= 0; @@ -91,12 +90,14 @@ sub walkoptree_slow { my $kid; unshift(@parents, $op); for ($kid = $op->first; $$kid; $kid = $kid->sibling) { - walkoptree_slow($kid, $method, $level + 1); + walkoptree($kid, $method, $level + 1); } shift @parents; } } +*walkoptree_slow = \&walkoptree; # Who is using this? + sub compile_stats { return "Total number of OPs processed: $op_count\n"; } diff --git a/ext/B/B/Lint.pm b/ext/B/B/Lint.pm index ed0d07d..094b3cf 100644 --- a/ext/B/B/Lint.pm +++ b/ext/B/B/Lint.pm @@ -116,7 +116,7 @@ Malcolm Beattie, mbeattie@sable.ox.ac.uk. =cut use strict; -use B qw(walkoptree_slow main_root walksymtable svref_2object parents +use B qw(walkoptree main_root walksymtable svref_2object parents OPf_WANT_LIST OPf_WANT OPf_STACKED G_ARRAY ); @@ -277,12 +277,12 @@ sub B::GV::lintcv { return if !$$cv || $done_cv{$$cv}++; my $root = $cv->ROOT; #warn " root = $root (0x$$root)\n";#debug - walkoptree_slow($root, "lint") if $$root; + walkoptree($root, "lint") if $$root; } sub do_lint { my %search_pack; - walkoptree_slow(main_root, "lint") if ${main_root()}; + walkoptree(main_root, "lint") if ${main_root()}; # Now do subs in main no strict qw(vars refs); diff --git a/ext/B/B/Terse.pm b/ext/B/B/Terse.pm index 66b5cfc..7c9bd68 100644 --- a/ext/B/B/Terse.pm +++ b/ext/B/B/Terse.pm @@ -1,6 +1,6 @@ package B::Terse; use strict; -use B qw(peekop class walkoptree_slow walkoptree_exec +use B qw(peekop class walkoptree walkoptree_exec main_start main_root cstring svref_2object); use B::Asmdata qw(@specialsv_name); @@ -10,7 +10,7 @@ sub terse { if ($order eq "exec") { walkoptree_exec($cv->START, "terse"); } else { - walkoptree_slow($cv->ROOT, "terse"); + walkoptree($cv->ROOT, "terse"); } } @@ -31,7 +31,7 @@ sub compile { if ($order eq "exec") { return sub { walkoptree_exec(main_start, "terse") } } else { - return sub { walkoptree_slow(main_root, "terse") } + return sub { walkoptree(main_root, "terse") } } } }