Skip to content

Commit

Permalink
Be sure that invocants are boxed objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jul 24, 2012
1 parent f5d0884 commit 0555208
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/QAST/Operations.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,11 @@ QAST::Operations.add_core_op('bind', -> $qastcomp, $op {
});

# Calling.
sub handle_arg($arg, $qastcomp, $ops, @pos_arg_results, @named_arg_results) {
sub handle_arg($arg, $qastcomp, $ops, @pos_arg_results, @named_arg_results, :$coerce) {
my $arg_post := $qastcomp.as_post($arg);
if $coerce {
$arg_post := $qastcomp.coerce($arg_post, $coerce);
}
$ops.push($arg_post);
my $result := $arg_post.result;
if $arg.flat {
Expand Down Expand Up @@ -742,8 +745,15 @@ QAST::Operations.add_core_op('callmethod', -> $qastcomp, $op {
$ops.node($op.node) if $op.node;
my @pos_arg_results;
my @named_arg_results;
my $inv := 1;
for @args {
handle_arg($_, $qastcomp, $ops, @pos_arg_results, @named_arg_results);
if $inv {
handle_arg($_, $qastcomp, $ops, @pos_arg_results, @named_arg_results, :coerce('P'));
$inv := 0;
}
else {
handle_arg($_, $qastcomp, $ops, @pos_arg_results, @named_arg_results);
}
}

# Figure out result register type and allocate a register for it.
Expand Down

0 comments on commit 0555208

Please sign in to comment.