mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
fix
This commit is contained in:
parent
95da5a856d
commit
631c00f970
2 changed files with 2 additions and 2 deletions
|
@ -7177,7 +7177,7 @@ fn (mut g Gen) or_block(var_name string, or_block ast.OrExpr, return_type ast.Ty
|
|||
}
|
||||
if or_block.kind == .block {
|
||||
g.or_expr_return_type = return_type.clear_option_and_result()
|
||||
if or_block.err_used
|
||||
if !g.pref.skip_unused || or_block.err_used
|
||||
|| (g.fn_decl != unsafe { nil } && (g.fn_decl.is_main || g.fn_decl.is_test)) {
|
||||
g.writeln('\tIError err = ${cvar_name}${tmp_op}err;')
|
||||
}
|
||||
|
|
|
@ -311,7 +311,7 @@ fn (mut g Gen) if_expr(node ast.IfExpr) {
|
|||
// define `err` for the last branch after a `if val := opt {...}' guard
|
||||
if is_guard && guard_idx == i - 1 {
|
||||
if err_var := branch.scope.find_var('err') {
|
||||
if err_var.is_used {
|
||||
if !g.pref.skip_unused || err_var.is_used {
|
||||
cvar_name := guard_vars[guard_idx]
|
||||
g.writeln('\tIError err = ${cvar_name}.err;')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue