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:
parent
09be75f6ae
commit
e68200538a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user