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

checker: fix second use of gloabl ident

This commit is contained in:
joe-conigliaro 2020-06-10 16:59:31 +10:00
parent 4a7ec90bef
commit e38a221dc3

View File

@ -1984,16 +1984,13 @@ pub fn (mut c Checker) ident(mut ident ast.Ident) table.Type {
return table.void_type return table.void_type
} }
// second use // second use
if ident.kind == .variable { if ident.kind in [.constant, .global, .variable] {
info := ident.info as ast.IdentVar info := ident.info as ast.IdentVar
// if info.typ == table.t_type { // if info.typ == table.t_type {
// Got a var with type T, return current generic type // Got a var with type T, return current generic type
// return c.cur_generic_type // return c.cur_generic_type
// } // }
return info.typ return info.typ
} else if ident.kind == .constant {
info := ident.info as ast.IdentVar
return info.typ
} else if ident.kind == .function { } else if ident.kind == .function {
info := ident.info as ast.IdentFn info := ident.info as ast.IdentFn
return info.typ return info.typ