Skip to content

Commit

Permalink
Switch defaults to new initialization scheme
Browse files Browse the repository at this point in the history
This passes test/spectest right away - which is positive, although may
also be a case of needing more tests.
  • Loading branch information
jnthn committed Nov 9, 2021
1 parent aca7dbf commit 1a40ea3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
13 changes: 5 additions & 8 deletions src/Perl6/World.nqp
Expand Up @@ -3731,18 +3731,15 @@ class Perl6::World is HLL::World {
# 4 = set opaque with default if not set yet
elsif $code == 4 || $code == 14 {

# nqp::unless(
# nqp::attrinited(self,Foo,'$!a'),
my $unless := QAST::Op.new( :op<unless>,
QAST::Op.new( :op<attrinited>,
$!self, $class, $attr
)
);

# nqp::getattr(self,Foo,'$!a')
my $getattr := QAST::Op.new( :op<getattr>,
$!self, $class, $attr
);
# nqp::unless(
# nqp::p6attrinited(nqp::getattr(self,Foo,'$!a')),
my $unless := QAST::Op.new( :op<unless>,
QAST::Op.new( :op<p6attrinited>, $getattr )
);

my $initializer := nqp::istype(
nqp::atpos($task,3),$!Block
Expand Down
32 changes: 20 additions & 12 deletions src/core.c/Mu.pm6
Expand Up @@ -192,9 +192,11 @@ my class Mu { # declared in BOOTSTRAP
nqp::if(
nqp::iseq_i($code,4),
nqp::unless( # 4
nqp::attrinited(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
nqp::p6attrinited(
nqp::getattr(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
)
),
nqp::if(
nqp::istype(nqp::atpos($task,3),Block),
Expand Down Expand Up @@ -330,9 +332,11 @@ my class Mu { # declared in BOOTSTRAP
nqp::if(
nqp::iseq_i($code,14),
nqp::unless( # 14
nqp::attrinited(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
nqp::p6attrinited(
nqp::getattr(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
)
),
nqp::bindattr(self,
nqp::atpos($task,1),
Expand Down Expand Up @@ -430,9 +434,11 @@ my class Mu { # declared in BOOTSTRAP
nqp::if(
nqp::iseq_i($code,4),
nqp::unless( # 4
nqp::attrinited(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
nqp::p6attrinited(
nqp::getattr(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
)
),
nqp::if(
nqp::istype(nqp::atpos($task,3),Block),
Expand Down Expand Up @@ -590,9 +596,11 @@ my class Mu { # declared in BOOTSTRAP
nqp::if(
nqp::iseq_i($code,14),
nqp::unless( # 14
nqp::attrinited(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
nqp::p6attrinited(
nqp::getattr(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
)
),
nqp::bindattr(self,
nqp::atpos($task,1),nqp::atpos($task,2),
Expand Down

0 comments on commit 1a40ea3

Please sign in to comment.