From: Steffen Mueller Date: Mon, 24 Feb 2014 13:39:08 +0000 (+0100) Subject: B::Deparse: Padrange deparse fix X-Git-Tag: upstream/5.20.0~311 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=76e14ed3b2ac8d27e3f78744ebd1ee96593a8fc6;p=platform%2Fupstream%2Fperl.git B::Deparse: Padrange deparse fix The PADRANGE support fakes up a PUSHMARK OP but until this commit, it did so incompletely since it never overrode the OP type (that was still an OP_PADRANGE). This addresses that. On top of it, there's two minor changes that switch from "eq" to "==" for comparing numeric OP types. --- diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index 1ee7aea..3376fc3 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -316,6 +316,9 @@ BEGIN { +BEGIN { for (qw[ const stringify rv2sv list glob pushmark null]) { + eval "sub OP_\U$_ () { " . opnumber($_) . "}" +}} # _pessimise_walk(): recursively walk the optree of a sub, # possibly undoing optimisations along the way. @@ -345,6 +348,7 @@ sub _pessimise_walk { # the original gv[_]. $B::overlay->{$$op} = { + type => OP_PUSHMARK, name => 'pushmark', private => ($op->private & OPpLVAL_INTRO), next => ($op->flags & OPf_SPECIAL) @@ -3208,10 +3212,6 @@ sub pp_leavetry { return "eval {\n\t" . $self->pp_leave(@_) . "\n\b}"; } -BEGIN { for (qw[ const stringify rv2sv list glob ]) { - eval "sub OP_\U$_ () { " . opnumber($_) . "}" -}} - sub pp_null { my $self = shift; my($op, $cx) = @_; @@ -3388,7 +3388,7 @@ sub pp_av2arylen { sub pp_rv2cv { my ($self, $op, $cx) = @_; if (!null($op->first) && $op->first->name eq 'null' && - $op->first->targ eq OP_LIST) + $op->first->targ == OP_LIST) { return $self->rv2x($op->first->first->sibling, $cx, "&") } @@ -4634,7 +4634,7 @@ sub pure_string { } elsif ($type eq 'join') { my $join_op = $op->first->sibling; # Skip pushmark - return 0 unless $join_op->name eq 'null' && $join_op->targ eq OP_RV2SV; + return 0 unless $join_op->name eq 'null' && $join_op->targ == OP_RV2SV; my $gvop = $join_op->first; return 0 unless $gvop->name eq 'gvsv';