Skip to content

Commit

Permalink
Fix EXPORT_SYMBOL not finding @*PACKAGES
Browse files Browse the repository at this point in the history
Instead of having the package stack in a dynvar, in RakuAST, the resolver
carries the package stack.
  • Loading branch information
niner committed Apr 8, 2022
1 parent fe78b5c commit befb302
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Raku/Actions.nqp
Expand Up @@ -1008,7 +1008,7 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {
# etc.)
$*PACKAGE.ensure-begin-performed($*R);

# Let the resovler know which package we're in.
# Let the resolver know which package we're in.
$*R.push-package($*PACKAGE);
}

Expand Down
7 changes: 7 additions & 0 deletions src/Raku/ast/resolver.rakumod
Expand Up @@ -83,6 +83,13 @@ class RakuAST::Resolver {
Nil
}

# Current package stack as NQP list
method packages() {
my $result := nqp::create(List);
nqp::bindattr($result, List, '$!reified', $!packages);
$result
}

# Name-mangle an infix operator and resolve it.
method resolve-infix(Str $operator-name) {
self.resolve-lexical('&infix' ~ self.IMPL-CANONICALIZE-PAIR('', $operator-name))
Expand Down
2 changes: 1 addition & 1 deletion src/core.c/Rakudo/Internals.pm6
Expand Up @@ -166,7 +166,7 @@ my class Rakudo::Internals {
method EXPORT_SYMBOL(Str:D $name, @tags, Mu \sym) {
$export-symbol-lock.protect: {
my @export_packages = $*EXPORT;
for nqp::hllize(@*PACKAGES).list {
for $*R ?? $*R.packages !! nqp::hllize(@*PACKAGES).list {
my $who := .WHO;
@export_packages.append: $who.EXISTS-KEY('EXPORT')
?? $who.AT-KEY('EXPORT')
Expand Down

0 comments on commit befb302

Please sign in to comment.