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

parser: call struct field fns

This commit is contained in:
BigBlack 2019-12-18 03:00:08 +08:00 committed by Alexander Medvednikov
parent 09be75f6ae
commit e68200538a

View File

@ -1954,6 +1954,18 @@ struct $typ.name {
}
', fname_tidx)
}
if p.base_type(field.typ).starts_with('fn ') && p.peek() == .lpar {
tmp_typ := p.table.find_type(field.typ)
mut f := tmp_typ.func
p.gen('.$field.name')
p.gen('(')
p.check(.name)
p.fn_call_args(mut f)
p.gen(')')
return f.typ
}
p.gen(dot + struct_field)
p.next()
return field.typ