Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rakudo/rakudo
...
head fork: rakudo/rakudo
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
4 src/Perl6/Actions.pm
@@ -1127,7 +1127,7 @@ class Perl6::Actions is HLL::Actions {
my $attr := get_attribute_meta_object($/, $name);
$past.scope('attribute_6model');
$past.type($attr.type);
- $past.unshift(instantiated_type(['$?CLASS'], $/));
+ $past.unshift($*W.get_ref($*PACKAGE));
$past.unshift(PAST::Var.new( :name('self'), :scope('lexical_6model') ));
$past := box_native_if_needed($past, $attr.type);
}
@@ -1473,7 +1473,7 @@ class Perl6::Actions is HLL::Actions {
hash(
container_descriptor => $descriptor,
type => %cont_info<bind_constraint>,
- package => $*W.find_symbol(['$?CLASS'])),
+ package => $*PACKAGE),
%cont_info, $descriptor);
# Document it
View
12 src/Perl6/Metamodel/AttributeContainer.pm
@@ -9,9 +9,15 @@ role Perl6::Metamodel::AttributeContainer {
# Adds an attribute.
method add_attribute($obj, $meta_attr) {
my $name := $meta_attr.name;
- if pir::exists(%!attribute_lookup, $name) {
- pir::die("Package '" ~ self.name($obj) ~
- "' already has an attribute named '$name'");
+ for @!attributes {
+ if $_.name eq $name {
+ if !pir::can__IPs($meta_attr, 'package')
+ || !pir::can__IPs($_, 'package')
+ || $_.package =:= $meta_attr.package {
+ pir::die("Package '" ~ self.name($obj) ~
+ "' already has an attribute named '$name'");
+ }
+ }
}
@!attributes[+@!attributes] := $meta_attr;
%!attribute_lookup{$name} := $meta_attr;
View
4 src/Perl6/Metamodel/BOOTSTRAP.pm
@@ -219,6 +219,10 @@ BEGIN {
nqp::getattr_i(pir::perl6_decontainerize__PP($self),
Attribute, '$!box_target')
}));
+ Attribute.HOW.add_method(Attribute, 'package', static(sub ($self) {
+ nqp::getattr(pir::perl6_decontainerize__PP($self),
+ Attribute, '$!package');
+ }));
Attribute.HOW.add_method(Attribute, 'is_generic', static(sub ($self) {
my $dcself := pir::perl6_decontainerize__PP($self);
my $type := nqp::getattr(pir::perl6_decontainerize__PP($dcself),
View
6 src/Perl6/Metamodel/BUILDPLAN.pm
@@ -40,7 +40,8 @@ role Perl6::Metamodel::BUILDPLAN {
if $_.has_accessor {
my $attr_name := $_.name;
my $name := pir::substr__SSi($attr_name, 2);
- my $entry := [1, $class, $name, $attr_name];
+ my $pkg := pir::can__IPs($_, 'package') ?? $_.package !! $class;
+ my $entry := [1, $pkg, $name, $attr_name];
@all_plan[+@all_plan] := $entry;
if $i == 0 {
@plan[+@plan] := $entry;
@@ -54,7 +55,8 @@ role Perl6::Metamodel::BUILDPLAN {
if pir::can__IPs($_, 'build') {
my $default := $_.build;
if $default {
- my $entry := [2, $class, $_.name, $default];
+ my $pkg := pir::can__IPs($_, 'package') ?? $_.package !! $class;
+ my $entry := [2, $pkg, $_.name, $default];
@all_plan[+@all_plan] := $entry;
if $i == 0 {
@plan[+@plan] := $entry;
View
4 src/Perl6/Metamodel/RoleToClassApplier.pm
@@ -105,10 +105,6 @@ my class RoleToClassApplier {
# Compose in any role attributes.
my @attributes := $to_compose_meta.attributes($to_compose, :local(1));
for @attributes {
- if has_attribute($target, $_.name) {
- pir::die("Attribute '" ~ $_.name ~ "' already exists in the class '" ~
- $target.HOW.name($target) ~ "', but a role also wishes to compose it");
- }
$target.HOW.add_attribute($target, $_);
}
View
5 src/Perl6/Metamodel/RoleToRoleApplier.pm
@@ -102,11 +102,6 @@ my class RoleToRoleApplier {
if $_ =:= $add_attr {
$skip := 1;
}
- else {
- if $_.name eq $add_attr.name {
- pir::die("Attribute '" ~ $_.name ~ "' conflicts in role composition");
- }
- }
}
unless $skip {
$target.HOW.add_attribute($target, $add_attr);
View
1  src/core/Attribute.pm
@@ -99,7 +99,6 @@ my class Attribute {
method container() is rw { nqp::isnull($!auto_viv_container) ?? Mu !! $!auto_viv_container }
method has-accessor() { ?$!has_accessor }
method readonly() { !self.rw }
- method package() { $!package }
multi method Str(Attribute:D:) { self.name }
multi method gist(Attribute:D:) { self.name }
}

No commit comments for this range

Something went wrong with that request. Please try again.