Skip to content

Commit

Permalink
RakuAST: make custom operators available to EVALed code
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed Jan 29, 2023
1 parent ea60d16 commit ade6861
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Raku/Grammar.nqp
Expand Up @@ -3025,7 +3025,12 @@ if $*COMPILING_CORE_SETTING {
# Set up the rest of this statement to have new actions too.
self.set_actions($actions);
#$*W.install_lexical_symbol($*W.cur_lexpad(), '%?LANG', $*W.p6ize_recursive(%*LANG, :dynamic));
$*R.outer-scope.merge-generated-lexical-declaration(
self.actions.r('VarDeclaration', 'Implicit', 'Constant').new(
:name('%?LANG'),
:value(%*LANG),
)
);
$*LANG := self;
#$*LEAF := self;
Expand Down
6 changes: 6 additions & 0 deletions src/Raku/ast/resolver.rakumod
Expand Up @@ -604,6 +604,9 @@ class RakuAST::Resolver::EVAL is RakuAST::Resolver {
method current-scope() {
$!scopes[nqp::elems($!scopes) - 1]
}
method outer-scope() {
$!scopes[nqp::elems($!scopes) - 2]
}

# Pops the top active lexical scope.
method pop-scope() {
Expand Down Expand Up @@ -728,6 +731,9 @@ class RakuAST::Resolver::Compile is RakuAST::Resolver {
method current-scope() {
$!scopes[nqp::elems($!scopes) - 1].scope
}
method outer-scope() {
$!scopes[nqp::elems($!scopes) - 2].scope
}

# Pops the top active lexical scope. Used only in batch resolve mode.
method pop-scope() {
Expand Down

0 comments on commit ade6861

Please sign in to comment.