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

pull/10394/head
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.gen_assert_single_expr(node.expr.left, node.expr.left_type)
g.writeln(';')
//
g.write('\t${metaname}.rvalue = ')
g.gen_assert_single_expr(node.expr.right, node.expr.right_type)
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>")')
} else if sym.kind == .enum_ {
is_var := match expr {
ast.SelectorExpr, ast.Ident { true }
ast.SelectorExpr, ast.Ident, ast.CTempVar { true }
else { false }
}
if is_var {