Skip to content

Commit

Permalink
Make dd show types better
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Dec 27, 2023
1 parent 462a933 commit 57bda88
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/core.c/Any.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,11 @@ sub dd(|c) { # is implementation-detail
my $name :=
!nqp::istype($var.VAR,Failure) && try $var.VAR.name;
$name := '' if $name && ($name eq 'element' | '%');

my @parts = $var.WHAT.^name.split("::");
my $type := @parts.pop;
if @parts {
$type := $type.chop if $type.contains(/ \W $ /);
}

my $type := $name
?? nqp::istype($var,Failure)
?? 'Failure'
!! $var.VAR.of.raku
!! '';
my $what := nqp::can($var,'raku')
?? $var.raku
!! nqp::can($var,'perl')
Expand All @@ -634,6 +632,7 @@ sub dd(|c) { # is implementation-detail
?? BOOTThread($var)
!! "($var.^name() without .raku or .perl method)"
!! "($var.^name() without .raku or .perl method)";

note $name ?? "$type $name = $what" !! $what;
}
}
Expand Down

0 comments on commit 57bda88

Please sign in to comment.