Skip to content

Commit 6878bf4

Browse files
committed
Fix/improvement to type and scope handling in QAST::Compiler.
1 parent 6046125 commit 6878bf4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/QAST/Compiler.nqp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ class QAST::Compiler is HLL::Compiler {
788788
while nqp::istype($cur_block, BlockInfo) {
789789
my %sym := $cur_block.qast.symbol($name);
790790
if %sym {
791-
$scope := %sym<$scope>;
791+
$scope := %sym<scope>;
792792
$cur_block := NQPMu;
793793
}
794794
else {
@@ -834,7 +834,17 @@ class QAST::Compiler is HLL::Compiler {
834834
my $type := type_to_register_type($node.returns);
835835
if $type eq 'P' {
836836
# Consider the blocks for a declared native type.
837-
# XXX TODO
837+
my $cur_block := $*BLOCK;
838+
while nqp::istype($cur_block, BlockInfo) {
839+
my %sym := $cur_block.qast.symbol($name);
840+
if %sym {
841+
$type := type_to_register_type(%sym<type>);
842+
$cur_block := NQPMu;
843+
}
844+
else {
845+
$cur_block := $cur_block.outer();
846+
}
847+
}
838848
}
839849

840850
# Emit the lookup or bind.

0 commit comments

Comments
 (0)