Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Perlito5 - perl6 - our sub
  • Loading branch information
fglock committed Oct 15, 2013
1 parent c3c420e commit a2918cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 5 additions & 3 deletions perlito5.pl
Expand Up @@ -12813,9 +12813,11 @@ package Perlito5::AST::Sub;
return(['op' => 'prefix:<sub>', @parts])
if !$self->{'name'};
my $name = $self->{'name'};
$name = $self->{'namespace'} . '::' . $name
if $Perlito5::PKG_NAME ne $self->{'namespace'};
return(['stmt' => ['keyword' => 'sub'], ['bareword' => $name], @parts])
if ($Perlito5::PKG_NAME ne $self->{'namespace'}) {
$name = $self->{'namespace'} . '::' . $name;
return(['stmt' => ['keyword' => 'sub'], ['bareword' => $name], @parts])
}
return(['stmt' => ['keyword' => 'our'], ['keyword' => 'sub'], ['bareword' => $name], @parts])
}
}
package Perlito5::AST::Do;
Expand Down
11 changes: 7 additions & 4 deletions src5/lib/Perlito5/Perl6/Emitter.pm
Expand Up @@ -673,11 +673,14 @@ package Perlito5::AST::Sub;
if defined $self->{block};
return [ op => 'prefix:<sub>', @parts ] if !$self->{name};

my $name = $self->{name};
$name = $self->{namespace} . "::" . $name
if $Perlito5::PKG_NAME ne $self->{namespace};
# TODO - 'my' subroutines

return [ stmt => [ keyword => 'sub' ], [ bareword => $name ], @parts ];
my $name = $self->{name};
if ( $Perlito5::PKG_NAME ne $self->{namespace} ) {
$name = $self->{namespace} . "::" . $name;
return [ stmt => [ keyword => 'sub' ], [ bareword => $name ], @parts ];
}
return [ stmt => [ keyword => 'our' ], [ keyword => 'sub' ], [ bareword => $name ], @parts ];
}
}

Expand Down

0 comments on commit a2918cb

Please sign in to comment.