Skip to content

Commit

Permalink
Generate block_pass/iter after assinging temp variables to avoid vari…
Browse files Browse the repository at this point in the history
…able overlap
  • Loading branch information
adambeynon committed Nov 3, 2013
1 parent cf40b98 commit 52cdb5e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/opal/nodes/call.rb
Expand Up @@ -29,14 +29,17 @@ def compile
splat = arglist[1..-1].any? { |a| a.first == :splat }

if Sexp === arglist.last and arglist.last.type == :block_pass
block = expr(arglist.pop)
block = arglist.pop
elsif iter
block = expr(iter)
block = iter
end

tmpfunc = scope.new_temp if block
tmprecv = scope.new_temp if splat || tmpfunc

# must do this after assigning temp variables
block = expr(block) if block

recv_code = recv(recv_sexp)
call_recv = s(:js_tmp, tmprecv || recv_code)

Expand Down

0 comments on commit 52cdb5e

Please sign in to comment.