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

cgen: cleanup uneeded C code, when using selectorexpr on $if (#16802)

This commit is contained in:
Felipe Pena 2022-12-29 15:30:42 -03:00 committed by GitHub
parent 6229f48830
commit c7f1db2b8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -492,7 +492,7 @@ fn (mut g Gen) comptime_if_cond(cond ast.Expr, pkg_exist bool) bool {
&& (cond.expr as ast.Ident).name == g.comptime_for_field_var && cond.field_name in ['is_mut', 'is_pub', 'is_shared', 'is_atomic', 'is_optional', 'is_array', 'is_map', 'is_chan', 'is_struct', 'is_alias'] {
ret_bool := g.get_comptime_selector_bool_field(cond.field_name)
g.write(ret_bool.str())
return true
return ret_bool
} else {
g.write('1')
return true