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

assert: print enum value of CTempVars on fail (#10378)

This commit is contained in:
Lukas Neubert 2021-06-07 14:49:48 +02:00 committed by GitHub
parent cd464010d4
commit 98cdde8247
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 2 deletions

View File

@ -88,7 +88,6 @@ fn (mut g Gen) gen_assert_metainfo(node ast.AssertStmt) string {
g.write('\t${metaname}.lvalue = ') g.write('\t${metaname}.lvalue = ')
g.gen_assert_single_expr(node.expr.left, node.expr.left_type) g.gen_assert_single_expr(node.expr.left, node.expr.left_type)
g.writeln(';') g.writeln(';')
//
g.write('\t${metaname}.rvalue = ') g.write('\t${metaname}.rvalue = ')
g.gen_assert_single_expr(node.expr.right, node.expr.right_type) g.gen_assert_single_expr(node.expr.right, node.expr.right_type)
g.writeln(';') g.writeln(';')

View File

@ -100,7 +100,7 @@ fn (mut g Gen) gen_expr_to_string(expr ast.Expr, etype ast.Type) {
g.write('_SLIT("<none>")') g.write('_SLIT("<none>")')
} else if sym.kind == .enum_ { } else if sym.kind == .enum_ {
is_var := match expr { is_var := match expr {
ast.SelectorExpr, ast.Ident { true } ast.SelectorExpr, ast.Ident, ast.CTempVar { true }
else { false } else { false }
} }
if is_var { if is_var {