Skip to content

Commit

Permalink
RakuAST: Pass :in-as-argsfiles to RUN-MAIN from v6.d up
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed Mar 31, 2024
1 parent cdaca91 commit 43fe36f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Raku/ast/compunit.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,21 @@ class RakuAST::CompUnit
&& +(@*MODULES // []) == 0
&& (my $main := self.find-lexical('&MAIN'))
{
$top-level.set_children([QAST::Op.new(
my $run-main := QAST::Op.new(
:op('call'),
:name('&RUN-MAIN'),
QAST::WVal.new(:value($main.meta-object)),
QAST::Stmts.new(|$top-level.list) # run the mainline and get its result
)]);
);
unless nqp::getcomp('Raku').language_revision < 2 {
$run-main.push(
QAST::WVal.new( # $*IN as $*ARGSFILES
value => True,
:named('in-as-argsfiles')
)
);
}
$top-level.set_children([$run-main]);
}

QAST::CompUnit.new:
Expand Down

0 comments on commit 43fe36f

Please sign in to comment.