mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
This commit is contained in:
parent
bce420c34d
commit
e2398cafd2
@ -932,7 +932,7 @@ fn (mut g Gen) gen_str_for_struct(info ast.Struct, styp string, str_fn_name stri
|
||||
} else {
|
||||
// manage C charptr
|
||||
if field.typ in ast.charptr_types {
|
||||
fn_body.write_string('tos2((byteptr)$func)')
|
||||
fn_body.write_string('tos4((byteptr)$func)')
|
||||
} else {
|
||||
if field.typ.is_ptr() && sym.kind == .struct_ {
|
||||
funcprefix += '(indent_count > 25)? _SLIT("<probably circular>") : '
|
||||
|
@ -763,7 +763,7 @@ fn (mut g JsGen) gen_str_for_struct(info ast.Struct, styp string, str_fn_name st
|
||||
} else {
|
||||
// manage C charptr
|
||||
if field.typ in ast.charptr_types {
|
||||
fn_builder.write_string('tos2((byteptr)$func)')
|
||||
fn_builder.write_string('tos4((byteptr)$func)')
|
||||
} else {
|
||||
if field.typ.is_ptr() && sym.kind == .struct_ {
|
||||
fn_builder.write_string('(indent_count > 25)? new string("<probably circular>") : ')
|
||||
|
@ -463,3 +463,14 @@ fn test_c_struct_typedef() {
|
||||
}'
|
||||
}
|
||||
}
|
||||
|
||||
struct CharptrToStr {
|
||||
cp charptr = charptr(0)
|
||||
}
|
||||
|
||||
fn test_charptr_nil_to_str() {
|
||||
c := CharptrToStr{}
|
||||
assert c.str() == r'CharptrToStr{
|
||||
cp: C""
|
||||
}'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user