Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make @a.VAR.name and %h.VAR.name work
  • Loading branch information
lizmat committed Aug 26, 2013
1 parent 38a0f9a commit 283f763
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/core/Array.pm
Expand Up @@ -9,7 +9,7 @@ class Array { # declared in BOOTSTRAP
nqp::shift($args);
nqp::p6list($args, self.WHAT, Bool::True);
}

multi method at_pos(Array:D: $pos) is rw {
#?if jvm
if nqp::istype($pos, Num) && nqp::isnanorinf($pos) {
Expand Down Expand Up @@ -87,6 +87,11 @@ class Array { # declared in BOOTSTRAP

method flattens() { 1 }

# introspection
method name() {
my $d := $!descriptor;
nqp::isnull($d) ?? Str !! $d.name()
}
method of() {
my $d := $!descriptor;
nqp::isnull($d) ?? Mu !! $d.of;
Expand All @@ -99,7 +104,6 @@ class Array { # declared in BOOTSTRAP
my $d := $!descriptor;
nqp::isnull($d) ?? Mu !! so $d.dynamic;
}

multi method perl(Array:D \SELF:) {
nqp::iscont(SELF)
?? '[' ~ self.map({.perl}).join(', ') ~ ']'
Expand Down
9 changes: 7 additions & 2 deletions src/core/Hash.pm
Expand Up @@ -9,8 +9,7 @@ my class Hash { # declared in BOOTSTRAP
%h.STORE(@args) if @args;
%h;
}
method keyof () { Any }


multi method at_key(Hash:D: $key is copy) is rw {
my Mu $storage := nqp::defined(nqp::getattr(self, EnumMap, '$!storage')) ??
nqp::getattr(self, EnumMap, '$!storage') !!
Expand Down Expand Up @@ -77,6 +76,12 @@ my class Hash { # declared in BOOTSTRAP
self
}

# introspection
method name() {
my $d := $!descriptor;
nqp::isnull($d) ?? Str !! $d.name()
}
method keyof () { Any }
method of() {
my $d := $!descriptor;
nqp::isnull($d) ?? Mu !! $d.of;
Expand Down

0 comments on commit 283f763

Please sign in to comment.