mirror of
https://github.com/vlang/v.git
synced 2025-09-17 11:26:17 -04:00
parent
5495280e7d
commit
45cbf4f14e
@ -450,7 +450,8 @@ pub fn (x &Expr) str() string {
|
|||||||
return x.val.str()
|
return x.val.str()
|
||||||
}
|
}
|
||||||
CastExpr {
|
CastExpr {
|
||||||
return '${global_table.type_to_str(x.typ)}(${x.expr.str()})'
|
type_name := util.strip_main_name(global_table.type_to_str(x.typ))
|
||||||
|
return '${type_name}(${x.expr.str()})'
|
||||||
}
|
}
|
||||||
CallExpr {
|
CallExpr {
|
||||||
sargs := args2str(x.args)
|
sargs := args2str(x.args)
|
||||||
@ -476,7 +477,11 @@ pub fn (x &Expr) str() string {
|
|||||||
if x.name.contains('__static__') {
|
if x.name.contains('__static__') {
|
||||||
return '${x.mod}.${x.get_name()}(${sargs})${propagate_suffix}'
|
return '${x.mod}.${x.get_name()}(${sargs})${propagate_suffix}'
|
||||||
}
|
}
|
||||||
return '${x.mod}.${x.get_name()}(${sargs})${propagate_suffix}'
|
if x.mod == 'main' {
|
||||||
|
return '${x.get_name()}(${sargs})${propagate_suffix}'
|
||||||
|
} else {
|
||||||
|
return '${x.mod}.${x.get_name()}(${sargs})${propagate_suffix}'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CharLiteral {
|
CharLiteral {
|
||||||
return '`${x.val}`'
|
return '`${x.val}`'
|
||||||
@ -513,7 +518,7 @@ pub fn (x &Expr) str() string {
|
|||||||
return x.cached_name
|
return x.cached_name
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
x.cached_name = x.name.clone()
|
x.cached_name = util.strip_main_name(x.name.clone())
|
||||||
}
|
}
|
||||||
return x.cached_name
|
return x.cached_name
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[vlib/v/checker/tests/globals_run/function_stored_in_global.vv:14] voidptr(main.abc) == voidptr(cpu_get_id): true
|
[vlib/v/checker/tests/globals_run/function_stored_in_global.vv:14] voidptr(abc) == voidptr(cpu_get_id): true
|
||||||
[vlib/v/checker/tests/globals_run/function_stored_in_global.vv:15] main.cpu_get_id(): 123
|
[vlib/v/checker/tests/globals_run/function_stored_in_global.vv:15] cpu_get_id(): 123
|
||||||
[vlib/v/checker/tests/globals_run/function_stored_in_global.vv:16] abc(): 123
|
[vlib/v/checker/tests/globals_run/function_stored_in_global.vv:16] abc(): 123
|
||||||
[vlib/v/checker/tests/globals_run/function_stored_in_global.vv:17] abc() == main.cpu_get_id(): true
|
[vlib/v/checker/tests/globals_run/function_stored_in_global.vv:17] abc() == cpu_get_id(): true
|
||||||
|
@ -1 +1 @@
|
|||||||
[vlib/v/slow_tests/inout/dump_sumtype_of_fntype.vv:10] main.MyFnSumtype(main.f): MyFnSumtype(fn (int) v.ast.Expr)
|
[vlib/v/slow_tests/inout/dump_sumtype_of_fntype.vv:10] MyFnSumtype(f): MyFnSumtype(fn (int) v.ast.Expr)
|
||||||
|
@ -4,7 +4,6 @@ vlib/v/tests/skip_unused/assert_of_sumtype_values_works_test.vv:5: fn test_ab
|
|||||||
Right value (len: 6): `Sum(2)`
|
Right value (len: 6): `Sum(2)`
|
||||||
|
|
||||||
vlib/v/tests/skip_unused/assert_of_sumtype_values_works_test.vv:9: fn test_sumtype_literals
|
vlib/v/tests/skip_unused/assert_of_sumtype_values_works_test.vv:9: fn test_sumtype_literals
|
||||||
> assert main.Sum(1) == main.Sum(2)
|
> assert Sum(1) == Sum(2)
|
||||||
Left value (len: 11): `main.Sum(1)`
|
Left value (len: 6): `Sum(1)`
|
||||||
Right value (len: 11): `main.Sum(2)`
|
Right value (len: 6): `Sum(2)`
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ vlib/v/tests/skip_unused/assert_of_sumtype_values_works_test.vv:5: fn test_ab
|
|||||||
Right value (len: 6): `Sum(2)`
|
Right value (len: 6): `Sum(2)`
|
||||||
|
|
||||||
vlib/v/tests/skip_unused/assert_of_sumtype_values_works_test.vv:9: fn test_sumtype_literals
|
vlib/v/tests/skip_unused/assert_of_sumtype_values_works_test.vv:9: fn test_sumtype_literals
|
||||||
> assert main.Sum(1) == main.Sum(2)
|
> assert Sum(1) == Sum(2)
|
||||||
Left value (len: 11): `main.Sum(1)`
|
Left value (len: 6): `Sum(1)`
|
||||||
Right value (len: 11): `main.Sum(2)`
|
Right value (len: 6): `Sum(2)`
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user