Skip to content

Commit

Permalink
Make new callstatic op work on other backends.
Browse files Browse the repository at this point in the history
Just compiles into the same thing as 'call' for the time being.
  • Loading branch information
jnthn committed Dec 3, 2013
1 parent 7805299 commit 3d5a834
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/vm/moar/QAST/QASTOperationsMAST.nqp
Expand Up @@ -1203,7 +1203,7 @@ sub arrange_args(@in) {
@posit
}

QAST::MASTOperations.add_core_op('call', sub ($qastcomp, $op) {
my $call_gen := sub ($qastcomp, $op) {
# Cheat for __MVM__ => nqp::foo
if nqp::substr($op.name, 0, 8) eq '&__MVM__' {
my $realname := nqp::substr($op.name, 8);
Expand Down Expand Up @@ -1278,7 +1278,9 @@ QAST::MASTOperations.add_core_op('call', sub ($qastcomp, $op) {
));

MAST::InstructionList.new(@ins, $res_reg, $res_kind)
});
};
QAST::MASTOperations.add_core_op('call', $call_gen);
QAST::MASTOperations.add_core_op('callstatic', $call_gen);

QAST::MASTOperations.add_core_op('callmethod', -> $qastcomp, $op {
my @args := nqp::clone($op.list);
Expand Down
6 changes: 4 additions & 2 deletions src/vm/parrot/QAST/Operations.nqp
Expand Up @@ -884,7 +884,7 @@ sub handle_arg($arg, $qastcomp, $ops, @pos_arg_results, @named_arg_results, :$co
}
}

QAST::Operations.add_core_op('call', -> $qastcomp, $op {
my $call_gen := -> $qastcomp, $op {
# Work out what callee is.
my $callee;
my @args := nqp::clone($op.list);
Expand Down Expand Up @@ -919,7 +919,9 @@ QAST::Operations.add_core_op('call', -> $qastcomp, $op {
$ops.result($res_reg);
}
$ops
});
};
QAST::Operations.add_core_op('call', $call_gen);
QAST::Operations.add_core_op('callstatic', $call_gen);
QAST::Operations.add_core_op('callmethod', :inlinable(1), -> $qastcomp, $op {
# Ensure we at least have an invocant.
my @args := nqp::clone($op.list);
Expand Down

0 comments on commit 3d5a834

Please sign in to comment.