Skip to content

Commit

Permalink
callstatic the metaop if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterDuke17 committed Feb 23, 2017
1 parent 1811b80 commit 829762a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/Perl6/Optimizer.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1644,16 +1644,29 @@ class Perl6::Optimizer {
$op.pop;

$op.push($assignee);

my $call := 'call';
my $obj;
try {
$obj := $!symbols.find_lexical($metaop[0].name);
}
if $obj {
my $scopes := $!symbols.scopes_in($metaop[0].name);
if $scopes == 0 || $scopes == 1 && nqp::can($obj, 'soft') && !$obj.soft {
$call := 'callstatic';
}
}

if ($is-always-definite) {
$op.push(QAST::Op.new( :op('call'), :name($metaop[0].name),
$op.push(QAST::Op.new( :op($call), :name($metaop[0].name),
$assignee_var,
$operand));
} else {
$op.push(QAST::Op.new( :op('call'), :name($metaop[0].name),
$op.push(QAST::Op.new( :op($call), :name($metaop[0].name),
QAST::Op.new( :op('if'),
QAST::Op.new( :op('p6definite'), $assignee_var),
$assignee_var,
QAST::Op.new( :op('call'), :name($metaop[0].name) ) ),
QAST::Op.new( :op($call), :name($metaop[0].name) ) ),
$operand));
}

Expand Down

0 comments on commit 829762a

Please sign in to comment.