Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
second attempt at MAIN sub
  • Loading branch information
moritz committed Jun 9, 2010
1 parent f7ddcf5 commit b0d427b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions src/Perl6/Actions.pm
Expand Up @@ -61,6 +61,14 @@ method comp_unit($/, $key?) {
return 1;
}

# run MAIN subs
$mainline.push(
PAST::Op.new(
:pasttype('call'),
:name('&MAIN_HELPER')
)
);

# Create a block for the entire compilation unit.
our $?RAKUDO_HLL;
my $unit := PAST::Block.new( :node($/), :hll($?RAKUDO_HLL) );
Expand Down Expand Up @@ -107,13 +115,6 @@ method comp_unit($/, $key?) {
$unit.unshift(PAST::Op.new(:inline(".annotate 'file', '" ~ $file ~ "'")));
}

$unit.push(
PAST::Op.new(
:pasttype('call'),
:name('&MAIN_HELPER'),
)
);

# Remove the outer module package.
@PACKAGE.shift;

Expand Down
4 changes: 2 additions & 2 deletions src/core/MAIN.pm
@@ -1,4 +1,4 @@
my sub process-cmd-args(@args, %named) {
our sub process-cmd-args(@args, %named) {
my (@positional-arguments, %named-arguments , $negate);
while ( @args ) {
my $passed_value = @args.shift;
Expand Down Expand Up @@ -65,7 +65,7 @@ our sub MAIN_HELPER() {
done:
};
unless $m {
say "no MAIN, no cookie";
return;
}
my @named-params = $m.signature.params.grep: {.named && .type ~~ Bool};
my %named-params = @named-params».name».substr(1) Z=> @named-params».type;
Expand Down

0 comments on commit b0d427b

Please sign in to comment.