Skip to content

Commit

Permalink
Make sure that Attribute.new.is_built defaults correctly
Browse files Browse the repository at this point in the history
When the "is built" trait was added, all calls in the bootstrap and
the setting that created attributes, had the new "is_built" attribute
also specified.  That was in fact wrong.  What *should* have been
done, is to make sure the new "is_built" attribute would default to
the value (implicitely) given by the "has_accessor" attribute.  Only
that would ensure that Attribute's contract would not be broken.

This solves the ADT blocker (#3427)
  • Loading branch information
lizmat committed Jan 15, 2020
1 parent b1e986c commit f1f690e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Perl6/bootstrap.c/BOOTSTRAP.nqp
Expand Up @@ -1435,8 +1435,9 @@ BEGIN {

# Need new and accessor methods for Attribute in here for now.
Attribute.HOW.add_method(Attribute, 'new',
nqp::getstaticcode(sub ($self, :$name!, :$type!, :$package!, :$inlined = 0, :$is_built = 0, :$has_accessor = 0,
:$positional_delegate = 0, :$associative_delegate = 0, *%other) {
nqp::getstaticcode(sub ($self, :$name!, :$type!, :$package!,
:$inlined = 0, :$has_accessor = 0, :$is_built = $has_accessor,
:$positional_delegate = 0, :$associative_delegate = 0, *%other) {
my $attr := nqp::create($self);
nqp::bindattr_s($attr, Attribute, '$!name', $name);
nqp::bindattr($attr, Attribute, '$!type', nqp::decont($type));
Expand Down

0 comments on commit f1f690e

Please sign in to comment.