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

gen: add panic message when using '?' with none (#6919)

This commit is contained in:
Nick Treleaven 2020-11-23 15:16:38 +00:00 committed by GitHub
parent 96539e43b5
commit 380e3640e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
g.writeln('panic_debug($paline, tos3("$pafile"), tos3("$pamod"), tos3("$pafn"), ${cvar_name}.v_error );')
} 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 {
// In ordinary functions, `opt()?` call is sugar for: