gen: add panic message when using '?' with `none` (#6919)
parent
96539e43b5
commit
380e3640e3
|
@ -5196,7 +5196,7 @@ fn (mut g Gen) or_block(var_name string, or_block ast.OrExpr, return_type table.
|
||||||
paline, pafile, pamod, pafn := g.panic_debug_info(or_block.pos)
|
paline, pafile, pamod, pafn := g.panic_debug_info(or_block.pos)
|
||||||
g.writeln('panic_debug($paline, tos3("$pafile"), tos3("$pamod"), tos3("$pafn"), ${cvar_name}.v_error );')
|
g.writeln('panic_debug($paline, tos3("$pafile"), tos3("$pamod"), tos3("$pafn"), ${cvar_name}.v_error );')
|
||||||
} else {
|
} else {
|
||||||
g.writeln('\tv_panic(${cvar_name}.v_error);')
|
g.writeln('\tv_panic(_STR("optional not set (%.*s\\000)", 2, ${cvar_name}.v_error));')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// In ordinary functions, `opt()?` call is sugar for:
|
// In ordinary functions, `opt()?` call is sugar for:
|
||||||
|
|
Loading…
Reference in New Issue