Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jnthn committed Sep 28, 2013
1 parent b86227e commit 6ae4625
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/NQP/Actions.nqp
Expand Up @@ -899,6 +899,10 @@ class NQP::Actions is HLL::Actions {
QAST::Var.new( :name('&' ~ $name), :scope('lexical') )
));

# Static code object needs re-capturing also, as it's
# our-scoped.
$past.blocktype('declaration_static');

# Also need to make sure it gets a code object so it's
# in the SC.
$*W.create_code($past, $name, 0);
Expand Down Expand Up @@ -941,7 +945,7 @@ class NQP::Actions is HLL::Actions {
}
else {
$past := $<blockoid>.ast;
$past.blocktype('declaration');
$past.blocktype('declaration_static');
if $*RETURN_USED {
$past[1] := wrap_return_handler($past[1]);
}
Expand Down Expand Up @@ -1225,7 +1229,7 @@ class NQP::Actions is HLL::Actions {
:name('!protoregex'),
:op('callmethod')
),
:blocktype('declaration'),
:blocktype('declaration_static'),
:node($/)
);
$*W.pkg_add_method($*PACKAGE, 'add_method', $name,
Expand All @@ -1247,7 +1251,9 @@ class NQP::Actions is HLL::Actions {
$regex.name($name);

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

Expand Down

0 comments on commit 6ae4625

Please sign in to comment.