Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
some checks for HAS for reprs and types
  • Loading branch information
timo committed May 21, 2015
1 parent 36a6de1 commit 65aaeec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/NativeCall.pm
Expand Up @@ -471,6 +471,12 @@ sub EXPORT(|) {
# my $scoped := $<scoped>.ast;
my Mu $scoped := nqp::atkey(nqp::findmethod($/, 'hash')($/), 'scoped').ast;
my Mu $attr := $scoped.ann('metaattr');
if $attr.package.REPR ne 'CStruct' && $attr.package.REPR ne 'CUnion' {
die "Can only use HAS-scoped attributes in classes with repr CStruct or CUnion, not " ~ $attr.package.REPR;
}
if nqp::objprimspec($attr.type) != 0 {
warn "Useless use of HAS scope on an attribute with type { $attr.type.^name }.";
}
# Mark $attr as inlined, that's why we do all this.
nqp::bindattr_i(nqp::decont($attr), $attr.WHAT, '$!inlined', 1);
# make $scoped
Expand Down

0 comments on commit 65aaeec

Please sign in to comment.