class Parser::Builders::Default
def block(method_call, begin_t, args, body, end_t)
def block(method_call, begin_t, args, body, end_t) if method_call.type == :yield diagnostic :error, :block_given_to_yield, nil, method_call.loc.keyword, [loc(begin_t)] end if method_call.type == :super *_args, last_arg = *method_call else _receiver, _selector, *_args, last_arg = *method_call end if last_arg && (last_arg.type == :block_pass || last_arg.type == :forwarded_args) if (@parser.version == 33 && method_call.type != :super) || @parser.version != 33 diagnostic :error, :block_and_blockarg, nil, last_arg.loc.expression, [loc(begin_t)] end end if args.type == :numargs block_type = :numblock args = args.children[0] else block_type = :block end if [:send, :csend, :index, :super, :zsuper, :lambda].include?(method_call.type) n(block_type, [ method_call, args, body ], block_map(method_call.loc.expression, begin_t, end_t)) else # Code like "return foo 1 do end" is reduced in a weird sequence. # Here, method_call is actually (return). actual_send, = *method_call block = n(block_type, [ actual_send, args, body ], block_map(actual_send.loc.expression, begin_t, end_t)) n(method_call.type, [ block ], method_call.loc.with_expression(join_exprs(method_call, block))) end end