mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: handles printing of structures and arrays of structures
This commit is contained in:
committed by
Alexander Medvednikov
parent
232532ba3b
commit
780ddaf22b
@@ -253,6 +253,9 @@ fn (p mut Parser) gen_array_str(typ mut Type) {
|
||||
})
|
||||
t := typ.name
|
||||
elm_type := t.right(6)
|
||||
if p.typ_to_fmt(elm_type, 0) == '' && !p.table.type_has_method(p.table.find_type(elm_type), 'str') {
|
||||
p.error('cant print ${elm_type}[], unhandled print of ${elm_type}')
|
||||
}
|
||||
p.cgen.fns << '
|
||||
string ${t}_str($t a) {
|
||||
strings__Builder sb = strings__new_builder(a.len * 3);
|
||||
|
||||
Reference in New Issue
Block a user