Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix RT#73886.
  • Loading branch information
jnthn committed Apr 4, 2010
1 parent cd0c7cf commit 03f210f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Perl6/Actions.pm
Expand Up @@ -9,7 +9,6 @@ INIT {
# initialize @BLOCK and @PACKAGE
our @BLOCK := Q:PIR { %r = root_new ['parrot';'ResizablePMCArray'] };
our @PACKAGE := Q:PIR { %r = root_new ['parrot';'ResizablePMCArray'] };
@PACKAGE.unshift(Perl6::Compiler::Module.new());
our $TRUE := PAST::Var.new( :name('true'), :scope('register') );
our %BEGINDONE := Q:PIR { %r = root_new ['parrot';'Hash'] };
Expand Down Expand Up @@ -42,7 +41,13 @@ method deflongname($/) {
!! ~$<name>;
}

method comp_unit($/) {
method comp_unit($/, $key?) {
# If this is the start of the unit, add an outer module.
if $key eq 'open' {
@PACKAGE.unshift(Perl6::Compiler::Module.new());
return 1;
}

# Create the block for the mainline code.
my $mainline := @BLOCK.shift;
$mainline.push($<statementlist>.ast);
Expand Down Expand Up @@ -87,9 +92,8 @@ method comp_unit($/) {
)
);

# Make sure we have a clean @PACKAGE for next time.
# Remove the outer module package.
@PACKAGE.shift;
@PACKAGE.unshift(Perl6::Compiler::Module.new());

make $unit;
}
Expand Down
1 change: 1 addition & 0 deletions src/Perl6/Grammar.pm
Expand Up @@ -246,6 +246,7 @@ token comp_unit {
:my $*MULTINESS := ''; # which multi declarator we're under
:my $*QSIGIL := ''; # sigil of current interpolation
:my $*TYPENAME := '';
{*} #= open
<.newpad>
<.outerlex>
<.finishpad>
Expand Down

0 comments on commit 03f210f

Please sign in to comment.