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

cgen: correct comments for expr_with_tmp_var() (#17227)

This commit is contained in:
yuyi 2023-02-05 20:16:29 +08:00 committed by GitHub
parent fc65de9bba
commit 858ce4e35d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1831,8 +1831,8 @@ fn (mut g Gen) stmts_with_tmp_var(stmts []ast.Stmt, tmp_var string) bool {
return last_stmt_was_return
}
// expr_with_tmp_var is used in assign expr to `optinal` or `result` type.
// applicable to situations where the expr_typ does not have `optinal` and `result`,
// expr_with_tmp_var is used in assign expr to `option` or `result` type.
// applicable to situations where the expr_typ does not have `option` and `result`,
// e.g. field default: "foo ?int = 1", field assign: "foo = 1", field init: "foo: 1"
fn (mut g Gen) expr_with_tmp_var(expr ast.Expr, expr_typ ast.Type, ret_typ ast.Type, tmp_var string) {
if !ret_typ.has_flag(.option) && !ret_typ.has_flag(.result) {