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

parser/cgen: anon fn var & calling (#4534)

This commit is contained in:
joe-conigliaro
2020-04-21 13:23:36 +10:00
committed by GitHub
parent ee2e83fef0
commit abf5942433
6 changed files with 40 additions and 29 deletions

View File

@@ -390,14 +390,13 @@ pub fn (var t Table) find_or_register_multi_return(mr_typs []Type) int {
return t.register_type_symbol(mr_type)
}
pub fn (var t Table) find_or_register_fn_type(f Fn, has_decl bool) int {
is_anon := f.name.len == 0
name := if is_anon { 'anon_fn_$f.signature()' } else { f.name }
pub fn (var t Table) find_or_register_fn_type(f Fn, is_anon bool, has_decl bool) int {
name := if f.name.len == 0 { 'anon_fn_$f.signature()' } else { f.name }
return t.register_type_symbol(TypeSymbol{
kind: .function
name: name
info: FnType{
is_anon: is_anon
is_anon: f.name.len == 0 || is_anon
has_decl: has_decl
func: f
}