Skip to content

Commit

Permalink
Make Attribute's $!package point at the actual owner
Browse files Browse the repository at this point in the history
Fixes `get_value` method. Before the fix `$!package` contained the
initial parametric role. With introduction of `$!original` a while ago
the original role package can be obtained via the original attribute
instance.
  • Loading branch information
vrurg committed Dec 21, 2020
1 parent 184079c commit 5bc394f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core.c/Attribute.pm6
Expand Up @@ -22,6 +22,8 @@ my class Attribute { # declared in BOOTSTRAP

method compose(Mu $package, :$compiler_services) {
return if $!composed;
my $dcpkg := nqp::decont($package);
nqp::bindattr(self, Attribute, '$!package', $dcpkg);
# Generate accessor method, if we're meant to have one.
if self.has_accessor {
my str $name = nqp::unbox_s(self.name);
Expand All @@ -31,7 +33,6 @@ my class Attribute { # declared in BOOTSTRAP
|| (nqp::can($package.HOW, 'has_multi_candidate')
&& $package.^has_multi_candidate($meth_name))
{
my $dcpkg := nqp::decont($package);
my $meth;
my int $attr_type = nqp::objprimspec($!type);

Expand Down

0 comments on commit 5bc394f

Please sign in to comment.