Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Generalize add_phaser's argument list a little so it doesn't take the…
… block to add from the $/ it is passed. Also make it a method, not a sub.
  • Loading branch information
jnthn committed Jul 16, 2010
1 parent c80d2d9 commit 7b26327
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Perl6/Actions.pm
Expand Up @@ -530,10 +530,10 @@ method statement_control:sym<CONTROL>($/) {
make PAST::Stmts.new(:node($/));
}

method statement_prefix:sym<BEGIN>($/) { add_phaser($/, 'BEGIN'); }
method statement_prefix:sym<CHECK>($/) { add_phaser($/, 'CHECK'); }
method statement_prefix:sym<INIT>($/) { add_phaser($/, 'INIT'); }
method statement_prefix:sym<END>($/) { add_phaser($/, 'END'); }
method statement_prefix:sym<BEGIN>($/) { self.add_phaser($/, $<blorst>.ast, 'BEGIN'); }
method statement_prefix:sym<CHECK>($/) { self.add_phaser($/, $<blorst>.ast, 'CHECK'); }
method statement_prefix:sym<INIT>($/) { self.add_phaser($/, $<blorst>.ast, 'INIT'); }
method statement_prefix:sym<END>($/) { self.add_phaser($/, $<blorst>.ast, 'END'); }

method statement_prefix:sym<do>($/) {
my $past := $<blorst>.ast;
Expand Down Expand Up @@ -587,9 +587,9 @@ method blorst($/) {
make $block;
}

sub add_phaser($/, $bank) {
my $block := PAST::Block.new(
PAST::Op.new( :pasttype('call'), :name('!YOU_ARE_HERE'), $<blorst>.ast )
method add_phaser($/, $blorst, $bank) {
my $block := $*SETTING_MODE ?? $blorst !! PAST::Block.new(
PAST::Op.new( :pasttype('call'), :name('!YOU_ARE_HERE'), $blorst )
);
my $subid := $block.subid();

Expand Down

0 comments on commit 7b26327

Please sign in to comment.