cgen: panic on assertion failed outside tests

pull/5137/head
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
1 changed files with 1 additions and 0 deletions

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('}')
}