Skip to content

Commit

Permalink
Provide support for importing package-y kind of symbols
Browse files Browse the repository at this point in the history
Install them similarly to locally declared packages. Provide support for
long names.
  • Loading branch information
vrurg committed Dec 30, 2019
1 parent 794a7b0 commit 097961b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Perl6/World.nqp
Expand Up @@ -1536,7 +1536,17 @@ class Perl6::World is HLL::World {
if $need-decont && nqp::islt_i(nqp::index('$&', nqp::substr($key,0,1)),0) {
$value := nqp::decont($value);
}
if $target.symbol($key) -> %sym {
my $is-packagy := 0;
if $!unit_ready && !nqp::isconcrete($value) {
my $valueHOW := $value.HOW;
$is-packagy := nqp::istype($valueHOW, self.find_symbol(['Metamodel', 'Naming'], :setting-only))
&& nqp::istype($valueHOW, self.find_symbol(['Metamodel', 'Stashing'], :setting-only));
}
if $is-packagy {
# $pkgdecl parameter will never be used by install_package. 'packagy' is just a stub here.
self.install_package($/, nqp::split('::', $key), 'my', 'packagy', $*PACKAGE, $target, $value);
}
elsif $target.symbol($key) -> %sym {
# There's already a symbol. However, we may be able to merge
# if both are multis and have onlystar dispatchers.
my $installed := %sym<value>;
Expand Down

0 comments on commit 097961b

Please sign in to comment.