Skip to content

Commit 6ae4625

Browse files
committed
Mark methods/our subs with declaration_static.
This will be used in the closure handling changes, being tried first in MoarVM, to eliminate prior_invocation.
1 parent b86227e commit 6ae4625

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/NQP/Actions.nqp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,10 @@ class NQP::Actions is HLL::Actions {
899899
QAST::Var.new( :name('&' ~ $name), :scope('lexical') )
900900
));
901901

902+
# Static code object needs re-capturing also, as it's
903+
# our-scoped.
904+
$past.blocktype('declaration_static');
905+
902906
# Also need to make sure it gets a code object so it's
903907
# in the SC.
904908
$*W.create_code($past, $name, 0);
@@ -941,7 +945,7 @@ class NQP::Actions is HLL::Actions {
941945
}
942946
else {
943947
$past := $<blockoid>.ast;
944-
$past.blocktype('declaration');
948+
$past.blocktype('declaration_static');
945949
if $*RETURN_USED {
946950
$past[1] := wrap_return_handler($past[1]);
947951
}
@@ -1225,7 +1229,7 @@ class NQP::Actions is HLL::Actions {
12251229
:name('!protoregex'),
12261230
:op('callmethod')
12271231
),
1228-
:blocktype('declaration'),
1232+
:blocktype('declaration_static'),
12291233
:node($/)
12301234
);
12311235
$*W.pkg_add_method($*PACKAGE, 'add_method', $name,
@@ -1247,7 +1251,9 @@ class NQP::Actions is HLL::Actions {
12471251
$regex.name($name);
12481252

12491253
if $*PKGDECL && nqp::can($*PACKAGE.HOW, 'add_method') {
1250-
# Add the actual method.
1254+
# Add the actual method, marking it as a static declaration
1255+
# since it's reachable through the method table.
1256+
$block.blocktype('declaration_static');
12511257
$*W.pkg_add_method($*PACKAGE, 'add_method', $name, $code);
12521258
}
12531259

0 commit comments

Comments
 (0)