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

panic: distinguish between builtin and main modules

This commit is contained in:
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('.') pafn := g.fn_decl.name.after('.')
mut pamod := g.fn_decl.name.all_before_last('.') mut pamod := g.fn_decl.name.all_before_last('.')
if pamod == pafn { 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.write('panic_debug($paline, tos3("$pafile"), tos3("$pamod"), tos3("$pafn"), ')
g.call_args(node.args, node.expected_arg_types) g.call_args(node.args, node.expected_arg_types)

View File

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

View File

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