Skip to content

Commit

Permalink
Use each_with_object() in code gen. ftw
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Sep 26, 2013
1 parent f865b51 commit b44aa64
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/opal/parser.rb
Expand Up @@ -1248,14 +1248,12 @@ def arity_check(args, opt, splat, block_name, mid)
end

def process_args(exp, level)
args = []

exp.each do |a|
args = exp.each_with_object([]) do |a, obj|
a = a.to_sym
next if a.to_s == '*'
a = lvar_to_js a
@scope.add_arg a
args << a
obj << a
end

f(args.join(', '), exp)
Expand Down

0 comments on commit b44aa64

Please sign in to comment.