Skip to content

Commit b089723

Browse files
committed
Update a bunch of commented out code.
1 parent 832dbf4 commit b089723

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

src/NQPQ/Actions.pm

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,36 @@ class NQP::Actions is HLL::Actions {
7676
# register the mainline as a module (so trying to use ourself in the
7777
# program will not explode). If we have a MAIN sub, call it at end of
7878
# mainline.
79-
# XXX Needs QAST update.
80-
#$unit.unshift(PAST::Var.new( :scope('parameter'), :name('@ARGS'), :slurpy(1),
81-
# :directaccess(1) ));
82-
#my $main_tasks := QAST::Stmts.new(
83-
# PAST::Op.new( :pirop('load_bytecode vs'), 'ModuleLoader.pbc' ),
84-
# QAST::Op.new(
85-
# :op('callmethod'), :name('set_mainline_module'),
86-
# PAST::Var.new( :name('ModuleLoader'), :namespace([]), :scope('package') ),
87-
# PAST::Var.new( :scope('keyed'), PAST::Op.new( :pirop('getinterp P') ), 'context' )
88-
# )
89-
#);
90-
#if $*MAIN_SUB {
91-
# $main_tasks.push(QAST::Op.new(
92-
# :op('call'), QAST::BVal.new( :value($*MAIN_SUB) ),
93-
# QAST::Var.new( :scope('lexical'), :name('@ARGS'), :flat(1) )
94-
# ));
95-
#}
96-
#$mainline.push(QAST::Op.new(
97-
# :op('if'),
98-
# QAST::Var.new( :scope('lexical'), :name('@ARGS') ),
99-
# $main_tasks
100-
#));
79+
$unit.unshift(QAST::Var.new( :scope('lexical'), :name('@ARGS'), :decl('param'), :slurpy(1) ));
80+
my $main_tasks := QAST::Stmts.new(
81+
QAST::VM.new(
82+
:pirop('load_bytecode vs'),
83+
QAST::SVal.new( :value('ModuleLoader.pbc') )
84+
),
85+
QAST::Op.new(
86+
:op('callmethod'), :name('set_mainline_module'),
87+
QAST::VM.new(
88+
pirop => 'get_hll_global Ps',
89+
QAST::SVal.new( :value('ModuleLoader') )
90+
),
91+
QAST::Op.new(
92+
:op('atkey'),
93+
QAST::VM.new( :pirop('getinterp P') ),
94+
QAST::SVal.new( :value('context') )
95+
)
96+
)
97+
);
98+
if $*MAIN_SUB {
99+
$main_tasks.push(QAST::Op.new(
100+
:op('call'), QAST::BVal.new( :value($*MAIN_SUB) ),
101+
QAST::Var.new( :scope('lexical'), :name('@ARGS'), :flat(1) )
102+
));
103+
}
104+
$mainline.push(QAST::Op.new(
105+
:op('if'),
106+
QAST::Var.new( :scope('lexical'), :name('@ARGS') ),
107+
$main_tasks
108+
));
101109

102110
# Push mainline statements into UNIT.
103111
$unit.push($mainline);

0 commit comments

Comments
 (0)