Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
First round of getting us more honest with routine rw-ness.
  • Loading branch information
jnthn committed Jul 9, 2011
1 parent 9298db6 commit 6a28829
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/core/Array.pm
Expand Up @@ -7,7 +7,7 @@ class Array {
nqp::p6list($args, self.WHAT, Bool::True);
}

method at_pos($pos is copy) {
method at_pos($pos is copy) is rw {
$pos = $pos.Int;
self.exists($pos)
?? pir::find_method__PPs(List, 'at_pos')(self, $pos)
Expand All @@ -33,7 +33,7 @@ class Array {
pir::find_method__PPs(List, 'REIFY')(self, $parcel)
}

method STORE_AT_POS(\$pos, Mu $v is copy) {
method STORE_AT_POS(\$pos, Mu $v is copy) is rw {
pir::find_method__PPs(List, 'STORE_AT_POS')(self, $pos, $v);
}

Expand Down
11 changes: 5 additions & 6 deletions src/core/Attribute.pm
Expand Up @@ -9,19 +9,18 @@ my class Attribute {
my $dcpkg := pir::perl6_decontainerize__PP($package);
my $meth := self.rw
??
method (Mu $self:) {
method (Mu $self:) is rw {
nqp::getattr(
pir::perl6_decontainerize__PP($self),
$dcpkg,
nqp::unbox_s($name))
}
!!
method (Mu $self:) {
pir::perl6_decontainerize__PP(
nqp::getattr(
pir::perl6_decontainerize__PP($self),
$dcpkg,
nqp::unbox_s($name)))
nqp::getattr(
pir::perl6_decontainerize__PP($self),
$dcpkg,
nqp::unbox_s($name))
};
$package.HOW.add_method($package, $meth_name, $meth);
}
Expand Down
5 changes: 2 additions & 3 deletions src/core/EnumMap.pm
Expand Up @@ -41,11 +41,10 @@ my class EnumMap does Associative {
!! Any
}

method STORE_AT_KEY(Str \$key, Mu \$value) {
method STORE_AT_KEY(Str \$key, Mu \$value) is rw {
pir::defined($!storage) ||
nqp::bindattr(self, EnumMap, '$!storage', pir::new__Ps('Hash'));
pir::set__2QsP($!storage, nqp::unbox_s($key), $value);
$value # XXX PAST bug, it seems; the 2 in the above sig isn't followed
pir::set__1QsP($!storage, nqp::unbox_s($key), $value)
}

method ARGLIST_FLATTENABLE() { $!storage }
Expand Down
4 changes: 2 additions & 2 deletions src/core/Hash.pm
@@ -1,7 +1,7 @@
my class Hash {
# Has attributes and parent EnumMap declared in BOOTSTRAP

method at_key($key is copy) {
method at_key($key is copy) is rw {
$key = $key.Str;
self.exists($key)
?? pir::find_method__PPs(EnumMap, 'at_key')(self, $key)
Expand All @@ -15,7 +15,7 @@ my class Hash {
!! '(' ~ self.pairs.map({.perl}).join(', ') ~ ').hash'
}

method STORE_AT_KEY(Str \$key, Mu $x is copy) {
method STORE_AT_KEY(Str \$key, Mu $x is copy) is rw {
pir::find_method__PPs(EnumMap, 'STORE_AT_KEY')(self, $key, $x);
}

Expand Down
1 change: 1 addition & 0 deletions src/core/Routine.pm
@@ -1,4 +1,5 @@
my class Routine {
method of() { self.signature.returns }
method returns() { self.signature.returns }
method rw() { $!rw }
}
2 changes: 1 addition & 1 deletion src/core/operators.pm
Expand Up @@ -3,7 +3,7 @@
## generic string operators are in Stringy.pm
## Int/Rat/Num operators are in {Int|Rat|Num}.pm

sub infix:<=>(Mu \$a, Mu \$b) {
sub infix:<=>(Mu \$a, Mu \$b) is rw {
pir::perl6_container_store__0PP($a, $b)
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/stubs.pm
Expand Up @@ -12,7 +12,7 @@ my class KeyHash is Iterable does Associative { }
my class Capture { }
my class Seq is List does Positional { }

sub DYNAMIC(\$name) {
sub DYNAMIC(\$name) is rw {
my Mu $x := pir::find_dynamic_lex__Ps(nqp::unbox_s($name));
if nqp::isnull($x) {
my $pkgname = nqp::p6box_s(pir::replace__Ssiis(nqp::unbox_s($name), 1, 1, ''));
Expand Down

0 comments on commit 6a28829

Please sign in to comment.