diff options
author | Robin Houston <robin@cpan.org> | 2001-04-27 20:15:14 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-04-28 14:07:27 +0000 |
commit | c102638c8fb55e92563d5ee4166f31857d9102fc (patch) | |
tree | a611732cac2454695b21c59ceb8ad6a1937f3f7b /ext/B | |
parent | fd612ef86c82d11a37451698a54a49edb4e0dd8f (diff) | |
download | perl-c102638c8fb55e92563d5ee4166f31857d9102fc.tar.gz |
non-block scopes
Message-ID: <20010427191514.A30951@puffinry.freeserve.co.uk>
p4raw-id: //depot/perl@9891
Diffstat (limited to 'ext/B')
-rw-r--r-- | ext/B/B/Deparse.pm | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index e8ebb39774..7e57a58b51 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -1024,7 +1024,22 @@ sub scopeop { } } -sub pp_scope { scopeop(0, @_); } +sub invoker { + my $caller = (caller(2))[3]; + if ($caller eq "B::Deparse::deparse") { + return (caller(3))[3]; + } + else { + return $caller; + } +} + +sub pp_scope { + my ($self, $op, $cx) = @_; + my $body = scopeop(0, @_); + return $body if $cx > 0 || invoker() ne "B::Deparse::lineseq"; + return "do {\n\t$body\n\b};"; +} sub pp_lineseq { scopeop(0, @_); } sub pp_leave { scopeop(1, @_); } @@ -2347,6 +2362,8 @@ sub pp_null { return $self->maybe_parens($self->deparse($op->first, 20) . " =~ " . $self->deparse($op->first->sibling, 20), $cx, 20); + } elsif ($op->flags & OPf_SPECIAL && $cx == 0 && !$op->targ) { + return "do {\n\t". $self->deparse($op->first, $cx) ."\n\b};"; } else { return $self->deparse($op->first, $cx); } |