Skip to content

Commit bfd58e5

Browse files
committed
A bunch more PAST::Var => QAST::Var, fixing simple sub declarations along the way.
1 parent 50bd8cc commit bfd58e5

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

src/NQPQ/Actions.pm

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class NQP::Actions is HLL::Actions {
165165
if $ml {
166166
if ~$ml<sym> eq 'for' {
167167
$past := QAST::Block.new( :blocktype('immediate'),
168-
PAST::Var.new( :name('$_'), :scope('parameter'), :isdecl(1) ),
168+
QAST::Var.new( :name('$_'), :scope('lexical'), :decl('param') ),
169169
$past);
170170
$past.symbol('$_', :scope('lexical') );
171171
$past.arity(1);
@@ -349,7 +349,7 @@ class NQP::Actions is HLL::Actions {
349349
$past.op('for');
350350
my $block := $past[1];
351351
unless $block.arity {
352-
$block[0].push( PAST::Var.new( :name('$_'), :scope('parameter') ) );
352+
$block[0].push( QAST::Var.new( :name('$_'), :scope('lexical'), :decl('param') ) );
353353
$block.symbol('$_', :scope('lexical') );
354354
$block.arity(1);
355355
}
@@ -866,9 +866,12 @@ class NQP::Actions is HLL::Actions {
866866
}
867867
else {
868868
my $BLOCK := $*W.cur_lexpad();
869-
$BLOCK[0].push(PAST::Var.new( :name($name), :isdecl(1), :directaccess(1),
870-
:viviself($past), :scope('lexical') ) );
871-
$BLOCK.symbol($name, :scope('lexical') );
869+
$BLOCK[0].push(QAST::Op.new(
870+
:op('bind'),
871+
QAST::Var.new( :name($name), :scope('lexical'), :decl('var') ),
872+
$past
873+
));
874+
$BLOCK.symbol($name, :scope('lexical'));
872875
if $*SCOPE eq 'our' {
873876
# Need to install it at loadinit time but also re-bind
874877
# it per invocation.
@@ -880,7 +883,7 @@ class NQP::Actions is HLL::Actions {
880883
));
881884
}
882885
}
883-
$past := QAST::Var.new( :name($name) );
886+
$past := QAST::Var.new( :name($name), :scope('lexical') );
884887
}
885888
else {
886889
$/.CURSOR.panic("$*SCOPE scoped routines are not supported yet");
@@ -1418,13 +1421,13 @@ class NQP::Actions is HLL::Actions {
14181421

14191422
method quote:sym</ />($/) {
14201423
my $block := $*W.pop_lexpad();
1421-
$block[0].push(PAST::Var.new(:name<self>, :scope<parameter>));
1424+
$block[0].push(QAST::Var.new(:name<self>, :scope<lexical>, :decl<param>));
14221425
$block[0].push(QAST::Op.new(
14231426
:op('bind'),
14241427
QAST::Var.new(:name<self>, :scope<register>, :isdecl(1) ),
14251428
QAST::Var.new( :name<self>, :scope('lexical') )));
1426-
$block[0].push(PAST::Var.new(:name<>, :scope<lexical>, :isdecl(1)));
1427-
$block[0].push(PAST::Var.new(:name<$/>, :scope<lexical>, :isdecl(1)));
1429+
$block[0].push(QAST::Var.new(:name<>, :scope<lexical>, :isdecl(1)));
1430+
$block[0].push(QAST::Var.new(:name<$/>, :scope<lexical>, :isdecl(1)));
14281431
$block.symbol('', :scope<lexical>);
14291432
$block.symbol('$/', :scope<lexical>);
14301433

src/NQPQ/World.pm

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,11 @@ class NQP::World is HLL::World {
179179
# Adds a fixup to install a specified QAST::Block in a package under the
180180
# specified name.
181181
method install_package_routine($package, $name, $past_block) {
182-
my $fixup := PAST::Op.new(
183-
:pasttype('bind_6model'),
184-
PAST::Var.new(
185-
:scope('keyed'),
186-
PAST::Op.new( :pirop('get_who PP'), self.get_slot_past_for_object($package) ),
187-
~$name
188-
),
189-
PAST::Val.new( :value($past_block) )
182+
my $fixup := QAST::Op.new(
183+
:op('bindkey'),
184+
QAST::Op.new( :op('getwho'), QAST::WVal.new( :value($package) ) ),
185+
QAST::SVal.new( :value(~$name) ),
186+
QAST::BVal.new( :value($past_block) )
190187
);
191188
self.add_fixup_task(:deserialize_past($fixup), :fixup_past($fixup));
192189
}
@@ -454,9 +451,10 @@ class NQP::World is HLL::World {
454451
for %symbols {
455452
if !%seen{$_.key} && nqp::existskey($_.value, 'value') {
456453
try {
457-
$wrapper[0].push(PAST::Var.new(
458-
:name($_.key), :scope('lexical_6model'), :isdecl(1),
459-
:viviself(self.get_ref(($_.value)<value>))
454+
$wrapper[0].push(QAST::Op.new(
455+
:op('bind'),
456+
QAST::Var.new( :name($_.key), :scope('lexical'), :isdecl('var') ),
457+
QAST::WVal.new( :value(($_.value)<value>) )
460458
));
461459
};
462460
%seen{$_.key} := 1;

0 commit comments

Comments
 (0)