Skip to content

Commit

Permalink
Remove one argument boilerplate for new +@Args
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Oct 3, 2015
1 parent 03a9e73 commit 0ac5dbc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 1 addition & 7 deletions src/core/Baggy.pm
Expand Up @@ -18,13 +18,7 @@ my role Baggy does QuantHash {

method hash(Baggy:D: --> Hash) { %!elems.values.hash }

multi method new(Baggy: \value) {
nqp::iscont(value) || nqp::not_i(nqp::istype(value, Iterable))
?? self!new([value])
!! self!new([|value])
}
multi method new(Baggy: **@args) { self!new(@args) }
method !new(@args) {
multi method new(Baggy: +@args) {
my %e;
# need explicit signature because of #119609
-> $_ { (%e{$_.WHICH} //= ($_ => my $ = 0)).value++ } for @args;
Expand Down
8 changes: 1 addition & 7 deletions src/core/Setty.pm
Expand Up @@ -20,13 +20,7 @@ my role Setty does QuantHash {
%e;
}

multi method new(Setty: \value) {
nqp::iscont(value) || nqp::not_i(nqp::istype(value, Iterable))
?? self!new([value])
!! self!new([|value])
}
multi method new(Setty: **@args) { self!new(@args) }
method !new(@args) {
multi method new(Setty: +@args) {
my %e;
%e{$_.WHICH} = $_ for @args;
self.bless(:elems(%e))
Expand Down

0 comments on commit 0ac5dbc

Please sign in to comment.