Skip to content

Commit

Permalink
Switch is required to new initialization scheme
Browse files Browse the repository at this point in the history
Only one spectest regression from this, which involves a native str
attribute with `is required`, which was probably most getting lucky
before this point.
  • Loading branch information
jnthn committed Dec 7, 2021
1 parent c719eab commit bdb0cc2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/Perl6/World.nqp
Expand Up @@ -3881,13 +3881,15 @@ class Perl6::World is HLL::World {
elsif $code == 8 {

# nqp::unless(
# nqp::attrinited(self,Foo,'$!a'),
# nqp::p6attrinited(nqp::getattr(self,Foo,'$!a')),
# X::Attribute::Required.new(name => '$!a', why => (value))
# ),
$stmts.push(
QAST::Op.new( :op<unless>,
QAST::Op.new( :op<attrinited>,
$!self, $class, $attr
QAST::Op.new( :op<p6attrinited>,
QAST::Op.new( :op<getattr>,
$!self, $class, $attr
)
),
QAST::Op.new( :op<callmethod>, :name<throw>,
QAST::Op.new( :op<callmethod>, :name<new>,
Expand Down
16 changes: 10 additions & 6 deletions src/core.c/Mu.pm6
Expand Up @@ -269,9 +269,11 @@ my class Mu { # declared in BOOTSTRAP
nqp::if(
nqp::iseq_i($code,8),
nqp::unless( # 8
nqp::attrinited(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
nqp::p6attrinited(
nqp::getattr(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
)
),
X::Attribute::Required.new(
name => nqp::atpos($task,2),
Expand Down Expand Up @@ -511,9 +513,11 @@ my class Mu { # declared in BOOTSTRAP
nqp::if(
nqp::iseq_i($code,8),
nqp::unless( # 8
nqp::attrinited(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
nqp::p6attrinited(
nqp::getattr(self,
nqp::atpos($task,1),
nqp::atpos($task,2)
)
),
X::Attribute::Required.new(
name => nqp::atpos($task,2),
Expand Down

0 comments on commit bdb0cc2

Please sign in to comment.