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

cgen: panic on assertion failed outside tests

This commit is contained in:
Emily Hudson 2020-05-30 12:19:52 +01:00 committed by GitHub
parent dd34e65398
commit a4de507c6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -886,6 +886,7 @@ fn (mut g Gen) gen_assert_stmt(a ast.AssertStmt) {
}
g.writeln('{}else{')
g.writeln(' eprintln( tos_lit("${mod_path}:${a.pos.line_nr+1}: FAIL: fn ${g.fn_decl.name}(): assert $s_assertion"));')
g.writeln(' v_panic(tos_lit("Assertion failed..."));')
g.writeln(' exit(1);')
g.writeln('}')
}