From 444d49da75ff5cf3935c71dbd724f88345b0bef1 Mon Sep 17 00:00:00 2001 From: yuyi Date: Mon, 25 Jan 2021 21:28:34 +0800 Subject: [PATCH] cgen: minor cleanup of gen_assert_stmt (#8334) --- vlib/v/gen/cgen.v | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index 92002bb076..72fc472d10 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -1579,7 +1579,6 @@ fn (mut g Gen) gen_assert_stmt(original_assert_statement ast.AssertStmt) { metaname_panic := g.gen_assert_metainfo(a) g.writeln('\t__print_assert_failure(&$metaname_panic);') g.writeln('\tv_panic(_SLIT("Assertion failed..."));') - g.writeln('\texit(1);') g.writeln('}') } } @@ -1594,8 +1593,7 @@ fn (mut g Gen) gen_assert_metainfo(a ast.AssertStmt) string { line_nr := a.pos.line_nr src := cestring(a.expr.str()) metaname := 'v_assert_meta_info_$g.new_tmp_var()' - g.writeln('\tVAssertMetaInfo $metaname;') - g.writeln('\tmemset(&$metaname, 0, sizeof(VAssertMetaInfo));') + g.writeln('\tVAssertMetaInfo $metaname = {0};') g.writeln('\t${metaname}.fpath = ${ctoslit(mod_path)};') g.writeln('\t${metaname}.line_nr = $line_nr;') g.writeln('\t${metaname}.fn_name = ${ctoslit(fn_name)};')