Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[js] Avoid emitting js for closures in void context. This reduces the…
… size of code a lot.
  • Loading branch information
pmurias committed Nov 21, 2015
1 parent 0d93c7c commit d44de00
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/vm/js/QAST/Compiler.nqp
Expand Up @@ -2719,8 +2719,12 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
}
self.stored_result(Chunk.new($want, $cloned_block~".\$call({nqp::join(',', @args)})", $setup, :$node), :$want);
} elsif $node.blocktype eq 'declaration' || $node.blocktype eq '' {
my $cloned_block := $outer.clone_inner($node);
Chunk.new($T_OBJ, $cloned_block, []);
if $want == $T_VOID {
Chunk.void();
} else {
my $cloned_block := $outer.clone_inner($node);
Chunk.new($T_OBJ, $cloned_block, []);
}
} elsif $node.blocktype eq 'declaration_static' {
my $cloned_block := $outer.capture_inner($node);
Chunk.new($T_OBJ, $cloned_block, []);
Expand Down

0 comments on commit d44de00

Please sign in to comment.