mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix const x := opt() or {}
side effect interference when the consts are in different files in the same module too
This commit is contained in:
parent
e275220f05
commit
b576181a66
@ -5833,7 +5833,9 @@ fn (mut g Gen) const_decl_init_later(mod string, name string, expr ast.Expr, typ
|
||||
}
|
||||
} else {
|
||||
if unwrap_option {
|
||||
g.init.writeln('{')
|
||||
g.init.writeln(g.expr_string_surround('\t$cname = *($styp*)', expr, '.data;'))
|
||||
g.init.writeln('}')
|
||||
} else {
|
||||
g.init.writeln(g.expr_string_surround('\t$cname = ', expr, ';'))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user