mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
rewrite interfaces
This commit is contained in:
@@ -538,16 +538,14 @@ fn (t &Type) find_method(name string) ?Fn {
|
||||
return none
|
||||
}
|
||||
|
||||
/*
|
||||
// TODO
|
||||
fn (t mutt Type) add_gen_type(type_name string) {
|
||||
// println('add_gen_type($s)')
|
||||
if t.gen_types.contains(type_name) {
|
||||
fn (table mut Table) add_gen_type(type_name, gen_type string) {
|
||||
mut t := table.typesmap[type_name]
|
||||
if gen_type in t.gen_types {
|
||||
return
|
||||
}
|
||||
t.gen_types << type_name
|
||||
t.gen_types << gen_type
|
||||
table.typesmap[type_name] = t
|
||||
}
|
||||
*/
|
||||
|
||||
fn (p &Parser) find_type(name string) Type {
|
||||
typ := p.table.find_type(name)
|
||||
@@ -576,7 +574,7 @@ fn (p mut Parser) check_types2(got_, expected_ string, throw bool) bool {
|
||||
if p.pref.translated {
|
||||
return true
|
||||
}
|
||||
if got == expected {
|
||||
if got == expected {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -728,7 +726,8 @@ fn (p mut Parser) satisfies_interface(interface_name, _typ string, throw bool) b
|
||||
for method in int_typ.methods {
|
||||
if !typ.has_method(method.name) {
|
||||
// if throw {
|
||||
p.error('Type "$_typ" doesn\'t satisfy interface "$interface_name" (method "$method.name" is not implemented)')
|
||||
p.error('type `$_typ` doesn\'t satisfy interface ' +
|
||||
'`$interface_name` (method `$method.name` is not implemented)')
|
||||
// }
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user