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

cgen: fix assign option value using propagate option (#17578)

This commit is contained in:
yuyi 2023-03-10 17:30:46 +08:00 committed by GitHub
parent 038fa6c8ab
commit 09c9cbcef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,9 +16,7 @@ fn (mut g Gen) expr_with_opt_or_block(expr ast.Expr, expr_typ ast.Type, var_expr
g.writeln(';')
g.writeln('if (${expr}.state != 0) {')
if expr is ast.Ident && (expr as ast.Ident).or_expr.kind == .propagate_option {
g.write('return ')
g.gen_option_error(g.cur_fn.return_type, expr)
g.writeln(';')
g.writeln('\tpanic_option_not_set(_SLIT("none"));')
} else {
g.inside_or_block = true
defer {