Skip to content

Commit 0555208

Browse files
committed
Be sure that invocants are boxed objects.
1 parent f5d0884 commit 0555208

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/QAST/Operations.nqp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,11 @@ QAST::Operations.add_core_op('bind', -> $qastcomp, $op {
660660
});
661661

662662
# Calling.
663-
sub handle_arg($arg, $qastcomp, $ops, @pos_arg_results, @named_arg_results) {
663+
sub handle_arg($arg, $qastcomp, $ops, @pos_arg_results, @named_arg_results, :$coerce) {
664664
my $arg_post := $qastcomp.as_post($arg);
665+
if $coerce {
666+
$arg_post := $qastcomp.coerce($arg_post, $coerce);
667+
}
665668
$ops.push($arg_post);
666669
my $result := $arg_post.result;
667670
if $arg.flat {
@@ -742,8 +745,15 @@ QAST::Operations.add_core_op('callmethod', -> $qastcomp, $op {
742745
$ops.node($op.node) if $op.node;
743746
my @pos_arg_results;
744747
my @named_arg_results;
748+
my $inv := 1;
745749
for @args {
746-
handle_arg($_, $qastcomp, $ops, @pos_arg_results, @named_arg_results);
750+
if $inv {
751+
handle_arg($_, $qastcomp, $ops, @pos_arg_results, @named_arg_results, :coerce('P'));
752+
$inv := 0;
753+
}
754+
else {
755+
handle_arg($_, $qastcomp, $ops, @pos_arg_results, @named_arg_results);
756+
}
747757
}
748758

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

0 commit comments

Comments
 (0)