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

parser: Infinite multi-dimensional array

This commit is contained in:
Vinicius Rangel
2019-10-17 00:52:58 -03:00
committed by Alexander Medvednikov
parent 5faa7e7861
commit 5481f226dd
2 changed files with 12 additions and 24 deletions

View File

@@ -273,7 +273,10 @@ fn (p mut Parser) gen_array_str(typ Type) {
})
elm_type := typ.name.right(6)
elm_type2 := p.table.find_type(elm_type)
if p.typ_to_fmt(elm_type, 0) == '' &&
is_array := elm_type.starts_with('array_')
if is_array {
p.gen_array_str(elm_type2)
} else if p.typ_to_fmt(elm_type, 0) == '' &&
!p.table.type_has_method(elm_type2, 'str') {
p.error('cant print ${elm_type}[], unhandled print of ${elm_type}')
}