Skip to content

Commit

Permalink
Parse traits before handling the block open, so we can look for some …
Browse files Browse the repository at this point in the history
…that affect the compile. Also, attatch them to the package so PAST node so we can look for those we care about later.
  • Loading branch information
jnthn committed Jun 29, 2009
1 parent 6c7e546 commit 3c2e872
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/parser/actions.pm
Expand Up @@ -1423,10 +1423,14 @@ method package_declarator($/, $key) {
my $sym := ~$<sym>;
my $past;
if $key eq 'open' {
# Start of a package. Create a block and mark it as a package declaration.
our $?BLOCK_OPEN;
$?BLOCK_OPEN := PAST::Block.new( PAST::Stmts.new(), :node($/) );
$?BLOCK_OPEN<pkgdecl> := $sym;
@?PKGDECL.unshift( $sym );

# Attach traits list to it.
$?BLOCK_OPEN<traits> := $<traits>;
}
elsif $key eq 'package_def' {
make $<package_def>.ast;
Expand Down
2 changes: 1 addition & 1 deletion src/parser/grammar.pg
Expand Up @@ -702,8 +702,8 @@ rule package_def {
match.'add_type'($S0)
}}
]?
{*} #= open
<trait>*
{*} #= open
[
| <block> {*} #= block
| <?{{ $P0 = get_global '$begin_compunit'
Expand Down

0 comments on commit 3c2e872

Please sign in to comment.