fix option_test.v

pull/2728/head
Alexander Medvednikov 2019-11-11 07:09:07 +03:00
parent 8947717e3e
commit f2b1a8cb16
1 changed files with 2 additions and 2 deletions

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_ph := p.cgen.add_placeholder()
last_typ := p.statements() last_typ := p.statements()
if is_assign && last_typ == typ { 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..] 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('if (!$tmp .ok) {')
p.genln('$name = $last_expr;') p.genln('$name = $last_expr;')
p.genln('}') p.genln('}')