Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make the call op make use of .stored_result.
  • Loading branch information
pmurias committed Sep 17, 2014
1 parent 11a008a commit 3984fc2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/vm/js/QAST/Compiler.nqp
Expand Up @@ -400,8 +400,6 @@ class QAST::OperationsJS {
return Chunk.new($want, '', [$value, "return {$value.expr};\n"]);
}

my $tmp := $*BLOCK.add_tmp();

my $args := nqp::clone($node.list);

my $callee := $node.name
Expand All @@ -410,17 +408,19 @@ class QAST::OperationsJS {

my $compiled_args := $comp.args($args);

my $call;
if nqp::islist($compiled_args) {
my @exprs;
my @setup := [$callee];
for $compiled_args -> $group {
@exprs.push($group.expr);
@setup.push($group);
}
@setup.push("$tmp = {$callee.expr}.apply(undefined,{@exprs.shift ~ '.concat(' ~ nqp::join(',', @exprs)}));\n");
Chunk.new($T_OBJ, $tmp , @setup, :$node);
$comp.stored_result(
Chunk.new($T_OBJ, "{$callee.expr}.apply(undefined,{@exprs.shift ~ '.concat(' ~ nqp::join(',', @exprs)}));\n" , @setup, :$node));
} else {
Chunk.new($T_OBJ, $tmp , [$callee, $compiled_args, "$tmp = {$callee.expr}({$compiled_args.expr});\n"], :$node);
$comp.stored_result(
Chunk.new($T_OBJ, "{$callee.expr}({$compiled_args.expr});\n" , [$callee, $compiled_args], :$node));
}
});

Expand Down

0 comments on commit 3984fc2

Please sign in to comment.