Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Refactor to remove some redundant if tests in use_statement.
  • Loading branch information
pmichaud committed May 15, 2009
1 parent cf586e3 commit a1055ac
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/parser/actions.pm
Expand Up @@ -384,6 +384,16 @@ method use_statement($/) {
my $name := ~$<name>;
my $past;
if $name ne 'v6' && $name ne 'lib' {
## Create a loadinit node so the use module is loaded
## when this module is loaded...
our @?BLOCK;
my $use_call := PAST::Op.new(
PAST::Val.new( :value($name) ),
:name('use'),
:pasttype('call'),
:node( $/ )
);

## Handle tags.
my $tags;
if $<EXPR> {
Expand All @@ -398,30 +408,16 @@ method use_statement($/) {
}
$tags.name('hash');
$tags.pasttype('call');
$tags.named('tags');
$use_call.push($tags);
}

## Handle versioning
my $ver;
if $<colonpair> {
$ver := PAST::Op.new( :pasttype('call'), :name('hash') );
my $ver := PAST::Op.new( :pasttype('call'), :name('hash') );
for $<colonpair> {
$ver.push( $_.ast );
}
}
## Create a loadinit node so the use module is loaded
## when this module is loaded...
our @?BLOCK;
my $use_call := PAST::Op.new(
PAST::Val.new( :value($name) ),
:name('use'),
:pasttype('call'),
:node( $/ )
);
if $tags {
$tags.named('tags');
$use_call.push($tags);
}
if $ver {
$ver.named('ver');
$use_call.push($ver);
}
Expand Down

0 comments on commit a1055ac

Please sign in to comment.