diff --git a/src/Perl6/Metamodel/BUILDPLAN.nqp b/src/Perl6/Metamodel/BUILDPLAN.nqp index 8e6bf16f5a1..bb3ab786e1e 100644 --- a/src/Perl6/Metamodel/BUILDPLAN.nqp +++ b/src/Perl6/Metamodel/BUILDPLAN.nqp @@ -18,7 +18,7 @@ role Perl6::Metamodel::BUILDPLAN { # 2 class name attr_name = set a native num attribute from init hash # 3 class name attr_name = set a native str attribute from init hash # 4 class attr_name code = call default value closure if needed - # 5 class attr_name code = call default value closure if needed, int attr + # 5 class attr_name code = call default value closure if needed, int or uint attr # 6 class attr_name code = call default value closure if needed, num attr # 7 class attr_name code = call default value closure if needed, str attr # 8 die if a required attribute is not present @@ -31,6 +31,7 @@ role Perl6::Metamodel::BUILDPLAN { # 15 die if a required int attribute is 0 # 16 die if a required num attribute is 0e0 # 17 die if a required str attribute is null_s (will be '' in the future) + # 24 die if a required uint attribute is 0 method create_BUILDPLAN($obj) { # First, we'll create the build plan for just this class. my @plan; @@ -138,7 +139,7 @@ role Perl6::Metamodel::BUILDPLAN { if nqp::can($_, 'required') && $_.required { my $type := $_.type; my int $primspec := nqp::objprimspec($type); - my int $op := $primspec ?? 14 + $primspec !! 8; + my int $op := $primspec ?? $primspec == 10 ?? 24 !! 14 + $primspec !! 8; nqp::push(@plan,[$op, $obj, $_.name, $_.required]); nqp::deletekey(%attrs_untouched, $_.name); } @@ -159,7 +160,7 @@ role Perl6::Metamodel::BUILDPLAN { # compile check constants for correct type if nqp::isconcrete($default) { my $name := $_.name; - my $opcode := $primspec || !$_.is_bound ?? 4 + $primspec !! 14; + my $opcode := $primspec || !$_.is_bound ?? $primspec == 10 ?? 5 !! 4 + $primspec !! 14; my @action := [$opcode, $obj, $name, $default]; # binding defaults to additional check at runtime diff --git a/src/Perl6/World.nqp b/src/Perl6/World.nqp index f66c187a124..30d3cbd6a88 100644 --- a/src/Perl6/World.nqp +++ b/src/Perl6/World.nqp @@ -3895,7 +3895,7 @@ class Perl6::World is HLL::World { # 15 = die if int is 0 # 16 = die if num is 0e0 # 17 = die if str is null_s - elsif $code == 8 || $code >= 15 && $code <= 17 { + elsif $code == 8 || $code >= 15 && $code <= 17 || $code == 24 { # nqp::unless( # nqp::p6attrinited(nqp::getattr(self,Foo,'$!a')), # X::Attribute::Required.new(name => '$!a', why => (value)) @@ -3920,6 +3920,11 @@ class Perl6::World is HLL::World { ) ); } + elsif $code == 24 { + $check := QAST::Op.new( :op, + $!self, $class, $attr + ); + } else { $check := QAST::Op.new( :op, QAST::Op.new( :op, diff --git a/tools/templates/NQP_REVISION b/tools/templates/NQP_REVISION index 2390b4f3cd7..1fa762499e1 100644 --- a/tools/templates/NQP_REVISION +++ b/tools/templates/NQP_REVISION @@ -1 +1 @@ -2021.12-34-g7a93ff143 +2021.12-37-gc743974ec