diff --git a/compiler/parser.v b/compiler/parser.v index 412603d40e..e448dca7af 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -3694,26 +3694,27 @@ fn (p mut Parser) return_st() { p.inside_return_expr = true is_none := p.tok == .key_none p.expected_type = p.cur_fn.typ - // expr_type := p.bool_expression() mut expr_type := p.bool_expression() mut types := []string + mut mr_values := [p.cgen.cur_line.right(ph).trim_space()] types << expr_type for p.tok == .comma { p.check(.comma) + p.cgen.start_tmp() types << p.bool_expression() + mr_values << p.cgen.end_tmp().trim_space() } mut cur_fn_typ_chk := p.cur_fn.typ // multiple returns if types.len > 1 { expr_type = types.join(',') cur_fn_typ_chk = cur_fn_typ_chk.replace('_V_MulRet_', '').replace('_PTR_', '*').replace('_V_', ',') - ret_vals := p.cgen.cur_line.right(ph) mut ret_fields := '' - for ret_val_idx, ret_val in ret_vals.split(' ') { + for ret_val_idx, ret_val in mr_values { if ret_val_idx > 0 { ret_fields += ',' } - ret_fields += '.var_$ret_val_idx=$ret_val' + ret_fields += '.var_$ret_val_idx=${ret_val}' } p.cgen.resetln('($p.cur_fn.typ){$ret_fields}') }