@@ -46,6 +46,27 @@ function reorder_parameters!(args, params_pos)
4646 insert! (args, params_pos, pop! (args))
4747end
4848
49+ function lower_underscores! (anon_args, args, argrange= 1 : length (args))
50+ for i in argrange
51+ a = args[i]
52+ if a == :_
53+ g = gensym ()
54+ push! (anon_args, g)
55+ args[i] = g
56+ elseif a isa Expr
57+ if Meta. isexpr (a, :call ) && length (a. args) > 2 &&
58+ Meta. isexpr (a. args[2 ], :parameters )
59+ lower_underscores! (anon_args, a. args, 1 : 1 )
60+ lower_underscores! (anon_args, a. args, 3 : length (a. args))
61+ lower_underscores! (anon_args, a. args, 2 : 2 )
62+ else
63+ # FIXME : Other out-of-source-order Exprs
64+ lower_underscores! (anon_args, a. args)
65+ end
66+ end
67+ end
68+ end
69+
4970function _to_expr (node:: SyntaxNode ; iteration_spec= false , need_linenodes= true ,
5071 eq_to_kw= false , map_kw_in_params= false )
5172 if ! haschildren (node)
@@ -275,11 +296,17 @@ function _to_expr(node::SyntaxNode; iteration_spec=false, need_linenodes=true,
275296 # Block for conditional's source location
276297 args[1 ] = Expr (:block , loc, args[1 ])
277298 elseif headsym === :(-> )
278- if Meta. isexpr (args[2 ], :block )
279- pushfirst! (args[2 ]. args, loc)
299+ if is_prefix_op_call (node)
300+ anon_args = Symbol[]
301+ lower_underscores! (anon_args, args)
302+ pushfirst! (args, Expr (:tuple , anon_args... ))
280303 else
281- # Add block for source locations
282- args[2 ] = Expr (:block , loc, args[2 ])
304+ if Meta. isexpr (args[2 ], :block )
305+ pushfirst! (args[2 ]. args, loc)
306+ else
307+ # Add block for source locations
308+ args[2 ] = Expr (:block , loc, args[2 ])
309+ end
283310 end
284311 elseif headsym === :function
285312 if length (args) > 1
0 commit comments