table: simplify find_method()

pull/2023/head
Alexander Medvednikov 2019-09-18 19:48:28 +03:00
parent b0092235fc
commit 74b82b688c
1 changed files with 1 additions and 5 deletions

View File

@ -461,21 +461,17 @@ fn (table &Table) type_has_method(typ &Type, name string) bool {
// TODO use `?Fn`
fn (table &Table) find_method(typ &Type, name string) Fn {
// method := typ.find_method(name)
t := table.typesmap[typ.name]
method := t.find_method(name)
for method in t.methods {
if method.name == name {
return method
}
}
if typ.parent != '' {
parent := table.find_type(typ.parent)
return parent.find_method(name)
}
return method
return Fn{}
}
fn (t &Type) find_method(name string) Fn {