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

cgen: fix error of embedded struct generating interface_table (#12847)

This commit is contained in:
yuyi 2021-12-15 19:21:21 +08:00 committed by GitHub
parent fa1a7a85f0
commit 2ce1647ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7338,7 +7338,12 @@ static inline $interface_name I_${cctype}_to_Interface_${interface_name}($cctype
if st_sym.info is ast.Struct { if st_sym.info is ast.Struct {
for embed in st_sym.info.embeds { for embed in st_sym.info.embeds {
embed_sym := g.table.get_type_symbol(embed) embed_sym := g.table.get_type_symbol(embed)
methods << embed_sym.methods method_names := methods.map(it.name)
for embed_method in embed_sym.methods {
if embed_method.name !in method_names {
methods << embed_method
}
}
} }
} }
for method in methods { for method in methods {