Skip to content

Commit 0143bc0

Browse files
committed
Assorted fixes to package scoped things. Fixes our subs amongst other things.
1 parent 90adf5a commit 0143bc0

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/NQPQ/Actions.pm

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -881,10 +881,10 @@ class NQP::Actions is HLL::Actions {
881881
# Need to install it at loadinit time but also re-bind
882882
# it per invocation.
883883
$*W.install_package_routine($*PACKAGE, $name, $past);
884-
$BLOCK[0].push(PAST::Op.new(
885-
:pasttype('bind_6model'),
884+
$BLOCK[0].push(QAST::Op.new(
885+
:op('bind'),
886886
lexical_package_lookup([$name], $/),
887-
PAST::Var.new( :name($name), :scope('lexical') )
887+
QAST::Var.new( :name($name), :scope('lexical') )
888888
));
889889
}
890890
}
@@ -1504,8 +1504,8 @@ class NQP::Actions is HLL::Actions {
15041504
# The final lookup will always be just a keyed access to a
15051505
# symbol table.
15061506
my $final_name := @name.pop();
1507-
my $lookup := QAST::Op.new(
1508-
:op('atkey'),
1507+
my $lookup := QAST::VarWithFallback.new(
1508+
:scope('associative'),
15091509
QAST::SVal.new( :value(~$final_name) )
15101510
);
15111511

@@ -1516,9 +1516,8 @@ class NQP::Actions is HLL::Actions {
15161516
:op('who'),
15171517
QAST::Var.new( :name('$?PACKAGE'), :scope('lexical') )
15181518
));
1519-
$lookup := QAST::Op.new(
1519+
$lookup.fallback(QAST::Op.new(
15201520
:op('ifnull'),
1521-
$lookup,
15221521
QAST::Op.new(
15231522
:op('atkey'),
15241523
QAST::Op.new(
@@ -1527,25 +1526,28 @@ class NQP::Actions is HLL::Actions {
15271526
QAST::SVal.new( :value('GLOBAL') ) )
15281527
),
15291528
QAST::SVal.new( :value(~$final_name) )
1530-
));
1529+
),
1530+
default_for('$')));
15311531
}
15321532

15331533
# Otherwise, see if the first part of the name is lexically
15341534
# known. If not, it's in GLOBAL. Also, if first part is GLOBAL
15351535
# then strip it off.
15361536
else {
15371537
my $path := $*W.is_lexical(@name[0]) ??
1538-
PAST::Var.new( :name(@name.shift()), :scope('lexical') ) !!
1539-
PAST::Var.new( :name('GLOBAL'), :namespace([]), :scope('package') );
1538+
QAST::Var.new( :name(@name.shift()), :scope('lexical') ) !!
1539+
QAST::VM.new( pirop => 'get_hll_global Ps',
1540+
QAST::SVal.new( :value('GLOBAL') ) );
15401541
if @name[0] eq 'GLOBAL' {
15411542
@name.shift();
15421543
}
15431544
for @name {
1544-
$path := PAST::Op.new(
1545+
$path := QAST::VM.new(
15451546
:pirop('nqp_get_package_through_who PPs'),
1546-
$path, ~$_);
1547+
$path, QAST::SVal.new( :value(~$_) ));
15471548
}
1548-
$lookup.unshift(PAST::Op.new(:pirop('get_who PP'), $path));
1549+
$lookup.unshift(QAST::Op.new(:op('who'), $path));
1550+
$lookup.fallback(default_for('$'));
15491551
}
15501552

15511553
return $lookup;

src/NQPQ/World.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class NQP::World is HLL::World {
181181
method install_package_routine($package, $name, $past_block) {
182182
my $fixup := QAST::Op.new(
183183
:op('bindkey'),
184-
QAST::Op.new( :op('getwho'), QAST::WVal.new( :value($package) ) ),
184+
QAST::Op.new( :op('who'), QAST::WVal.new( :value($package) ) ),
185185
QAST::SVal.new( :value(~$name) ),
186186
QAST::BVal.new( :value($past_block) )
187187
);

0 commit comments

Comments
 (0)