Skip to content

Commit

Permalink
RakuAST: worry about adding an attribute to a package
Browse files Browse the repository at this point in the history
that cannot support attributes, instead of throwing an exception
because it cannot find the method.
  • Loading branch information
lizmat committed Nov 9, 2023
1 parent 37e8d29 commit 9438ef1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Raku/ast/variable-declaration.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,18 @@ class RakuAST::VarDeclaration::Simple
}
}

method PERFORM-BEGIN(RakuAST::Resolver $resolver, RakuAST::IMPL::QASTContext $context) {
method PERFORM-BEGIN(
RakuAST::Resolver $resolver,
RakuAST::IMPL::QASTContext $context
) {
my str $scope := self.scope;
if $!attribute-package && ($scope eq 'has' || $scope eq 'HAS') {
$!attribute-package.ATTACH-ATTRIBUTE(self);
$!attribute-package.can-have-attributes
?? $!attribute-package.ATTACH-ATTRIBUTE(self)
!! $resolver.add-worry: # XXX should be self.add-worry
$resolver.build-exception: 'X::Attribute::Package',
name => self.name,
package-kind => $!attribute-package.declarator;
}

# Process traits for `is Type` and `of Type`, which get special
Expand Down

0 comments on commit 9438ef1

Please sign in to comment.