Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't call BUILD in new
  • Loading branch information
lizmat committed Jul 29, 2015
1 parent eaf57d7 commit f7cdcd9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 27 deletions.
7 changes: 2 additions & 5 deletions src/core/Backtrace.pm
Expand Up @@ -50,10 +50,7 @@ my class Backtrace {
has Mu $!frames;
has Int $!bt-next; # next bt index to vivify

submethod BUILD(:$!bt, :$!bt-next) {
$!frames := nqp::list;
self;
}
submethod BUILD(:$!bt, :$!bt-next) { $!frames := nqp::list }

multi method new(Mu $e, Int $offset = 0) {
$e.^name eq 'BOOTException'
Expand All @@ -72,7 +69,7 @@ my class Backtrace {
# only check for verbose stack frames once
$RAKUDO-VERBOSE-STACKFRAME = +(%*ENV<RAKUDO_VERBOSE_STACKFRAME> // 0);

nqp::create(self).BUILD(:$bt, :$bt-next);
self.bless(:$bt, :$bt-next);
}

method AT-POS($pos) {
Expand Down
5 changes: 1 addition & 4 deletions src/core/Capture.pm
Expand Up @@ -3,9 +3,7 @@ my class Capture { # declared in BOOTSTRAP
# has Mu $!list; # positional parameters
# has Mu $!hash; # named parameters

method new(:@list,:%hash) {
nqp::create(self).BUILD(:@list,:%hash);
}
method new(:@list,:%hash) { self.bless(:@list,:%hash) }

method from-args(|c) { c }

Expand All @@ -15,7 +13,6 @@ my class Capture { # declared in BOOTSTRAP
);
my Mu $hs := nqp::getattr(nqp::decont(%hash), EnumMap, '$!storage');
nqp::bindattr(self, Capture, '$!hash', nqp::ishash($hs) ?? $hs !! nqp::hash());
self;
}
multi method WHICH (Capture:D:) {
my $WHICH = self.^name;
Expand Down
22 changes: 4 additions & 18 deletions src/core/native_array.pm
Expand Up @@ -159,15 +159,8 @@ class array is Iterable is repr('VMArray') {
has $!reified; # Parcel of native array refs we return after reifying
has int $!idx; # Starting index of this iterator

method new($array) {
my \iter = nqp::create(self);
iter.BUILD(:$array);
iter
}

submethod BUILD(:$array) {
$!array := nqp::decont($array);
}
method new($array) { self.bless(:$array) }
submethod BUILD(:$array) { $!array := nqp::decont($array) }

method reify($n) { # :$sink is not needed here
unless nqp::isconcrete($!reified) {
Expand Down Expand Up @@ -365,15 +358,8 @@ class array is Iterable is repr('VMArray') {
has $!reified; # Parcel of native array refs we return after reifying
has int $!idx; # Starting index of this iterator

method new($array) {
my \iter = nqp::create(self);
iter.BUILD(:$array);
iter
}

submethod BUILD(:$array) {
$!array := nqp::decont($array);
}
method new($array) { self.bless(:$array) }
submethod BUILD(:$array) { $!array := nqp::decont($array) }

method reify($n, :$sink) {
unless nqp::isconcrete($!reified) {
Expand Down

0 comments on commit f7cdcd9

Please sign in to comment.