Skip to content

Commit

Permalink
Allow superclasses with double colons
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Oct 24, 2010
1 parent e2b18ba commit dfcce51
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Metamodel.pm
Expand Up @@ -973,7 +973,7 @@ sub Op::Super::begin {
$ns = $unit->deref($ns);
die "superclass $self->name declared in an augment"
if $opensubs[-1]->augmenting;
$ns->add_super($unit->get_stash_obj(@{ $opensubs[-1]->find_pkg($self->name) }));
$ns->add_super($unit->get_stash_obj(@{ $opensubs[-1]->find_pkg([ @{ $self->path // ['MY'] }, $self->name ]) }));
}

sub Op::SubDef::begin {
Expand Down
5 changes: 3 additions & 2 deletions src/Niecza/Actions.pm
Expand Up @@ -2187,7 +2187,8 @@ sub process_package_traits { my ($cl, $M, $export, @tr) = @_;

for (@tr) {
if (exists $_->{_ast}{name}) {
push @r, Op::Super->new(node($M), name => $_->{_ast}{name});
push @r, Op::Super->new(node($M), name => $_->{_ast}{name},
path => $_->{_ast}{path});
} elsif ($_->{_ast}{export}) {
if ($export) {
push @$export, @{ $_->{_ast}{export} };
Expand Down Expand Up @@ -2446,7 +2447,7 @@ sub trait_mod__S_is { my ($cl, $M) = @_;
my $noparm;

if ($M->is_name($trait)) {
$M->{_ast} = { name => $trait };
$M->{_ast} = $cl->mangle_longname($M->{longname});
$noparm = 'Superclasses cannot have parameters';
} elsif ($trait eq 'export') {
$M->{_ast} = { export => [ 'DEFAULT', 'ALL' ] };
Expand Down
1 change: 1 addition & 0 deletions src/Op.pm
Expand Up @@ -732,6 +732,7 @@ use CgOp;
extends 'Op';

has name => (isa => 'Str', is => 'ro');
has path => (isa => 'Maybe[ArrayRef[Str]]', is => 'ro');

sub code {
my ($self, $body) = @_;
Expand Down

0 comments on commit dfcce51

Please sign in to comment.