Skip to content

Commit

Permalink
Make pop/shift behaviour re deconting consistent
Browse files Browse the repository at this point in the history
- Array.pop/shift now decont
- sub pop/shift are now raw, as they don't need a decont check
  • Loading branch information
lizmat committed Apr 1, 2020
1 parent 6793713 commit 2edce41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core.c/Array.pm6
Expand Up @@ -847,7 +847,7 @@ my class Array { # declared in BOOTSTRAP
Failure.new(X::Cannot::Empty.new(:$action,:what(self.^name)))
}

method pop(Array:D:) is raw is nodal {
method pop(Array:D:) is nodal {
nqp::if(
self.is-lazy,
self!lazy('pop from'),
Expand All @@ -860,7 +860,7 @@ my class Array { # declared in BOOTSTRAP
)
}

method shift(Array:D:) is raw is nodal {
method shift(Array:D:) is nodal {
nqp::if(
nqp::isconcrete(nqp::getattr(self,List,'$!reified'))
&& nqp::elems(nqp::getattr(self,List,'$!reified')),
Expand Down
4 changes: 2 additions & 2 deletions src/core.c/array_operators.pm6
Expand Up @@ -44,10 +44,10 @@ multi sub circumfix:<[ ]>(Mu \x) { # really only for [$foo]
}

proto sub pop($, *%) {*}
multi sub pop(@a) { @a.pop }
multi sub pop(@a) is raw { @a.pop }

proto sub shift($, *%) {*}
multi sub shift(@a) { @a.shift }
multi sub shift(@a) is raw { @a.shift }

proto sub push($, |) {*}
multi sub push(\a, \b) { a.push: b }
Expand Down

0 comments on commit 2edce41

Please sign in to comment.