Skip to content

Commit

Permalink
Rework &dd low-level object fixups
Browse files Browse the repository at this point in the history
The original[^1] fix up is too broad a brush as with lazy objects
we can crash when calling their .perl (e.g. `dd gather die`), which
causes misinterpreteting them as low-level stuff.

Fix by using nqp::can to check methods we wanna call exist instead of `try`

[1] 99923747ee7461f4630bac971d63
  • Loading branch information
zoffixznet committed Jan 14, 2018
1 parent fd44f70 commit d0be53a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/Any.pm
Expand Up @@ -605,9 +605,11 @@ sub dd(|) {
my $var := nqp::shift($args);
my $name := try $var.VAR.?name;
my $type := $var.WHAT.^name;
my $what := (try $var.?is-lazy)
my $what := nqp::can($var, 'is-lazy') && $var.is-lazy
?? $var[^10].perl.chop ~ "... lazy list)"
!! (try $var.perl) // "(low-level $var.^name())";
!! nqp::can($var, 'perl')
?? $var.perl
!! "($var.^name() without .perl method)";
note $name ?? "$type $name = $what" !! $what;
}
}
Expand Down

0 comments on commit d0be53a

Please sign in to comment.