diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp index d069ba9a678..e9f0d9a3407 100644 --- a/src/Perl6/Actions.nqp +++ b/src/Perl6/Actions.nqp @@ -1767,6 +1767,7 @@ class Perl6::Actions is HLL::Actions does STDActions { my $compunit_past; my $target_package; my $has_file; + my $longname; if $ { for $ -> $colonpair { if ~$colonpair eq 'file' { @@ -1774,6 +1775,7 @@ class Perl6::Actions is HLL::Actions does STDActions { last; } } + $longname := $*W.dissect_longname($); $target_package := $*W.dissect_longname($).name_past; } if $ && nqp::defined($has_file) == 0 { @@ -1811,11 +1813,6 @@ class Perl6::Actions is HLL::Actions does STDActions { :name<&REQUIRE_IMPORT>, $compunit_past, ); - if $target_package { - $target_package.named('target-package'); - $require_past.push($target_package); - } - if $ { my $p6_argiter := $*W.compile_time_evaluate($/, $.ast).eager.iterator; my $IterationEnd := $*W.find_symbol(['IterationEnd']); @@ -1833,7 +1830,9 @@ class Perl6::Actions is HLL::Actions does STDActions { } } $past.push($require_past); - + $past.push($ + ?? self.make_indirect_lookup($longname.components()) + !! $.ast); make $past; } diff --git a/src/core/operators.pm b/src/core/operators.pm index b31ff60576c..179466c763e 100644 --- a/src/core/operators.pm +++ b/src/core/operators.pm @@ -566,7 +566,7 @@ sub INDIRECT_NAME_LOOKUP($root, *@chunks) is raw { $thing; } -sub REQUIRE_IMPORT($compunit, *@syms,:$target-package) { +sub REQUIRE_IMPORT($compunit, *@syms) { my $handle := $compunit.handle; my $DEFAULT := $handle.export-package().WHO; my $GLOBALish := $handle.globalish-package.WHO; @@ -582,13 +582,9 @@ sub REQUIRE_IMPORT($compunit, *@syms,:$target-package) { if @missing { X::Import::MissingSymbols.new(:from($compunit.short-name), :@missing).throw; } - # Merge GLOBALish from compunit. - # XXX: should probably use CALLER::UNIT:: but RT #127536 + # Merge GLOBAL from compunit. GLOBAL::.merge-symbols($GLOBALish); - - $target-package.defined ?? - INDIRECT_NAME_LOOKUP($GLOBALish,$target-package) !! - $compunit.short-name; # roast says if requiring file return its path + Nil; } sub infix:(+a) {