1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fix option_test.v

This commit is contained in:
Alexander Medvednikov 2019-11-11 07:09:07 +03:00
parent 8947717e3e
commit f2b1a8cb16

View File

@ -126,9 +126,9 @@ fn (p mut Parser) gen_handle_option_or_else(_typ, name string, fn_call_ph int) s
last_ph := p.cgen.add_placeholder()
last_typ := p.statements()
if is_assign && last_typ == typ {
expr_line := p.cgen.lines[p.cgen.lines.len-3]
expr_line := p.cgen.lines[p.cgen.lines.len-2]
last_expr := expr_line[last_ph..]
p.cgen.lines[p.cgen.lines.len-3] = ''
p.cgen.lines[p.cgen.lines.len-2] = ''
p.genln('if (!$tmp .ok) {')
p.genln('$name = $last_expr;')
p.genln('}')