Skip to content

Commit

Permalink
Install lexical packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed May 8, 2011
1 parent b56c1b3 commit 097725c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Perl6/Grammar.pm
Expand Up @@ -857,6 +857,7 @@ grammar Perl6::Grammar is HLL::Grammar {

rule package_def {<.end_keyword>
:my $longname;
:my $outer := $*ST.cur_lexpad();
:my $*IN_DECL := 'package';
:my $*CURPAD;

Expand Down Expand Up @@ -890,7 +891,19 @@ grammar Perl6::Grammar is HLL::Grammar {
$*PACKAGE := $*ST.pkg_create_mo(%*HOW{$*PKGDECL}, |%args);

# Install it in the symbol table.
# XXX
if $longname {
if $*SCOPE eq 'my' {
if +$longname<name><morename> == 0 {
$*ST.install_lexical_symbol($outer, ~$longname<name>, $*PACKAGE);
}
else {
$/.CURSOR.panic("Cannot use multi-part package name with 'my' scope");
}
}
else {
$/.CURSOR.panic("Cannot use $*SCOPE scope with $*PKGDECL");
}
}
}

[
Expand Down

0 comments on commit 097725c

Please sign in to comment.