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

cgen: remove unused generated func (#17258)

This commit is contained in:
Felipe Pena 2023-02-08 16:27:24 -03:00 committed by GitHub
parent 404a9aa442
commit fbfdab9e2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 7 deletions

View File

@ -6466,15 +6466,18 @@ static inline __shared__${interface_name} ${shared_fn_name}(__shared__${cctype}*
}
for vtyp, variants in inter_info.conversions {
vsym := g.table.sym(vtyp)
conversion_functions.write_string('static inline bool I_${interface_name}_is_I_${vsym.cname}(${interface_name} x) {\n\treturn ')
for i, variant in variants {
variant_sym := g.table.sym(variant)
if i > 0 {
conversion_functions.write_string(' || ')
if variants.len > 0 {
conversion_functions.write_string('static inline bool I_${interface_name}_is_I_${vsym.cname}(${interface_name} x) {\n\treturn ')
for i, variant in variants {
variant_sym := g.table.sym(variant)
if i > 0 {
conversion_functions.write_string(' || ')
}
conversion_functions.write_string('(x._typ == _${interface_name}_${variant_sym.cname}_index)')
}
conversion_functions.write_string('(x._typ == _${interface_name}_${variant_sym.cname}_index)')
conversion_functions.writeln(';\n}')
}
conversion_functions.writeln(';\n}')
conversion_functions.writeln('static inline ${vsym.cname} I_${interface_name}_as_I_${vsym.cname}(${interface_name} x) {')
for variant in variants {

View File

@ -0,0 +1,10 @@
interface Foo {}
interface Bar {}
pub fn set_foo(mut foo Foo) {
if foo is Bar {
}
}
fn test_main() {}