sub pp_scalar {
my $self = shift;
- my($op, $cv) = @_;
+ my($op, $cx) = @_;
my $kid = $op->first;
if (not null $kid->sibling) {
# XXX Was a here-doc
sub anon_hash_or_list {
my $self = shift;
- my $op = shift;
+ my($op, $cx) = @_;
my($pre, $post) = @{{"anonlist" => ["[","]"],
"anonhash" => ["{","}"]}->{$op->name}};
$expr = $self->deparse($op, 6);
push @exprs, $expr;
}
+ if ($pre eq "{" and $cx < 1) {
+ # Disambiguate that it's not a block
+ $pre = "+{";
+ }
return $pre . join(", ", @exprs) . $post;
}
sub pp_anonlist {
- my ($self, $op) = @_;
+ my $self = shift;
+ my ($op, $cx) = @_;
if ($op->flags & OPf_SPECIAL) {
- return $self->anon_hash_or_list($op);
+ return $self->anon_hash_or_list($op, $cx);
}
warn "Unexpected op pp_" . $op->name() . " without OPf_SPECIAL";
return 'XXX';
if ($kid->name eq "null") {
$kid = $kid->first;
if ($kid->name eq "anonlist" || $kid->name eq "anonhash") {
- return $self->anon_hash_or_list($op);
+ return $self->anon_hash_or_list($op, $cx);
} elsif (!null($kid->sibling) and
$kid->sibling->name eq "anoncode") {
return "sub " .