mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
523ccbcb70
commit
49277f7aa8
@ -74,6 +74,9 @@ fn (mut g Gen) dump_expr_definitions() {
|
||||
surrounder.add('\tstring value = ${to_string_fn_name}();', '\tstring_free(&value);')
|
||||
} else if dump_sym.kind == .none_ {
|
||||
surrounder.add('\tstring value = _SLIT("none");', '\tstring_free(&value);')
|
||||
} else if is_ptr {
|
||||
surrounder.add('\tstring value = (dump_arg == NULL) ? _SLIT("nil") : ${to_string_fn_name}(${deref}dump_arg);',
|
||||
'\tstring_free(&value);')
|
||||
} else {
|
||||
surrounder.add('\tstring value = ${to_string_fn_name}(${deref}dump_arg);',
|
||||
'\tstring_free(&value);')
|
||||
|
2
vlib/v/tests/inout/dump_nil_voidptr.out
Normal file
2
vlib/v/tests/inout/dump_nil_voidptr.out
Normal file
@ -0,0 +1,2 @@
|
||||
[vlib/v/tests/inout/dump_nil_voidptr.vv:11] a: &nil
|
||||
[vlib/v/tests/inout/dump_nil_voidptr.vv:13] a: &nil
|
14
vlib/v/tests/inout/dump_nil_voidptr.vv
Normal file
14
vlib/v/tests/inout/dump_nil_voidptr.vv
Normal file
@ -0,0 +1,14 @@
|
||||
fn get_nil() ?&int {
|
||||
return unsafe { nil }
|
||||
}
|
||||
|
||||
fn get_voidptr() ?&int {
|
||||
return voidptr(0)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mut a := get_nil()?
|
||||
dump(a)
|
||||
a = get_voidptr()?
|
||||
dump(a)
|
||||
}
|
Loading…
Reference in New Issue
Block a user