Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
remove the candidate argument to bless
warn when it is still passed along.
  • Loading branch information
moritz committed Aug 25, 2013
1 parent 83180ce commit 5caf928
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/core/Backtrace.pm
Expand Up @@ -43,7 +43,7 @@ my class Backtrace is List {

# note that parrot backtraces are RPAs, marshalled to us as Parcel
multi method new(Parcel $bt, Int $offset = 0) {
my $new = self.bless(*);
my $new = self.bless();
for $offset .. $bt.elems - 1 {
my Mu $sub := nqp::getattr(nqp::decont($bt[$_]<sub>), ForeignCode, '$!do');
next if nqp::isnull($sub);
Expand Down
2 changes: 1 addition & 1 deletion src/core/Bag.pm
Expand Up @@ -31,7 +31,7 @@ my class Bag is Iterable does Associative does Baggy {
for @args {
register-arg($_);
}
self.bless(*, :elems(%e));
self.bless(:elems(%e));
}

submethod BUILD (:%!elems) { }
Expand Down
2 changes: 1 addition & 1 deletion src/core/Duration.pm
Expand Up @@ -2,7 +2,7 @@ my class Duration is Cool does Real {
has Rat $.x = 0;
# A linear count of seconds.

method new($x) { self.bless: *, x => $x.Rat }
method new($x) { self.bless: x => $x.Rat }

method Bridge(Duration:D:) { $!x.Num }
method Rat(Duration:D:) { $!x }
Expand Down
4 changes: 2 additions & 2 deletions src/core/IO/Socket/INET.pm
Expand Up @@ -63,7 +63,7 @@ my class IO::Socket::INET does IO::Socket {
%args<listen>.=Bool if %args.exists('listen');

#TODO: Learn what protocols map to which socket types and then determine which is needed.
self.bless(*, |%args)!initialize()
self.bless(|%args)!initialize()
}

method !initialize() {
Expand Down Expand Up @@ -121,7 +121,7 @@ my class IO::Socket::INET does IO::Socket {
method accept() {
#my $new_sock := nqp::create($?CLASS);
## A solution as proposed by moritz
my $new_sock := $?CLASS.bless(*, :$!family, :$!proto, :$!type, :$!input-line-separator);
my $new_sock := $?CLASS.bless(:$!family, :$!proto, :$!type, :$!input-line-separator);
nqp::getattr($new_sock, $?CLASS, '$!buffer') = '';
nqp::bindattr($new_sock, $?CLASS, '$!PIO', nqp::getattr(self, $?CLASS, '$!PIO').accept());
return $new_sock;
Expand Down
2 changes: 1 addition & 1 deletion src/core/Instant.pm
Expand Up @@ -6,7 +6,7 @@ my class Instant is Cool does Real {
# tai-utc::initial-offset. Thus, $.x matches TAI from 1970
# to the present.

method new($x) { self.bless: *, x => $x.Rat }
method new($x) { self.bless: x => $x.Rat }

method from-posix($posix, Bool $prefer-leap-second = False) {
# $posix is in general not expected to be an integer.
Expand Down
2 changes: 1 addition & 1 deletion src/core/Junction.pm
Expand Up @@ -4,7 +4,7 @@ my class Junction { # declared in BOOTSTRAP
# has $!type; # type of Junction

method new(*@values, :$type) {
self.bless(*, :storage(@values.eager), :$type);
self.bless(:storage(@values.eager), :$type);
}

multi method Bool(Junction:D:) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/KeyBag.pm
Expand Up @@ -34,7 +34,7 @@ my class KeyBag does Associative does Baggy {

# Constructor
method new(*@args --> KeyBag) {
self.bless(*, :elems( REGISTER(@args) ));
self.bless(:elems( REGISTER(@args) ));
}

submethod BUILD (:%!elems) { }
Expand Down
2 changes: 1 addition & 1 deletion src/core/KeySet.pm
Expand Up @@ -33,7 +33,7 @@ my class KeySet is Iterable does Associative {
for @args {
register-arg($_);
}
self.bless(*, :elems(%e));
self.bless(:elems(%e));
}

submethod BUILD (:%!elems) { }
Expand Down
14 changes: 7 additions & 7 deletions src/core/Mu.pm
Expand Up @@ -48,7 +48,7 @@ my class Mu { # declared in BOOTSTRAP

proto method new(|) { * }
multi method new(*%attrinit) {
self.bless(*, |%attrinit);
self.bless(|%attrinit);
}
multi method new($, *@) {
X::Constructor::Positional.new(:type( self )).throw();
Expand All @@ -58,12 +58,12 @@ my class Mu { # declared in BOOTSTRAP
nqp::create(self)
}

method bless(Mu \candidate, *@autovivs, *%attrinit) {
# If we were passed *, then need to create a candidate.
my $cand := nqp::istype(candidate, Whatever) ??
nqp::create(self) !!
candidate;
$cand.BUILDALL(@autovivs, %attrinit);
method bless(*@autovivs, *%attrinit) {
if @autovivs && nqp::istype(@autovivs[0], Whatever) {
warn "Passing an object candidate to Mu.bless is deprecated";
@autovivs.shift;
}
nqp::create(self).BUILDALL(@autovivs, %attrinit);
}

method BUILDALL(@autovivs, %attrinit) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/Set.pm
Expand Up @@ -29,7 +29,7 @@ my class Set is Iterable does Associative {
for @args {
register-arg($_);
}
self.bless(*, :elems(%e));
self.bless(:elems(%e));
}

submethod BUILD (:%!elems) { }
Expand Down
12 changes: 6 additions & 6 deletions src/core/Temporal.pm
Expand Up @@ -182,7 +182,7 @@ my class DateTime does Dateish {
}

multi method new(Int :$year!, :&formatter=&default-formatter, *%_) {
my $dt = self.bless(*, :$year, :&formatter, |%_);
my $dt = self.bless(:$year, :&formatter, |%_);
$dt.check-date;
$dt.check-time;
$dt;
Expand Down Expand Up @@ -251,7 +251,7 @@ my class DateTime does Dateish {
my $day = $e - (153 * $m + 2) div 5 + 1;
my $month = $m + 3 - 12 * ($m div 10);
my $year = $b * 100 + $d - 4800 + $m div 10;
self.bless(*, :$year, :$month, :$day,
self.bless(:$year, :$month, :$day,
:$hour, :$minute, :$second,
:&formatter).in-timezone($timezone);
}
Expand Down Expand Up @@ -297,7 +297,7 @@ my class DateTime does Dateish {
method clone-without-validating(*%_) { # A premature optimization.
my %args = { :$!year, :$!month, :$!day, :$!hour, :$!minute,
:$!second, :$!timezone, :&!formatter, %_ };
self.bless(*, |%args);
self.bless(|%args);
}

method Instant() {
Expand Down Expand Up @@ -472,7 +472,7 @@ my class Date does Dateish {
method get-daycount { $!daycount }

multi method new(:$year!, :$month = 1, :$day = 1) {
my $d = self.bless(*, :$year, :$month, :$day);
my $d = self.bless(:$year, :$month, :$day);
$d.check-date;
$d!set-daycount(self.daycount-from-ymd($year,$month,$day));
$d;
Expand Down Expand Up @@ -501,7 +501,7 @@ my class Date does Dateish {
}

multi method new(DateTime $dt) {
self.bless(*,
self.bless(
:year($dt.year), :month($dt.month), :day($dt.day),
:daycount(self.daycount-from-ymd($dt.year,$dt.month,$dt.day))
);
Expand All @@ -519,7 +519,7 @@ my class Date does Dateish {

method new-from-daycount($daycount) {
my ($year, $month, $day) = self.ymd-from-daycount($daycount);
self.bless(*, :$daycount, :$year, :$month, :$day);
self.bless(:$daycount, :$year, :$month, :$day);
}

method today() {
Expand Down
2 changes: 1 addition & 1 deletion src/core/Version.pm
Expand Up @@ -8,7 +8,7 @@ class Version {
$_ .= Numeric if .Numeric.defined ;
$_ = * if $_ eq '*';
}
self.bless(*, :parts(@parts), :plus($s.substr(*-1) eq '+'));
self.bless(:parts(@parts), :plus($s.substr(*-1) eq '+'));
};

multi method Str(Version:D:) {
Expand Down
2 changes: 1 addition & 1 deletion src/vm/jvm/core/Threading.pm
Expand Up @@ -312,7 +312,7 @@ my class KeyReducer {
has $!obtained;

method new($initializer, $reducer) {
self.bless(*, :$initializer, :$reducer)
self.bless(:$initializer, :$reducer)
}

my Mu $interop;
Expand Down

0 comments on commit 5caf928

Please sign in to comment.