Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Perlito5 - perl6 - our sub

  • Loading branch information...
commit a2918cbf489aa70828fc227651f8d07764a48f00 1 parent c3c420e
@fglock authored
Showing with 12 additions and 7 deletions.
  1. +5 −3 perlito5.pl
  2. +7 −4 src5/lib/Perlito5/Perl6/Emitter.pm
View
8 perlito5.pl
@@ -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;
View
11 src5/lib/Perlito5/Perl6/Emitter.pm
@@ -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 ];
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.