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

parser: function pointers

This commit is contained in:
BigBlack 2019-09-05 17:09:41 +08:00 committed by Alexander Medvednikov
parent 726fcb5eec
commit 7cf058feac

View File

@ -1646,9 +1646,16 @@ fn (p mut Parser) name_expr() string {
// TODO verify this and handle errors
peek := p.peek()
if peek != .lpar && peek != .lt {
// Register anon fn type
fn_typ := Type {
name: f.typ_str()// 'fn (int, int) string'
mod: p.mod
func: f
}
p.table.register_type2(fn_typ)
p.gen(p.table.cgen_name(f))
p.next()
return 'void*'
return f.typ_str() //'void*'
}
// TODO bring back
if f.typ == 'void' && !p.inside_if_expr {