Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow Buf at_pos to return an l-value.
Makes various kinds of assignment work out properly.
  • Loading branch information
jnthn committed Feb 7, 2015
1 parent 32ad78f commit 3409067
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/Buf.pm
Expand Up @@ -254,13 +254,13 @@ my role Buf[::T = uint8] does Blob[T] is repr('VMArray') is array_type(T) {
multi method at_pos(Buf:D: int \pos) {
fail X::OutOfRange.new(:what<Index>,:got(pos),:range<0..Inf>)
if nqp::islt_i(pos,0);
nqp::atpos_i(self, pos);
nqp::atposref_i(self, pos);
}
multi method at_pos(Buf:D: Int:D \pos) {
my int $pos = nqp::unbox_i(pos);
fail X::OutOfRange.new(:what<Index>,:got(pos),:range<0..Inf>)
if nqp::islt_i($pos,0);
nqp::atpos_i(self,$pos);
nqp::atposref_i(self,$pos);
}

multi method assign_pos(Buf:D: int \pos, Mu \assignee) {
Expand Down

0 comments on commit 3409067

Please sign in to comment.