Change 30315 by [EMAIL PROTECTED] on 2007/02/15 13:10:31

        Subject: Re: Patch for Deep recursion in B::Deparse
        From: Ash Berlin <[EMAIL PROTECTED]>
        Date: Thu, 15 Feb 2007 10:47:15 +0000
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/ext/B/B/Deparse.pm#174 edit

Differences ...

==== //depot/perl/ext/B/B/Deparse.pm#174 (text) ====
Index: perl/ext/B/B/Deparse.pm
--- perl/ext/B/B/Deparse.pm#173~29629~  2006-12-28 12:02:03.000000000 -0800
+++ perl/ext/B/B/Deparse.pm     2007-02-15 05:10:31.000000000 -0800
@@ -20,7 +20,7 @@
          CVf_METHOD CVf_LOCKED CVf_LVALUE CVf_ASSERTION
         PMf_KEEP PMf_GLOBAL PMf_CONTINUE PMf_EVAL PMf_ONCE PMf_SKIPWHITE
         PMf_MULTILINE PMf_SINGLELINE PMf_FOLD PMf_EXTENDED);
-$VERSION = 0.80;
+$VERSION = 0.81;
 use strict;
 use vars qw/$AUTOLOAD/;
 use warnings ();
@@ -1316,21 +1316,25 @@
     carp("Undefined op in find_scope") if !defined $op;
     return ($scope_st, $scope_en) unless $op->flags & OPf_KIDS;
 
-    for (my $o=$op->first; $$o; $o=$o->sibling) {
-       if ($o->name =~ /^pad.v$/ && $o->private & OPpLVAL_INTRO) {
-           my $s = int($self->padname_sv($o->targ)->COP_SEQ_RANGE_LOW);
-           my $e = $self->padname_sv($o->targ)->COP_SEQ_RANGE_HIGH;
-           $scope_st = $s if !defined($scope_st) || $s < $scope_st;
-           $scope_en = $e if !defined($scope_en) || $e > $scope_en;
-       }
-       elsif (is_state($o)) {
-           my $c = $o->cop_seq;
-           $scope_st = $c if !defined($scope_st) || $c < $scope_st;
-           $scope_en = $c if !defined($scope_en) || $c > $scope_en;
-       }
-       elsif ($o->flags & OPf_KIDS) {
-           ($scope_st, $scope_en) =
-               $self->find_scope($o, $scope_st, $scope_en)
+    my @queue = ($op);
+    while(my $op = shift @queue ) {
+       for (my $o=$op->first; $$o; $o=$o->sibling) {
+           if ($o->name =~ /^pad.v$/ && $o->private & OPpLVAL_INTRO) {
+               my $s = int($self->padname_sv($o->targ)->COP_SEQ_RANGE_LOW);
+               my $e = $self->padname_sv($o->targ)->COP_SEQ_RANGE_HIGH;
+               $scope_st = $s if !defined($scope_st) || $s < $scope_st;
+               $scope_en = $e if !defined($scope_en) || $e > $scope_en;
+               return ($scope_st, $scope_en);
+           }
+           elsif (is_state($o)) {
+               my $c = $o->cop_seq;
+               $scope_st = $c if !defined($scope_st) || $c < $scope_st;
+               $scope_en = $c if !defined($scope_en) || $c > $scope_en;
+               return ($scope_st, $scope_en);
+           }
+           elsif ($o->flags & OPf_KIDS) {
+               unshift (@queue, $o);
+           }
        }
     }
 
End of Patch.

Reply via email to