parser: call struct field fns

pull/3128/head
BigBlack 2019-12-18 03:00:08 +08:00 committed by Alexander Medvednikov
parent 09be75f6ae
commit e68200538a
1 changed files with 12 additions and 0 deletions

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