panic: distinguish between builtin and main modules

pull/4702/head
Delyan Angelov 2020-05-04 14:50:43 +03:00
parent cdf70c070b
commit 0e241162d9
3 changed files with 3 additions and 3 deletions

View File

@ -476,7 +476,7 @@ fn (mut g Gen) fn_call(node ast.CallExpr) {
pafn := g.fn_decl.name.after('.')
mut pamod := g.fn_decl.name.all_before_last('.')
if pamod == pafn {
pamod == 'builtin'
pamod = if g.fn_decl.is_builtin { 'builtin' } else { 'main' }
}
g.write('panic_debug($paline, tos3("$pafile"), tos3("$pamod"), tos3("$pafn"), ')
g.call_args(node.args, node.expected_arg_types)

View File

@ -1,5 +1,5 @@
Foo
================ V panic ================
module: __as_cast
module: builtin
function: __as_cast()
message: as cast: cannot cast

View File

@ -1,5 +1,5 @@
================ V panic ================
module: buggy_function
module: main
function: buggy_function()
message: panicing...
file: vlib/v/tests/inout/panic_with_cg.v