@@ -899,6 +899,10 @@ class NQP::Actions is HLL::Actions {
899
899
QAST ::Var. new ( : name(' &' ~ $ name ), : scope(' lexical' ) )
900
900
));
901
901
902
+ # Static code object needs re-capturing also, as it's
903
+ # our-scoped.
904
+ $ past . blocktype(' declaration_static' );
905
+
902
906
# Also need to make sure it gets a code object so it's
903
907
# in the SC.
904
908
$ * W . create_code($ past , $ name , 0 );
@@ -941,7 +945,7 @@ class NQP::Actions is HLL::Actions {
941
945
}
942
946
else {
943
947
$ past := $ < blockoid > . ast;
944
- $ past . blocktype(' declaration ' );
948
+ $ past . blocktype(' declaration_static ' );
945
949
if $ * RETURN_USED {
946
950
$ past [1 ] := wrap_return_handler($ past [1 ]);
947
951
}
@@ -1225,7 +1229,7 @@ class NQP::Actions is HLL::Actions {
1225
1229
: name(' !protoregex' ),
1226
1230
: op(' callmethod' )
1227
1231
),
1228
- : blocktype(' declaration ' ),
1232
+ : blocktype(' declaration_static ' ),
1229
1233
: node($/ )
1230
1234
);
1231
1235
$ * W . pkg_add_method($ * PACKAGE , ' add_method' , $ name ,
@@ -1247,7 +1251,9 @@ class NQP::Actions is HLL::Actions {
1247
1251
$ regex . name ($ name );
1248
1252
1249
1253
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' );
1251
1257
$ * W . pkg_add_method($ * PACKAGE , ' add_method' , $ name , $ code );
1252
1258
}
1253
1259
0 commit comments