Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More minor cleanups, native typing, etc. in Mu.DUMP
  • Loading branch information
japhb committed Apr 8, 2013
1 parent 5adc4db commit 51c9784
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/core/Mu.pm
Expand Up @@ -245,22 +245,23 @@ my class Mu {
return DUMP(self, :$indent-step) unless %ctx;

my Mu $attrs := nqp::list();
for self.^attributes() -> $attr {
my $name := $attr.name;
my $acc_name := $name.substr(2);
my $build_name := $attr.has_accessor ?? $acc_name !! $name;
for self.HOW.attributes(self) -> $attr {
my str $name = $attr.name;
my str $acc_name = nqp::substr($name, 2, nqp::chars($name) - 2);
my str $build_name = $attr.has_accessor ?? $acc_name !! $name;

my Mu $value;
if $attr.has_accessor {
if $attr.has_accessor {
$value := self."$acc_name"();
}
elsif nqp::can($attr, 'get_value') {
$value := $attr.get_value(self);
}
elsif nqp::can($attr, 'package') {
my $decont := nqp::p6decont(self);
my $package := $attr.package;
$value := do given nqp::p6box_i(nqp::objprimspec($attr.type)) {
my Mu $decont := nqp::p6decont(self);
my Mu $package := $attr.package;

$value := do given nqp::p6box_i(nqp::objprimspec($attr.type)) {
when 0 { nqp::getattr( $decont, $package, $name) }
when 1 { nqp::p6box_i(nqp::getattr_i($decont, $package, $name)) }
when 2 { nqp::p6box_n(nqp::getattr_n($decont, $package, $name)) }
Expand Down

0 comments on commit 51c9784

Please sign in to comment.