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

compiler: nested structure print error fix

This commit is contained in:
Henrixounez 2019-08-29 23:36:29 +02:00 committed by Alexander Medvednikov
parent 0c31172fb0
commit 87ed442d9e

View File

@ -860,7 +860,7 @@ fn (p mut Parser) fn_call_args(f mut Fn) *Fn {
error_msg := ('`$typ` needs to have method `str() string` to be printable') error_msg := ('`$typ` needs to have method `str() string` to be printable')
if T.fields.len > 0 { if T.fields.len > 0 {
mut index := p.cgen.cur_line.len - 1 mut index := p.cgen.cur_line.len - 1
for index > 0 && p.cgen.cur_line[index] != ` ` { index-- } for index > 0 && p.cgen.cur_line[index - 1] != `(` { index-- }
name := p.cgen.cur_line.right(index + 1) name := p.cgen.cur_line.right(index + 1)
if name == '}' { if name == '}' {
p.error(error_msg) p.error(error_msg)